Search in sources :

Example 11 with ConfigChangeAction

use of com.yahoo.config.model.api.ConfigChangeAction in project vespa by vespa-engine.

the class ConfigValueChangeValidatorTest method requireThatValidatorHandlesModelsWithDifferentTopology.

@Test
public void requireThatValidatorHandlesModelsWithDifferentTopology() {
    MockRoot oldRoot = createRootWithChildren(new SimpleConfigProducer("p1", 0).withChildren(new ServiceWithAnnotation("s1", 1)), new SimpleConfigProducer("p2", 0).withChildren(new ServiceWithAnnotation("s2", 1)));
    MockRoot newRoot = createRootWithChildren(new ServiceWithAnnotation("s1", 2), new ServiceWithAnnotation("s2", 2), new ServiceWithAnnotation("s3", 2));
    List<ConfigChangeAction> changes = getConfigChanges(oldRoot, newRoot);
    assertTrue(changes.isEmpty());
    assertEmptyLog();
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) Test(org.junit.Test)

Example 12 with ConfigChangeAction

use of com.yahoo.config.model.api.ConfigChangeAction in project vespa by vespa-engine.

the class VespaModelFactory method createAndValidateModel.

@Override
public ModelCreateResult createAndValidateModel(ModelContext modelContext, boolean ignoreValidationErrors) {
    validateXml(modelContext, ignoreValidationErrors);
    DeployState deployState = createDeployState(modelContext, true);
    VespaModel model = buildModel(deployState);
    List<ConfigChangeAction> changeActions = validateModel(model, deployState, ignoreValidationErrors);
    return new ModelCreateResult(model, changeActions);
}
Also used : ModelCreateResult(com.yahoo.config.model.api.ModelCreateResult) DeployState(com.yahoo.config.model.deploy.DeployState) ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction)

Example 13 with ConfigChangeAction

use of com.yahoo.config.model.api.ConfigChangeAction in project vespa by vespa-engine.

the class ContainerRestartValidatorTest method validator_returns_empty_list_for_containers_with_restart_on_deploy_disabled_where_previously_enabled.

@Test
public void validator_returns_empty_list_for_containers_with_restart_on_deploy_disabled_where_previously_enabled() {
    VespaModel current = createModel(true);
    VespaModel next = createModel(false);
    List<ConfigChangeAction> result = validateModel(current, next);
    assertTrue(result.isEmpty());
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) Test(org.junit.Test)

Example 14 with ConfigChangeAction

use of com.yahoo.config.model.api.ConfigChangeAction in project vespa by vespa-engine.

the class StartupCommandChangeValidatorTest method requireThatDifferentStartupCommandIsDetected.

@Test
public void requireThatDifferentStartupCommandIsDetected() {
    MockRoot oldRoot = createRootWithChildren(new ServiceStub("evilservice", "rm -rf /"));
    MockRoot newRoot = createRootWithChildren(new ServiceStub("evilservice", "rm -rf *"));
    List<ConfigChangeAction> changes = getStartupCommandChanges(oldRoot, newRoot);
    assertEquals(1, changes.size());
    assertEquals("evilservice", changes.get(0).getServices().get(0).getConfigId());
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) Test(org.junit.Test)

Aggregations

ConfigChangeAction (com.yahoo.config.model.api.ConfigChangeAction)14 Test (org.junit.Test)11 MockRoot (com.yahoo.config.model.test.MockRoot)7 VespaModel (com.yahoo.vespa.model.VespaModel)5 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)2 ValidationOverrides (com.yahoo.config.application.api.ValidationOverrides)1 ModelCreateResult (com.yahoo.config.model.api.ModelCreateResult)1 ServiceInfo (com.yahoo.config.model.api.ServiceInfo)1 DeployState (com.yahoo.config.model.deploy.DeployState)1 NewDocumentType (com.yahoo.documentmodel.NewDocumentType)1 ValidationTester (com.yahoo.vespa.model.application.validation.ValidationTester)1 DocumentDatabaseChangeValidator (com.yahoo.vespa.model.application.validation.change.search.DocumentDatabaseChangeValidator)1 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)1 DocumentDatabase (com.yahoo.vespa.model.search.DocumentDatabase)1 IndexedSearchCluster (com.yahoo.vespa.model.search.IndexedSearchCluster)1 Instant (java.time.Instant)1 java.util (java.util)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1