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();
}
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();
}
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();
}
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);
}
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;
}
Aggregations