1

I have a spring boot application which passes through the pipeline of my company. However, it fails to pass the Chaos Monkey attack, basically the attack shuts down the internet and hopes that the spring app responds with DOWN status on its health check. I cannot access or ping any external website since it violates the security of another step of the pipeline. How can I make the code below workable?

@Component
public class PersonalHealthIndicator implements HealthIndicator {
   
    @Override
    public Health health() {
        int errorCode = check(); // método que faz a verificação do health check
 
        if (errorCode != 0) {
            // A verificação falhou, então será retornado um status "DOWN"
            return Health.down()
              .withDetail("Error Code", errorCode).build();
        }
 
        // A verificação funcionou, será retornado um status "UP"
        return Health.up().build();
    }
      
    public int check() {
        // Aqui fica nossa lógica customizada para executar o health check
        return 0;
    }
}

0 Answers0