use of com.yahoo.vespa.hosted.node.admin.nodeadmin.NodeAdmin in project vespa by vespa-engine.
the class RebootTest method test.
@Test
@Ignore
public void test() throws InterruptedException, UnknownHostException {
try (DockerTester dockerTester = new DockerTester()) {
dockerTester.addContainerNodeSpec(createContainerNodeSpec());
// 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);
}
// Check that the container is started and NodeRepo has received the PATCH update
dockerTester.callOrderVerifier.assertInOrder("createContainerCommand with DockerImage { imageId=dockerImage }, HostName: host1.test.yahoo.com, ContainerName { name=host1 }", "updateNodeAttributes with HostName: host1.test.yahoo.com, NodeAttributes{restartGeneration=1, rebootGeneration=null, dockerImage=dockerImage, vespaVersion='null'}");
NodeAdminStateUpdaterImpl updater = dockerTester.nodeAdminStateUpdater;
assertThat(updater.setResumeStateAndCheckIfResumed(NodeAdminStateUpdater.State.SUSPENDED), is(Optional.of("Not all node agents are frozen.")));
updater.setResumeStateAndCheckIfResumed(NodeAdminStateUpdater.State.SUSPENDED);
NodeAdmin nodeAdmin = dockerTester.nodeAdmin;
// Wait for node admin to be frozen
while (!nodeAdmin.isFrozen()) {
System.out.println("Node admin not frozen yet");
Thread.sleep(10);
}
assertTrue(nodeAdmin.setFrozen(false));
dockerTester.callOrderVerifier.assertInOrder("executeInContainer with ContainerName { name=host1 }, args: [" + DockerTester.NODE_PROGRAM + ", stop]");
}
}
use of com.yahoo.vespa.hosted.node.admin.nodeadmin.NodeAdmin in project vespa by vespa-engine.
the class DockerAdminComponent method createNodeAdminStateUpdater.
private NodeAdminStateUpdaterImpl createNodeAdminStateUpdater() {
if (!environment.isPresent()) {
environment = Optional.of(new Environment(configServerConfig));
}
Clock clock = Clock.systemUTC();
String dockerHostHostName = environment.get().getParentHostHostname();
ProcessExecuter processExecuter = new ProcessExecuter();
docker.start();
DockerOperations dockerOperations = new DockerOperationsImpl(docker, environment.get(), processExecuter, new IPAddressesImpl());
StorageMaintainer storageMaintainer = new StorageMaintainer(dockerOperations, processExecuter, metricReceiver, environment.get(), clock);
AclMaintainer aclMaintainer = new AclMaintainer(dockerOperations, configServerClients.nodeRepository(), dockerHostHostName);
Function<String, NodeAgent> nodeAgentFactory = (hostName) -> new NodeAgentImpl(hostName, configServerClients.nodeRepository(), configServerClients.orchestrator(), dockerOperations, storageMaintainer, aclMaintainer, environment.get(), clock, NODE_AGENT_SCAN_INTERVAL);
NodeAdmin nodeAdmin = new NodeAdminImpl(dockerOperations, nodeAgentFactory, storageMaintainer, aclMaintainer, metricReceiver, clock);
return new NodeAdminStateUpdaterImpl(configServerClients.nodeRepository(), configServerClients.orchestrator(), storageMaintainer, nodeAdmin, dockerHostHostName, clock, NODE_ADMIN_CONVERGE_STATE_INTERVAL, classLocking);
}
Aggregations