How to test health checks?

80 views
Skip to first unread message

Konstantyn Smirnov

unread,
Oct 10, 2017, 9:18:46 AM10/10/17
to vert.x
Hello all

I added the dependency:

compile 'io.vertx:vertx-health-check:3.4.2'

and the code to the start() method:


    HealthChecks healthChecks = HealthChecks.create vertx
 
    HealthCheckHandler hch = HealthCheckHandler.createWithHealthChecks healthChecks
    hch.register( 'db' ){ Future<Status> future ->
      try{
        checksmth()
        future.complete Status.OK()
      }catch( Throwable t ){
        future.complete Status.KO()
      }
    }

    Router.router( vertx ).get( '/health' ).handler hch


When I try to curl http://localhost/health, it sez:

curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused.

What am I missing?
Message has been deleted

Alexander Lehmann

unread,
Oct 10, 2017, 11:42:19 AM10/10/17
to vert.x
connection refused would indicate that the server is not listening, are you sure you are starting to listen with the server in the start() method?
Reply all
Reply to author
Forward
0 new messages