Skip to content

Commit

Permalink
Another fix to job status tests to accomodate new types.
Browse files Browse the repository at this point in the history
  • Loading branch information
Miles-Garnsey committed Sep 26, 2023
1 parent b6a042d commit c0e1b61
Showing 1 changed file with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -794,16 +794,14 @@ public void testAsyncRepair() throws IOException, URISyntaxException, Interrupte
return;
}
assertThat(getJobDetailsResponse.getLeft()).isEqualTo(HttpStatus.SC_OK);
Map<String, String> jobDetails =
Job jobDetails =
new JsonMapper()
.readValue(
getJobDetailsResponse.getRight(),
new TypeReference<Map<String, String>>() {});
assertThat(jobDetails)
.hasEntrySatisfying("id", value -> assertThat(value).isEqualTo(jobId))
.hasEntrySatisfying("type", value -> assertThat(value).isEqualTo("repair"))
.hasEntrySatisfying(
"status", value -> assertThat(value).isIn("COMPLETED", "ERROR"));
new TypeReference<Job>() {});
assertThat(jobDetails.getJobId()).isEqualTo(jobId);
assertThat(jobDetails.getJobType()).isEqualTo("repair");
assertThat(jobDetails.getStatus()).isIn("COMPLETED", "ERROR");
});
}

Expand Down Expand Up @@ -1019,18 +1017,12 @@ public void testMoveNode() throws IOException, URISyntaxException {
.thenApply(this::responseAsCodeAndBody)
.join();
assertThat(getJobDetailsResponse.getLeft()).isEqualTo(HttpStatus.SC_OK);
Map<String, String> jobDetails =
Job jobDetails =
new JsonMapper()
.readValue(
getJobDetailsResponse.getRight(),
new TypeReference<Map<String, String>>() {});
assertThat(jobDetails)
.hasEntrySatisfying("id", value -> assertThat(value).isEqualTo(jobId))
.hasEntrySatisfying("type", value -> assertThat(value).isEqualTo("move"))
// if the server has only one token, the job will be completed, otherwise it will
// end up in error
.hasEntrySatisfying(
"status", value -> assertThat(value).isIn("COMPLETED", "ERROR"));
.readValue(getJobDetailsResponse.getRight(), new TypeReference<Job>() {});
assertThat(jobDetails.getJobId()).isEqualTo(jobId);
assertThat(jobDetails.getJobType()).isEqualTo("move");
assertThat(jobDetails.getStatus()).isIn("COMPLETED", "ERROR");
});
}
}
}

0 comments on commit c0e1b61

Please sign in to comment.