Search in sources :

Example 1 with ConfigChangeAction

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

the class IndexingModeChangeValidator method validate.

@Override
public List<ConfigChangeAction> validate(VespaModel currentModel, VespaModel nextModel, ValidationOverrides overrides, Instant now) {
    List<ConfigChangeAction> actions = new ArrayList<>();
    for (Map.Entry<String, ContentCluster> currentEntry : currentModel.getContentClusters().entrySet()) {
        ContentCluster nextCluster = nextModel.getContentClusters().get(currentEntry.getKey());
        if (nextCluster == null)
            continue;
        Optional<ConfigChangeAction> change = validateContentCluster(currentEntry.getValue(), nextCluster, overrides, now);
        if (change.isPresent())
            actions.add(change.get());
    }
    return actions;
}
Also used : ArrayList(java.util.ArrayList) ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) Map(java.util.Map) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Example 2 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.

@Test
public void validator_returns_empty_list_for_containers_with_restart_on_deploy_disabled() {
    VespaModel current = createModel(false);
    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 3 with ConfigChangeAction

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

the class ContainerRestartValidatorTest method validator_returns_action_for_containers_with_restart_on_deploy_enabled.

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

Example 4 with ConfigChangeAction

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

the class StartupCommandChangeValidatorTest method requireEmptyResultForEqualStartupCommand.

@Test
public void requireEmptyResultForEqualStartupCommand() {
    MockRoot oldRoot = createRootWithChildren(new ServiceStub("evilservice", "./hax.sh"));
    MockRoot newRoot = createRootWithChildren(new ServiceStub("evilservice", "./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 5 with ConfigChangeAction

use of com.yahoo.config.model.api.ConfigChangeAction 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)

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