Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BBesrour committed Oct 19, 2024
1 parent 5b778fc commit 7623686
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,6 @@ public void updateBuildAgentInformation() {
log.debug("There are only lite member in the cluster. Not updating build agent information.");
return;
}
// Print buildAgentInformation for debugging
log.debug("Build agent information: {}", buildAgentInformation.values());

// Remove build agent information of offline nodes
removeOfflineNodes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void createJobs() {
job1 = new BuildJobQueueItem("1", "job1", "buildagent1", "address1", 1, course.getId(), 1, 1, 1, BuildStatus.SUCCESSFUL, repositoryInfo, jobTimingInfo1, buildConfig, null);
job2 = new BuildJobQueueItem("2", "job2", "buildagent1", "address1", 2, course.getId(), 1, 1, 1, BuildStatus.SUCCESSFUL, repositoryInfo, jobTimingInfo2, buildConfig, null);
String memberAddress = hazelcastInstance.getCluster().getLocalMember().getAddress().toString();
agent1 = new BuildAgentInformation("build-agent", memberAddress, 1, 0, new ArrayList<>(List.of(job1)), BuildAgentInformation.BuildAgentStatus.IDLE,
agent1 = new BuildAgentInformation("artemis-build-agent-test", memberAddress, 1, 0, new ArrayList<>(List.of(job1)), BuildAgentInformation.BuildAgentStatus.IDLE,
new ArrayList<>(List.of(job2)), null);
BuildJobQueueItem finishedJobQueueItem1 = new BuildJobQueueItem("3", "job3", "buildagent1", "address1", 3, course.getId(), 1, 1, 1, BuildStatus.SUCCESSFUL, repositoryInfo,
jobTimingInfo1, buildConfig, null);
Expand Down Expand Up @@ -370,9 +370,9 @@ void testGetBuildJobStatistics() throws Exception {
@WithMockUser(username = TEST_PREFIX + "admin", roles = "ADMIN")
void testPauseBuildAgent() throws Exception {
request.put("/api/admin/agent/" + URLEncoder.encode(agent1.name(), StandardCharsets.UTF_8) + "/pause", null, HttpStatus.NO_CONTENT);
await().until(() -> buildAgentInformation.get(agent1.name()).status() == BuildAgentInformation.BuildAgentStatus.PAUSED);
await().until(() -> buildAgentInformation.get(agent1.memberAddress()).status() == BuildAgentInformation.BuildAgentStatus.PAUSED);

request.put("/api/admin/agent/" + URLEncoder.encode(agent1.name(), StandardCharsets.UTF_8) + "/resume", null, HttpStatus.NO_CONTENT);
await().until(() -> buildAgentInformation.get(agent1.name()).status() == BuildAgentInformation.BuildAgentStatus.IDLE);
await().until(() -> buildAgentInformation.get(agent1.memberAddress()).status() == BuildAgentInformation.BuildAgentStatus.IDLE);
}
}

0 comments on commit 7623686

Please sign in to comment.