Skip to content

Commit

Permalink
control-service: better error logging for failed test (#2374)
Browse files Browse the repository at this point in the history
  • Loading branch information
murphp15 authored Jul 10, 2023
1 parent 62e2da9 commit e94501a
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public static ImmutablePair<String, String> executeDataJob(
String.format(
"/data-jobs/for-team/%s/jobs/%s/deployments/%s/executions",
teamName, jobName, deploymentId);
MvcResult dataJobExecutionResponse =
var dataJobExecutionResponse =
mockMvc
.perform(
post(triggerDataJobExecutionUrl)
Expand All @@ -147,11 +147,19 @@ public static ImmutablePair<String, String> executeDataJob(
objectMapper.writeValueAsString(
new DataJobExecutionRequest().startedBy(username)))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().is(202))
.andReturn();
.andReturn()
.getResponse();

if (dataJobExecutionResponse.getStatus() != 202) {
throw new Exception(
"status is "
+ dataJobExecutionResponse.getStatus()
+ "\nbody is "
+ dataJobExecutionResponse.getContentAsString());
}

// Check the data job execution status
String location = dataJobExecutionResponse.getResponse().getHeader("location");
String location = dataJobExecutionResponse.getHeader("location");
String executionId = location.substring(location.lastIndexOf("/") + 1);
return ImmutablePair.of(opId, executionId);
}
Expand Down

0 comments on commit e94501a

Please sign in to comment.