Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase execution time checking in HookStageExecutorTest #1467

Merged
merged 1 commit into from
Sep 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,15 @@ public void shouldExecuteEntrypointHooksHappyPath(TestContext context) {
.isEqualTo(HookId.of("module-alpha", "hook-a"));
assertThat(hookOutcome.getStatus()).isEqualTo(ExecutionStatus.success);
assertThat(hookOutcome.getAction()).isEqualTo(ExecutionAction.update);
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 10L);
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 20L);
});

assertThat(group0Hooks.get(1)).satisfies(hookOutcome -> {
assertThat(hookOutcome.getHookId())
.isEqualTo(HookId.of("module-beta", "hook-a"));
assertThat(hookOutcome.getStatus()).isEqualTo(ExecutionStatus.success);
assertThat(hookOutcome.getAction()).isEqualTo(ExecutionAction.update);
assertThat(hookOutcome.getExecutionTime()).isBetween(80L, 90L);
assertThat(hookOutcome.getExecutionTime()).isBetween(80L, 100L);
});

final List<HookExecutionOutcome> group1Hooks = groups.get(1).getHooks();
Expand All @@ -314,15 +314,15 @@ public void shouldExecuteEntrypointHooksHappyPath(TestContext context) {
.isEqualTo(HookId.of("module-beta", "hook-b"));
assertThat(hookOutcome.getStatus()).isEqualTo(ExecutionStatus.success);
assertThat(hookOutcome.getAction()).isEqualTo(ExecutionAction.update);
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 10L);
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 20L);
});

assertThat(group1Hooks.get(1)).satisfies(hookOutcome -> {
assertThat(hookOutcome.getHookId())
.isEqualTo(HookId.of("module-alpha", "hook-b"));
assertThat(hookOutcome.getStatus()).isEqualTo(ExecutionStatus.success);
assertThat(hookOutcome.getAction()).isEqualTo(ExecutionAction.update);
assertThat(hookOutcome.getExecutionTime()).isBetween(40L, 50L);
assertThat(hookOutcome.getExecutionTime()).isBetween(40L, 60L);
});
}));

Expand Down Expand Up @@ -467,7 +467,7 @@ public void shouldExecuteEntrypointHooksToleratingMisbehavingHooks(TestContext c
assertThat(hookOutcome.getStatus())
.isEqualTo(ExecutionStatus.invocation_failure);
assertThat(hookOutcome.getMessage()).isEqualTo("Action returned null");
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 10L);
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 20L);
});

assertThat(group0Hooks.get(1)).satisfies(hookOutcome -> {
Expand All @@ -477,7 +477,7 @@ public void shouldExecuteEntrypointHooksToleratingMisbehavingHooks(TestContext c
.isEqualTo(ExecutionStatus.invocation_failure);
assertThat(hookOutcome.getMessage()).isEqualTo(
"java.lang.RuntimeException: I'm not allowed to throw exceptions");
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 10L);
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 20L);
});

final List<HookExecutionOutcome> group1Hooks = groups.get(1).getHooks();
Expand All @@ -488,7 +488,7 @@ public void shouldExecuteEntrypointHooksToleratingMisbehavingHooks(TestContext c
.isEqualTo(HookId.of("module-beta", "hook-b"));
assertThat(hookOutcome.getStatus()).isEqualTo(ExecutionStatus.success);
assertThat(hookOutcome.getAction()).isEqualTo(ExecutionAction.update);
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 10L);
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 20L);
});

assertThat(group1Hooks.get(1)).satisfies(hookOutcome -> {
Expand All @@ -497,7 +497,7 @@ public void shouldExecuteEntrypointHooksToleratingMisbehavingHooks(TestContext c
assertThat(hookOutcome.getStatus())
.isEqualTo(ExecutionStatus.invocation_failure);
assertThat(hookOutcome.getMessage()).isEqualTo("Action returned null");
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 10L);
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 20L);
});
}));

Expand Down Expand Up @@ -582,7 +582,7 @@ public void shouldExecuteEntrypointHooksToleratingTimeoutAndFailedFuture(TestCon
assertThat(hookOutcome.getStatus())
.isEqualTo(ExecutionStatus.execution_failure);
assertThat(hookOutcome.getMessage()).isEqualTo("Failed after a while");
assertThat(hookOutcome.getExecutionTime()).isBetween(50L, 60L);
assertThat(hookOutcome.getExecutionTime()).isBetween(50L, 70L);
});

assertThat(group0Hooks.get(1)).satisfies(hookOutcome -> {
Expand All @@ -591,7 +591,7 @@ public void shouldExecuteEntrypointHooksToleratingTimeoutAndFailedFuture(TestCon
assertThat(hookOutcome.getStatus()).isEqualTo(ExecutionStatus.timeout);
assertThat(hookOutcome.getMessage()).isEqualTo(
"Timed out while executing action");
assertThat(hookOutcome.getExecutionTime()).isBetween(200L, 210L);
assertThat(hookOutcome.getExecutionTime()).isBetween(200L, 220L);
});

final List<HookExecutionOutcome> group1Hooks = groups.get(1).getHooks();
Expand All @@ -602,7 +602,7 @@ public void shouldExecuteEntrypointHooksToleratingTimeoutAndFailedFuture(TestCon
.isEqualTo(HookId.of("module-beta", "hook-b"));
assertThat(hookOutcome.getStatus()).isEqualTo(ExecutionStatus.success);
assertThat(hookOutcome.getAction()).isEqualTo(ExecutionAction.update);
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 10L);
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 20L);
});

assertThat(group1Hooks.get(1)).satisfies(hookOutcome -> {
Expand All @@ -611,7 +611,7 @@ public void shouldExecuteEntrypointHooksToleratingTimeoutAndFailedFuture(TestCon
assertThat(hookOutcome.getStatus()).isEqualTo(ExecutionStatus.timeout);
assertThat(hookOutcome.getMessage()).isEqualTo(
"Timed out while executing action");
assertThat(hookOutcome.getExecutionTime()).isBetween(200L, 210L);
assertThat(hookOutcome.getExecutionTime()).isBetween(200L, 220L);
});
}));

Expand Down Expand Up @@ -1301,15 +1301,15 @@ public void shouldExecuteRawAuctionRequestHooksToleratingUnknownHookInAccountPla
.isEqualTo(ExecutionStatus.invocation_failure);
assertThat(hookOutcome.getMessage()).isEqualTo(
"Hook implementation does not exist or disabled");
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 10L);
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 20L);
});

assertThat(group0Hooks.get(1)).satisfies(hookOutcome -> {
assertThat(hookOutcome.getHookId())
.isEqualTo(HookId.of("module-beta", "hook-a"));
assertThat(hookOutcome.getStatus()).isEqualTo(ExecutionStatus.success);
assertThat(hookOutcome.getAction()).isEqualTo(ExecutionAction.update);
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 10L);
assertThat(hookOutcome.getExecutionTime()).isBetween(0L, 20L);
});
}));

Expand Down