use of com.yahoo.vespa.hosted.dockerapi.DockerImage in project vespa by vespa-engine.
the class DockerFailTest method dockerFailTest.
@Test
public void dockerFailTest() throws Exception {
try (DockerTester dockerTester = new DockerTester()) {
ContainerNodeSpec containerNodeSpec = new ContainerNodeSpec.Builder().hostname("host1.test.yahoo.com").wantedDockerImage(new DockerImage("dockerImage")).nodeState(Node.State.active).nodeType("tenant").nodeFlavor("docker").wantedRestartGeneration(1L).currentRestartGeneration(1L).minCpuCores(1).minMainMemoryAvailableGb(1).minDiskAvailableGb(1).build();
dockerTester.addContainerNodeSpec(containerNodeSpec);
// Wait for node admin to be notified with node repo state and the docker container has been started
while (dockerTester.nodeAdmin.getListOfHosts().size() == 0) {
Thread.sleep(10);
}
dockerTester.callOrderVerifier.assertInOrder(1200, "createContainerCommand with DockerImage { imageId=dockerImage }, HostName: host1.test.yahoo.com, ContainerName { name=host1 }", "executeInContainerAsRoot with ContainerName { name=host1 }, args: [" + DockerTester.NODE_PROGRAM + ", resume]");
dockerTester.dockerMock.deleteContainer(new ContainerName("host1"));
dockerTester.callOrderVerifier.assertInOrder("deleteContainer with ContainerName { name=host1 }", "createContainerCommand with DockerImage { imageId=dockerImage }, HostName: host1.test.yahoo.com, ContainerName { name=host1 }", "executeInContainerAsRoot with ContainerName { name=host1 }, args: [" + DockerTester.NODE_PROGRAM + ", resume]");
}
}
use of com.yahoo.vespa.hosted.dockerapi.DockerImage in project vespa by vespa-engine.
the class NodeAgentImpl method updateNodeRepoWithCurrentAttributes.
private void updateNodeRepoWithCurrentAttributes(final ContainerNodeSpec nodeSpec) {
final NodeAttributes currentNodeAttributes = new NodeAttributes().withRestartGeneration(nodeSpec.currentRestartGeneration.orElse(null)).withRebootGeneration(nodeSpec.currentRebootGeneration.orElse(0L)).withDockerImage(nodeSpec.currentDockerImage.orElse(new DockerImage(""))).withVespaVersion(nodeSpec.vespaVersion.orElse(""));
final NodeAttributes wantedNodeAttributes = new NodeAttributes().withRestartGeneration(nodeSpec.wantedRestartGeneration.orElse(null)).withRebootGeneration(nodeSpec.wantedRebootGeneration.orElse(0L)).withDockerImage(nodeSpec.wantedDockerImage.filter(node -> containerState == UNKNOWN).orElse(new DockerImage(""))).withVespaVersion(nodeSpec.wantedVespaVersion.filter(node -> containerState == UNKNOWN).orElse(""));
publishStateToNodeRepoIfChanged(currentNodeAttributes, wantedNodeAttributes);
}
Aggregations