MesosDriverHealthCheck extends HealthCheck { @Override protected Result check() throws Exception { Status driverStatus = driverManager.getDriverStatus(); if (Status.DRIVER_RUNNING == driverStatus) { return Result.healthy(); } else { return Result.unhealthy("Driver status: " + driverStatus); } } @Inject  MesosDriverHealthCheck(MyriadDriverManager driverManager);  static final String NAME; }
@Test public void testCheckHealthyResult() throws Exception { HealthCheckTestTuple tuple = getTestStack(); MyriadDriverManager manager = tuple.getManager(); MesosDriverHealthCheck checker = tuple.getChecker(); manager.startDriver(); assertEquals(Result.healthy(), checker.check()); manager.stopDriver(false); }
@Test public void testCheckStoppedDriverUnhealthyResult() throws Exception { HealthCheckTestTuple tuple = getTestStack(); MyriadDriverManager manager = tuple.getManager(); MesosDriverHealthCheck checker = tuple.getChecker(); manager.startDriver(); manager.stopDriver(false); assertEquals(Result.unhealthy("Driver status: DRIVER_STOPPED"), checker.check()); }
@Test public void testCheckAbortedDriverUnhealthyResult() throws Exception { HealthCheckTestTuple tuple = getTestStack(); MyriadDriverManager manager = tuple.getManager(); MesosDriverHealthCheck checker = tuple.getChecker(); manager.startDriver(); manager.abortDriver(); assertEquals(Result.unhealthy("Driver status: DRIVER_ABORTED"), checker.check()); }