Search in sources :

Example 6 with ConfigChangeAction

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

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

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

the class ConfigValueChangeValidatorTest method requireThatConfigsFromAnnotatedSuperClassesAreDetected.

@Test
public void requireThatConfigsFromAnnotatedSuperClassesAreDetected() {
    MockRoot oldRoot = createRootWithChildren(new SimpleConfigProducer("p", 1).withChildren(new ChildServiceWithAnnotation("child1", 0), new ChildServiceWithoutAnnotation("child2", 0)));
    MockRoot newRoot = createRootWithChildren(new SimpleConfigProducer("p", 2).withChildren(new ChildServiceWithAnnotation("child1", 0), new ChildServiceWithoutAnnotation("child2", 0)));
    List<ConfigChangeAction> changes = getConfigChanges(oldRoot, newRoot);
    assertEquals(2, changes.size());
    assertComponentsEquals(changes, "p/child1", 0);
    assertComponentsEquals(changes, "p/child2", 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 ConfigChangeAction

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

the class IndexingModeChangeValidatorTest method testChangingIndexMode.

@Test
public void testChangingIndexMode() throws IOException, SAXException {
    ValidationTester tester = new ValidationTester();
    VespaModel oldModel = tester.deploy(null, getServices(AbstractSearchCluster.IndexingMode.REALTIME), validationOverrides).getFirst();
    List<ConfigChangeAction> changeActions = tester.deploy(oldModel, getServices(AbstractSearchCluster.IndexingMode.STREAMING), validationOverrides).getSecond();
    assertRefeedChange(// allowed=true due to validation override
    true, "Cluster 'default' changed indexing mode from 'indexed' to 'streaming'", changeActions);
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) ValidationTester(com.yahoo.vespa.model.application.validation.ValidationTester) ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) Test(org.junit.Test)

Example 10 with ConfigChangeAction

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

the class IndexedSearchClusterChangeValidator method validateDocumentDatabases.

private static List<ConfigChangeAction> validateDocumentDatabases(ContentCluster currentCluster, ContentCluster nextCluster, ValidationOverrides overrides, Instant now) {
    List<ConfigChangeAction> result = new ArrayList<>();
    for (DocumentDatabase currentDb : getDocumentDbs(currentCluster.getSearch())) {
        String docTypeName = currentDb.getName();
        Optional<DocumentDatabase> nextDb = nextCluster.getSearch().getIndexed().getDocumentDbs().stream().filter(db -> db.getName().equals(docTypeName)).findFirst();
        if (nextDb.isPresent()) {
            result.addAll(validateDocumentDatabase(currentCluster, nextCluster, docTypeName, currentDb, nextDb.get(), overrides, now));
        }
    }
    return result;
}
Also used : ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) java.util(java.util) Instant(java.time.Instant) DocumentDatabaseChangeValidator(com.yahoo.vespa.model.application.validation.change.search.DocumentDatabaseChangeValidator) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Collectors(java.util.stream.Collectors) IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) VespaModel(com.yahoo.vespa.model.VespaModel) ValidationOverrides(com.yahoo.config.application.api.ValidationOverrides) ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) NewDocumentType(com.yahoo.documentmodel.NewDocumentType) DocumentDatabase(com.yahoo.vespa.model.search.DocumentDatabase) ServiceInfo(com.yahoo.config.model.api.ServiceInfo) ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) DocumentDatabase(com.yahoo.vespa.model.search.DocumentDatabase)

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