Skip to content

Commit

Permalink
[AT] Update default timeout.
Browse files Browse the repository at this point in the history
  • Loading branch information
corneil committed Jun 27, 2024
1 parent bed162f commit 6d4fd94
Showing 1 changed file with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,6 @@ public void streamLifecycleWithTwoInstance() {
private void awaitValueInLog(Stream stream, final StreamApplication app, final String value) {
AwaitUtils.StreamLog offset = AwaitUtils.logOffset(stream, app.getName());
Awaitility.await()
.timeout(Duration.ofMinutes(2))
.failFast(() -> AwaitUtils.hasErrorInLog(offset))
.conditionEvaluationListener(condition -> {
if (condition.getRemainingTimeInMS() <= condition.getPollInterval().toMillis()) {
Expand Down Expand Up @@ -969,8 +968,8 @@ private void awaitStarting(Stream stream, AwaitUtils.StreamLog offset) {
private void awaitDeployed(Stream stream, AwaitUtils.StreamLog offset) {
final long startErrorCheck = System.currentTimeMillis() + 15_000L;
Awaitility.await("Deployment for " + stream.getName())
.timeout(Duration.ofMinutes(15))
.failFast(() -> System.currentTimeMillis() >= startErrorCheck && AwaitUtils.hasErrorInLog(offset))
.atMost(Duration.ofMinutes(5))
.conditionEvaluationListener(condition -> {
if (condition.getRemainingTimeInMS() <= condition.getPollInterval().toMillis()) {
sendLogsToLogger("awaitDeployed:failing", AwaitUtils.logOffset(stream).logs());
Expand Down Expand Up @@ -1016,17 +1015,16 @@ private void streamLifecycleHelper(int appInstanceCount, Consumer<Stream> stream
streamAssertions.accept(stream);

Awaitility.await()
.timeout(Duration.ofMinutes(15))
.failFast(() -> AwaitUtils.hasErrorInLog(offset))
.until(() -> stream.logs(app("log")).contains("TICKTOCK - TIMESTAMP:"));

assertThat(stream.history().size()).isEqualTo(1L);
Awaitility.await()
.timeout(Duration.ofMinutes(15))
.failFast(() -> AwaitUtils.hasErrorInLog(offset))
.until(() -> stream.history().get(1).equals(DEPLOYED));

assertThat(stream.logs()).contains("TICKTOCK - TIMESTAMP:");
assertThat(stream.logs(app("log"))).contains("TICKTOCK - TIMESTAMP:");

// UPDATE
logger.info("stream-lifecycle-test: UPDATE");
stream.update(new DeploymentPropertiesBuilder().put("app.log.log.expression", "'Updated TICKTOCK - TIMESTAMP: '.concat(payload)")
Expand All @@ -1038,14 +1036,17 @@ private void streamLifecycleHelper(int appInstanceCount, Consumer<Stream> stream
streamAssertions.accept(stream);

Awaitility.await()
.timeout(Duration.ofMinutes(15))
.failFast(() -> AwaitUtils.hasErrorInLog(offset))
.until(() -> stream.logs(app("log")).contains("Updated TICKTOCK - TIMESTAMP:"));

assertThat(stream.history().size()).isEqualTo(2);
Awaitility.await()
.timeout(Duration.ofMinutes(15))
.failFast(() -> AwaitUtils.hasErrorInLog(offset))
.until(() -> stream.history().get(1).equals(DELETED));
Awaitility.await()
.timeout(Duration.ofMinutes(15))
.failFast(() -> AwaitUtils.hasErrorInLog(offset))
.until(() -> stream.history().get(2).equals(DEPLOYED));

Expand All @@ -1058,37 +1059,46 @@ private void streamLifecycleHelper(int appInstanceCount, Consumer<Stream> stream
streamAssertions.accept(stream);

Awaitility.await()
.timeout(Duration.ofMinutes(15))
.failFast(() -> AwaitUtils.hasErrorInLog(offset))
.until(() -> stream.logs(app("log")).contains("TICKTOCK - TIMESTAMP:"));

assertThat(stream.history().size()).isEqualTo(3);
Awaitility.await()
.timeout(Duration.ofMinutes(15))
.failFast(() -> AwaitUtils.hasErrorInLog(offset))
.until(() -> stream.history().get(1).equals(DELETED));
Awaitility.await()
.timeout(Duration.ofMinutes(15))
.failFast(() -> AwaitUtils.hasErrorInLog(offset))
.until(() -> stream.history().get(2).equals(DELETED));
Awaitility.await()
.timeout(Duration.ofMinutes(15))
.until(() -> starting.contains(stream.history().get(3)));
Awaitility.await()
.timeout(Duration.ofMinutes(15))
.failFast(() -> AwaitUtils.hasErrorInLog(offset))
.until(() -> stream.history().get(3).equals(DEPLOYED));

// UNDEPLOY
logger.info("stream-lifecycle-test: UNDEPLOY");
stream.undeploy();
Awaitility.await()
.timeout(Duration.ofMinutes(15))
.failFast(() -> AwaitUtils.hasErrorInLog(offset))
.until(() -> stream.getStatus().equals(UNDEPLOYED));

assertThat(stream.history().size()).isEqualTo(3);
Awaitility.await()
.timeout(Duration.ofMinutes(15))
.failFast(() -> AwaitUtils.hasErrorInLog(offset))
.until(() -> stream.history().get(1).equals(DELETED));
Awaitility.await()
.timeout(Duration.ofMinutes(15))
.failFast(() -> AwaitUtils.hasErrorInLog(offset))
.until(() -> stream.history().get(2).equals(DELETED));
Awaitility.await()
.timeout(Duration.ofMinutes(15))
.failFast(() -> AwaitUtils.hasErrorInLog(offset))
.until(() -> stream.history().get(3).equals(DELETED));

Expand Down Expand Up @@ -1132,6 +1142,7 @@ public void streamScaling() {
awaitStarting(stream, offset);
awaitDeployed(stream, offset);
Awaitility.await()
.timeout(Duration.ofMinutes(15))
.until(() -> stream.runtimeApps().get(log).size() == 2);

assertThat(stream.getStatus()).isEqualTo(DEPLOYED);
Expand Down Expand Up @@ -1176,6 +1187,7 @@ public void namedChannelDestination() {
runtimeApps.httpPost(httpStream.getName(), "http", message);
logger.info("namedChannelDestination:sent:{} to {}", message, httpStream.getName());
Awaitility.await()
.timeout(Duration.ofMinutes(15))
.failFast(() -> AwaitUtils.hasErrorInLog(httpOffset))
.failFast(() -> AwaitUtils.hasErrorInLog(logOffset))
.until(() -> logStream.logs(app("log")).contains(message));
Expand Down Expand Up @@ -1223,6 +1235,7 @@ public void namedChannelTap() {
runtimeApps.httpPost(httpLogStream.getName(), "http", message);
logger.info("namedChannelTap:sent:{}:{}", httpLogStream.getName(), message);
Awaitility.await()
.timeout(Duration.ofMinutes(15))
.failFast(() -> AwaitUtils.hasErrorInLog(tapOffset))
.until(() -> tapStream.logs(app("log")).contains(message));
} catch (Throwable x) {
Expand Down

0 comments on commit 6d4fd94

Please sign in to comment.