use of com.yahoo.vespa.hosted.dockerapi.ContainerName in project vespa by vespa-engine.
the class AclMaintainerTest method makeContainer.
private Container makeContainer(String hostname, Container.State state, int pid) {
final ContainerName containerName = new ContainerName(hostname);
final Container container = new Container(hostname, new DockerImage("mock"), null, containerName, state, pid);
containers.add(container);
return container;
}
use of com.yahoo.vespa.hosted.dockerapi.ContainerName in project vespa by vespa-engine.
the class EnvironmentTest method testNonAbsolutePathInNodeConversion.
@Test(expected = IllegalArgumentException.class)
public void testNonAbsolutePathInNodeConversion() {
Path varPath = Paths.get("some/relative/path");
environment.pathInNodeAdminFromPathInNode(new ContainerName("container-1"), varPath);
}
use of com.yahoo.vespa.hosted.dockerapi.ContainerName in project vespa by vespa-engine.
the class DockerOperationsImplTest method processResultFromNodeProgramWhenSuccess.
@Test
public void processResultFromNodeProgramWhenSuccess() throws Exception {
final ContainerName containerName = new ContainerName("container-name");
final ProcessResult actualResult = new ProcessResult(0, "output", "errors");
final String programPath = "/bin/command";
final String[] command = new String[] { programPath, "arg" };
when(docker.executeInContainerAsRoot(any(), anyVararg())).thenReturn(// output from node program
actualResult);
ProcessResult result = dockerOperations.executeCommandInContainer(containerName, command);
final InOrder inOrder = inOrder(docker);
inOrder.verify(docker, times(1)).executeInContainerAsRoot(eq(containerName), eq(command[0]), eq(command[1]));
assertThat(result, is(actualResult));
}
use of com.yahoo.vespa.hosted.dockerapi.ContainerName in project vespa by vespa-engine.
the class DockerOperationsImplTest method makeContainer.
private Container makeContainer(String name, Container.State state, int pid) {
final Container container = new Container(name + ".fqdn", new DockerImage("mock"), null, new ContainerName(name), state, pid);
when(docker.getContainer(eq(container.name))).thenReturn(Optional.of(container));
return container;
}
use of com.yahoo.vespa.hosted.dockerapi.ContainerName in project vespa by vespa-engine.
the class MultiDockerTest method addAndWaitForNode.
private ContainerNodeSpec addAndWaitForNode(DockerTester tester, String hostName, DockerImage dockerImage) throws InterruptedException {
ContainerNodeSpec containerNodeSpec = new ContainerNodeSpec.Builder().hostname(hostName).wantedDockerImage(dockerImage).wantedVespaVersion("1.2.3").nodeState(Node.State.active).nodeType("tenant").nodeFlavor("docker").wantedRestartGeneration(1L).currentRestartGeneration(1L).minCpuCores(1).minMainMemoryAvailableGb(1).minDiskAvailableGb(1).build();
tester.addContainerNodeSpec(containerNodeSpec);
// Wait for node admin to be notified with node repo state and the docker container has been started
while (tester.nodeAdmin.getListOfHosts().size() != tester.nodeRepositoryMock.getNumberOfContainerSpecs()) {
Thread.sleep(10);
}
ContainerName containerName = ContainerName.fromHostname(hostName);
tester.callOrderVerifier.assertInOrder("createContainerCommand with " + dockerImage + ", HostName: " + hostName + ", " + containerName, "executeInContainerAsRoot with " + containerName + ", args: [" + DockerTester.NODE_PROGRAM + ", resume]");
return containerNodeSpec;
}
Aggregations