Skip to content

Commit

Permalink
test: verify default and after transition
Browse files Browse the repository at this point in the history
Verify health state per default and after transition to a role

(cherry picked from commit f22e89b)
  • Loading branch information
ChrisKujawa authored and github-actions[bot] committed Jul 3, 2023
1 parent 27fcbef commit 6a421c1
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,6 @@ public void shouldReportUnhealthyPerDefault() {
// given
final var captor = ArgumentCaptor.forClass(ZeebePartitionHealth.class);
schedulerRule.submitActor(partition);
partition.onNewRole(Role.LEADER, 1);
schedulerRule.workUntilDone();

// when
schedulerRule.workUntilDone();
Expand All @@ -372,6 +370,24 @@ public void shouldReportUnhealthyPerDefault() {
assertThat(healthReport.getIssue().message()).contains("Initial state");
}

@Test
public void shouldReportHealthyAfterTransition() {
// given
final var captor = ArgumentCaptor.forClass(ZeebePartitionHealth.class);
schedulerRule.submitActor(partition);

// when
partition.onNewRole(Role.LEADER, 1);
schedulerRule.workUntilDone();

// then
verify(healthMonitor).registerComponent(any(), captor.capture());

final var zeebePartitionHealth = captor.getValue();
final HealthReport healthReport = zeebePartitionHealth.getHealthReport();
assertThat(healthReport.getStatus()).isEqualTo(HealthStatus.HEALTHY);
}

@Test
public void shouldReportUnhealthyWhenNoDiskAvailable() {
// given
Expand Down

0 comments on commit 6a421c1

Please sign in to comment.