Search in sources :

Example 6 with MockRoot

use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.

the class StartupCommandChangeValidatorTest method createRootWithChildren.

private static MockRoot createRootWithChildren(AbstractConfigProducer<?>... children) {
    MockRoot root = new MockRoot();
    Arrays.asList(children).forEach(root::addChild);
    root.freezeModelTopology();
    return root;
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot)

Example 7 with MockRoot

use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.

the class StartupCommandChangeValidatorTest method requireEmptyResultForDifferentServices.

@Test
public void requireEmptyResultForDifferentServices() {
    MockRoot oldRoot = createRootWithChildren(new ServiceStub("evilservice", "./hax.sh"));
    MockRoot newRoot = createRootWithChildren(new ServiceStub("goodservice", "./hax.sh"));
    List<ConfigChangeAction> changes = getStartupCommandChanges(oldRoot, newRoot);
    assertTrue(changes.isEmpty());
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) Test(org.junit.Test)

Example 8 with MockRoot

use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.

the class ConfigValueChangeValidatorTest method requireThatValidatorDetectsConfigChangeFromParentProducer.

@Test
public void requireThatValidatorDetectsConfigChangeFromParentProducer() {
    MockRoot oldRoot = createRootWithChildren(new SimpleConfigProducer("p", 1).withChildren(new ServiceWithAnnotation("s1", 0), new ServiceWithAnnotation("s2", 0)));
    MockRoot newRoot = createRootWithChildren(new SimpleConfigProducer("p", 2).withChildren(new ServiceWithAnnotation("s1", 0), new ServiceWithAnnotation("s2", 0)));
    List<ConfigChangeAction> changes = getConfigChanges(oldRoot, newRoot);
    assertEquals(2, changes.size());
    assertComponentsEquals(changes, "p/s1", 0);
    assertComponentsEquals(changes, "p/s2", 1);
    assertEmptyLog();
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) Test(org.junit.Test)

Example 9 with MockRoot

use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.

the class ConfigValueChangeValidatorTest method requireThatValidatorDetectsConfigChangeFromService.

@Test
public void requireThatValidatorDetectsConfigChangeFromService() {
    MockRoot oldRoot = createRootWithChildren(new SimpleConfigProducer("p", 0).withChildren(new ServiceWithAnnotation("s1", 1), new ServiceWithAnnotation("s2", 2)));
    MockRoot newRoot = createRootWithChildren(new SimpleConfigProducer("p", 0).withChildren(new ServiceWithAnnotation("s1", 3), new ServiceWithAnnotation("s2", 4)));
    List<ConfigChangeAction> changes = getConfigChanges(oldRoot, newRoot);
    assertEquals(2, changes.size());
    assertComponentsEquals(changes, "p/s1", 0);
    assertComponentsEquals(changes, "p/s2", 1);
    assertEquals("anotherrestart.anothervalue has changed from 1 to 3", changes.get(0).getMessage());
    assertEquals("anotherrestart.anothervalue has changed from 2 to 4", changes.get(1).getMessage());
    assertEmptyLog();
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) Test(org.junit.Test)

Example 10 with MockRoot

use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.

the class ConfigValueChangeValidatorTest method requireThatConfigHasRestartMethods.

@Test(expected = IllegalStateException.class)
public void requireThatConfigHasRestartMethods() {
    MockRoot root = createRootWithChildren(new ConfigWithMissingMethodsAnnotatedService(""));
    getConfigChanges(root, root);
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) Test(org.junit.Test)

Aggregations

MockRoot (com.yahoo.config.model.test.MockRoot)43 Test (org.junit.Test)29 ConfigChangeAction (com.yahoo.config.model.api.ConfigChangeAction)7 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)7 DeployState (com.yahoo.config.model.deploy.DeployState)6 Host (com.yahoo.vespa.model.Host)4 HostResource (com.yahoo.vespa.model.HostResource)4 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)3 DeployProperties (com.yahoo.config.model.deploy.DeployProperties)3 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)3 Zone (com.yahoo.config.provision.Zone)3 NodeSpec (com.yahoo.vespa.model.search.NodeSpec)3 SearchNode (com.yahoo.vespa.model.search.SearchNode)3 Before (org.junit.Before)3 ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)2 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)2 NewDocumentType (com.yahoo.documentmodel.NewDocumentType)2 StorServerConfig (com.yahoo.vespa.config.content.core.StorServerConfig)2 ContainerSearch (com.yahoo.vespa.model.container.search.ContainerSearch)2 SearchChains (com.yahoo.vespa.model.container.search.searchchain.SearchChains)2