use of com.spotify.helios.agent.HealthCheckerFactory.ExecHealthChecker in project helios by spotify.
the class ExecHealthCheckerTest method setUp.
@Before
public void setUp() throws Exception {
final ExecHealthCheck healthCheck = ExecHealthCheck.of("exit 0");
final Info info = mock(Info.class);
when(info.executionDriver()).thenReturn("native-0.2");
final Version version = mock(Version.class);
when(version.apiVersion()).thenReturn("1.18");
final ExecState execState = mock(ExecState.class);
when(execState.exitCode()).thenReturn(0L);
final LogStream log = mock(LogStream.class);
when(log.readFully()).thenReturn("");
docker = mock(DockerClient.class);
when(docker.info()).thenReturn(info);
when(docker.version()).thenReturn(version);
when(docker.execCreate(eq(CONTAINER_ID), any(String[].class), (DockerClient.ExecCreateParam) anyVararg())).thenReturn(ExecCreation.create(EXEC_ID, emptyList()));
when(docker.execStart(eq(EXEC_ID), (ExecStartParameter) anyVararg())).thenReturn(log);
when(docker.execInspect(EXEC_ID)).thenReturn(execState);
checker = new ExecHealthChecker(healthCheck, docker);
}
Aggregations