Skip to content

Commit

Permalink
lol it's friday alright
Browse files Browse the repository at this point in the history
  • Loading branch information
fzhao99 committed Dec 15, 2023
1 parent 92f0900 commit 7c0696a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
public class BackendAndDatabaseHealthIndicator implements HealthIndicator {
private final FeatureFlagRepository _ffRepo;
private final OktaRepository _oktaRepo;
private static final String ACTIVE_LITERAL = "ACTIVE";
public static final String ACTIVE_LITERAL = "ACTIVE";

@Override
public Health health() {
try {
_ffRepo.findAll();
String oktaStatus = _oktaRepo.getApplicationStatusForHealthCheck();

if (ACTIVE_LITERAL.equals(oktaStatus)) {
log.info("Okta status didn't return active, instead returned " + oktaStatus);
if (!ACTIVE_LITERAL.equals(oktaStatus)) {
log.info("Okta status didn't return ACTIVE, instead returned " + oktaStatus);
return Health.down().build();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package gov.cdc.usds.simplereport.idp.repository;

import static gov.cdc.usds.simplereport.api.heathcheck.BackendAndDatabaseHealthIndicator.ACTIVE_LITERAL;

import com.okta.sdk.resource.model.UserStatus;
import gov.cdc.usds.simplereport.api.CurrentTenantDataAccessContextHolder;
import gov.cdc.usds.simplereport.api.model.errors.ConflictingUserException;
Expand Down Expand Up @@ -434,7 +436,6 @@ public Integer getUsersInSingleFacility(Facility facility) {

@Override
public String getApplicationStatusForHealthCheck() {
String FAKE_STATUS = "ACTIVE";
return FAKE_STATUS;
return ACTIVE_LITERAL;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gov.cdc.usds.simplereport.api.healthcheck;

import static gov.cdc.usds.simplereport.api.heathcheck.BackendAndDatabaseHealthIndicator.ACTIVE_LITERAL;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;

Expand Down Expand Up @@ -29,7 +30,7 @@ class BackendAndDatabaseHealthIndicatorTest extends BaseRepositoryTest {
@Test
void health_succeedsWhenReposDoesntThrow() {
when(mockFeatureFlagRepo.findAll()).thenReturn(List.of());
when(mockOktaRepo.getApplicationStatusForHealthCheck()).thenReturn("ACTIVE");
when(mockOktaRepo.getApplicationStatusForHealthCheck()).thenReturn(ACTIVE_LITERAL);

assertThat(indicator.health()).isEqualTo(Health.up().build());
}
Expand Down

0 comments on commit 7c0696a

Please sign in to comment.