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

control-service: if a test is in a bad state it fails straight away #2098

Merged
merged 23 commits into from
May 29, 2023
Merged
Changes from 19 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
55b33dc
control-service: use public image from github repo
murphp15 May 19, 2023
c524195
control-service: use public image from github repo
murphp15 May 19, 2023
b1d5dc8
control-service: use public image from github repo
murphp15 May 19, 2023
fa4bd3d
control-service: fix failing tests
murphp15 May 19, 2023
10f595a
control-service: fix failing tests
murphp15 May 19, 2023
cac4a62
control-service: faster handling of failed state
murphp15 May 21, 2023
c3fd35f
Google Java Format
May 21, 2023
3e501eb
control-service: fail fast
murphp15 May 26, 2023
e3d60ab
control-service: fail fast
murphp15 May 26, 2023
958929b
control-service: use public image from github repo
murphp15 May 19, 2023
58ae4c1
Merge branch 'main' into person/murphp15/faster_handling_of_failed_state
murphp15 May 26, 2023
038711b
Google Java Format
May 26, 2023
a7e3988
control-service: fail fast
murphp15 May 26, 2023
35b8744
Merge main into person/murphp15/faster_handling_of_failed_state
github-actions[bot] May 26, 2023
ea6c654
Merge main into person/murphp15/faster_handling_of_failed_state
github-actions[bot] May 26, 2023
1e05a87
Merge main into person/murphp15/faster_handling_of_failed_state
github-actions[bot] May 26, 2023
7c8d4c2
Merge main into person/murphp15/faster_handling_of_failed_state
github-actions[bot] May 26, 2023
34250a7
Merge main into person/murphp15/faster_handling_of_failed_state
github-actions[bot] May 26, 2023
086aa36
Merge main into person/murphp15/faster_handling_of_failed_state
github-actions[bot] May 26, 2023
86defa1
control-service: fail fast
murphp15 May 29, 2023
cf130a7
Google Java Format
May 29, 2023
71e6335
control-service: fail fast
murphp15 May 29, 2023
9e1138c
Google Java Format
May 29, 2023
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 @@ -9,6 +9,7 @@
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -161,43 +162,46 @@ public static void testDataJobExecutionRead(
String username,
MockMvc mockMvc) {

com.vmware.taurus.controlplane.model.data.DataJobExecution[] dataJobExecution =
new com.vmware.taurus.controlplane.model.data.DataJobExecution[1];

await()
.atMost(5, TimeUnit.MINUTES)
.with()
.pollInterval(15, TimeUnit.SECONDS)
.until(
() -> {
String dataJobExecutionReadUrl =
String.format(
"/data-jobs/for-team/%s/jobs/%s/executions/%s",
teamName, jobName, executionId);
MvcResult dataJobExecutionResult =
mockMvc
.perform(
get(dataJobExecutionReadUrl)
.with(user(username))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andReturn();

dataJobExecution[0] =
objectMapper.readValue(
dataJobExecutionResult.getResponse().getContentAsString(),
com.vmware.taurus.controlplane.model.data.DataJobExecution.class);
if (dataJobExecution[0] == null) {
log.info("No response from server");
} else {
log.info("Response from server " + dataJobExecution[0].getStatus());
}
return dataJobExecution[0] != null
&& executionStatus.equals(dataJobExecution[0].getStatus());
});

assertDataJobExecutionValid(
executionId, executionStatus, opId, dataJobExecution[0], jobName, username);
Callable<com.vmware.taurus.controlplane.model.data.DataJobExecution> dataJobExecutionCallable =
() -> {
String dataJobExecutionReadUrl =
String.format(
"/data-jobs/for-team/%s/jobs/%s/executions/%s", teamName, jobName, executionId);
MvcResult dataJobExecutionResult =
mockMvc
.perform(
get(dataJobExecutionReadUrl)
.with(user(username))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andReturn();

return objectMapper.readValue(
dataJobExecutionResult.getResponse().getContentAsString(),
com.vmware.taurus.controlplane.model.data.DataJobExecution.class);
};
var result =
await()
.atMost(11, TimeUnit.MINUTES)
.with()
.pollInterval(15, TimeUnit.SECONDS)
.failFast(
() -> {
com.vmware.taurus.controlplane.model.data.DataJobExecution status =
dataJobExecutionCallable.call();
return status != null
&& !status
.getStatus()
.equals(
com.vmware.taurus.controlplane.model.data.DataJobExecution.StatusEnum
.RUNNING)
&& !executionStatus.equals(status.getStatus());
})
.until(
dataJobExecutionCallable,
statusEnum -> statusEnum != null && executionStatus.equals(statusEnum.getStatus()));

assertDataJobExecutionValid(executionId, executionStatus, opId, result, jobName, username);
}

public static void testDataJobExecutionList(
Expand Down