Skip to content

Commit

Permalink
add okta call and update script config
Browse files Browse the repository at this point in the history
  • Loading branch information
fzhao99 committed Dec 15, 2023
1 parent a33000c commit 67e9a1c
Show file tree
Hide file tree
Showing 9 changed files with 1,170 additions and 1,131 deletions.
2 changes: 1 addition & 1 deletion .github/actions/post-deploy-smoke-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ runs:
- name: Run smoke test script
shell: bash
working-directory: frontend
run: yarn smoke:env:deploy:ci
run: yarn smoke:deploy:ci
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
package gov.cdc.usds.simplereport.api.heathcheck;

import com.okta.sdk.resource.api.GroupApi;
import com.okta.sdk.resource.client.ApiException;
import gov.cdc.usds.simplereport.db.repository.FeatureFlagRepository;
import gov.cdc.usds.simplereport.idp.repository.LiveOktaRepository;
import gov.cdc.usds.simplereport.idp.repository.OktaRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.exception.JDBCConnectionException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.stereotype.Component;

@Component("prod-smoke-test")
@Component("backend-and-db-smoke-test")
@Slf4j
@RequiredArgsConstructor
public class BackendAndDatabaseHealthIndicator implements HealthIndicator {
private final FeatureFlagRepository _ffRepo;
private final FeatureFlagRepository _ffRepo;
private final OktaRepository _oktaRepo;

@Override
public Health health() {
try {
_ffRepo.findAll();
return Health.up().build();
} catch (JDBCConnectionException e) {
return Health.down().build();
@Override
public Health health() {
try {
_ffRepo.findAll();
_oktaRepo.getConnectTimeoutForHealthCheck();

return Health.up().build();
} catch (JDBCConnectionException e) {
return Health.down().build();
// Okta API call errored
} catch (ApiException e) {
log.info(e.getMessage());
return Health.down().build();
}
}
}
}
Loading

0 comments on commit 67e9a1c

Please sign in to comment.