gauge poking is needed after local application is disconnected same as before it's connected
adjusting test to match current reality
This commit is contained in:
parent
5a399f3d2e
commit
75dee4d8b5
|
@ -1,5 +1,6 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.opensr5.ConfigurationImage;
|
||||
import com.opensr5.Logger;
|
||||
import com.opensr5.ini.field.ScalarIniField;
|
||||
|
@ -24,10 +25,12 @@ import java.net.Socket;
|
|||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
import static com.rusefi.Timeouts.READ_IMAGE_TIMEOUT;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class TestHelper {
|
||||
private static final Logging log = getLogging(TestHelper.class);
|
||||
public static final String LOCALHOST = "localhost";
|
||||
public static final String TEST_SIGNATURE_1 = "rusEFI 2020.07.06.frankenso_na6.2468827536";
|
||||
public static final String TEST_SIGNATURE_2 = "rusEFI 2020.07.11.proteus_f4.1986715563";
|
||||
|
@ -104,8 +107,14 @@ public class TestHelper {
|
|||
}
|
||||
|
||||
public static void assertLatch(String message, CountDownLatch reconnectCounter) throws InterruptedException {
|
||||
assertTrue(message, reconnectCounter.await(READ_IMAGE_TIMEOUT, TimeUnit.MILLISECONDS));
|
||||
System.out.println(message + " is good");
|
||||
assertLatch(message, reconnectCounter, READ_IMAGE_TIMEOUT);
|
||||
}
|
||||
|
||||
public static void assertLatch(String message, CountDownLatch reconnectCounter, int timeout) throws InterruptedException {
|
||||
assertTrue(message, reconnectCounter.await(timeout, TimeUnit.MILLISECONDS));
|
||||
log.info("*******************");
|
||||
log.info(message + " is good");
|
||||
log.info("*******************");
|
||||
}
|
||||
|
||||
public static void assertLatch(CountDownLatch reconnectCounter) throws InterruptedException {
|
||||
|
|
|
@ -120,6 +120,10 @@ public class FullServerTest {
|
|||
SessionDetails authenticatorSessionDetails = new SessionDetails(NetworkConnector.Implementation.Unknown, controllerInfo, TEST_TOKEN_3, networkConnectorResult.getOneTimeToken(), rusEFIVersion.CONSOLE_VERSION);
|
||||
ApplicationRequest applicationRequest = new ApplicationRequest(authenticatorSessionDetails, userDetailsResolver.apply(TestHelper.TEST_TOKEN_1));
|
||||
|
||||
HttpResponse response = LocalApplicationProxy.requestSoftwareUpdate(httpPort, applicationRequest, UpdateType.CONTROLLER);
|
||||
log.info("requestSoftwareUpdate response: " + response.toString());
|
||||
assertLatch("update requested", softwareUpdateRequest);
|
||||
|
||||
// start authenticator
|
||||
LocalApplicationProxy.startAndRun(localApplicationProxyContext, applicationRequest, httpPort,
|
||||
TcpIoStream.DisconnectListener.VOID,
|
||||
|
@ -152,18 +156,12 @@ public class FullServerTest {
|
|||
assertEquals(1, applicationClosed.getCount());
|
||||
|
||||
// now let's test that application connector would be terminated by server due to inactivity
|
||||
log.info("**************************************");
|
||||
log.info("Sleeping twice the application timeout");
|
||||
assertTrue("applicationClosed", applicationClosed.await(3 * applicationTimeout, TimeUnit.MILLISECONDS));
|
||||
log.info("**************************************");
|
||||
assertLatch("applicationClosed", applicationClosed, 3 * applicationTimeout);
|
||||
|
||||
assertEquals("applications size", 0, backend.getApplications().size());
|
||||
|
||||
|
||||
HttpResponse response = LocalApplicationProxy.requestSoftwareUpdate(httpPort, applicationRequest, UpdateType.CONTROLLER);
|
||||
log.info(response.toString());
|
||||
|
||||
assertTrue("update requested", softwareUpdateRequest.await(3 * applicationTimeout, TimeUnit.MILLISECONDS));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue