Search in sources :

Example 1 with ValidationTester

use of com.yahoo.vespa.model.application.validation.ValidationTester in project vespa by vespa-engine.

the class ClusterSizeReductionValidatorTest method testSizeReductionValidation.

@Test
public void testSizeReductionValidation() throws IOException, SAXException {
    ValidationTester tester = new ValidationTester(30);
    VespaModel previous = tester.deploy(null, getServices(30), null).getFirst();
    try {
        tester.deploy(previous, getServices(14), null);
        fail("Expected exception due to cluster size reduction");
    } catch (IllegalArgumentException expected) {
        assertEquals("cluster-size-reduction: Size reduction in 'default' is too large. Current size: 30, new size: 14. New size must be at least 50% of the current size", Exceptions.toMessageString(expected));
    }
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) ValidationTester(com.yahoo.vespa.model.application.validation.ValidationTester) Test(org.junit.Test)

Example 2 with ValidationTester

use of com.yahoo.vespa.model.application.validation.ValidationTester 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 3 with ValidationTester

use of com.yahoo.vespa.model.application.validation.ValidationTester in project vespa by vespa-engine.

the class ClusterSizeReductionValidatorTest method testOverridingSizereductionValidation.

/*
    @Test
    public void testSizeReductionTo50PercentIsAllowed() throws IOException, SAXException {
        ValidationTester tester = new ValidationTester(30);

        VespaModel previous = tester.deploy(null, getServices(30), null).getFirst();
        tester.deploy(previous, getServices(15), null);
    }
    */
@Test
public void testOverridingSizereductionValidation() throws IOException, SAXException {
    ValidationTester tester = new ValidationTester(30);
    VespaModel previous = tester.deploy(null, getServices(30), null).getFirst();
    // Allowed due to override
    tester.deploy(previous, getServices(14), sizeReductionOverride);
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) ValidationTester(com.yahoo.vespa.model.application.validation.ValidationTester) Test(org.junit.Test)

Example 4 with ValidationTester

use of com.yahoo.vespa.model.application.validation.ValidationTester in project vespa by vespa-engine.

the class ClusterSizeReductionValidatorTest method testSizeReductionValidationMinimalDecreaseIsAllowed.

@Test
public void testSizeReductionValidationMinimalDecreaseIsAllowed() throws IOException, SAXException {
    ValidationTester tester = new ValidationTester(30);
    VespaModel previous = tester.deploy(null, getServices(3), null).getFirst();
    tester.deploy(previous, getServices(2), null);
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) ValidationTester(com.yahoo.vespa.model.application.validation.ValidationTester) Test(org.junit.Test)

Example 5 with ValidationTester

use of com.yahoo.vespa.model.application.validation.ValidationTester in project vespa by vespa-engine.

the class ContentClusterRemovalValidatorTest method testOverridingContentRemovalValidation.

@Test
public void testOverridingContentRemovalValidation() throws IOException, SAXException {
    ValidationTester tester = new ValidationTester();
    VespaModel previous = tester.deploy(null, getServices("contentClusterId"), null).getFirst();
    // Allowed due to override
    tester.deploy(previous, getServices("newContentClusterId"), removalOverride);
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) ValidationTester(com.yahoo.vespa.model.application.validation.ValidationTester) Test(org.junit.Test)

Aggregations

VespaModel (com.yahoo.vespa.model.VespaModel)6 ValidationTester (com.yahoo.vespa.model.application.validation.ValidationTester)6 Test (org.junit.Test)6 ConfigChangeAction (com.yahoo.config.model.api.ConfigChangeAction)1