diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-10-17 16:27:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-17 16:27:02 +0200 |
commit | bbcccf78cfaa5438c18f188c5dd15a9a979617ee (patch) | |
tree | cb3b35e15c47c108bae252c1cc169945c88c365c /config-model/src/test/java | |
parent | 849401dd245eb9193d1ca31bc288c6b665795747 (diff) | |
parent | b7123d3a07bc823961e452ad527d00e236012ebe (diff) |
Merge branch 'master' into balder/gc-unused-phrase-flags
Diffstat (limited to 'config-model/src/test/java')
8 files changed, 65 insertions, 91 deletions
diff --git a/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java b/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java index c1dd62316db..6507341670f 100644 --- a/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java +++ b/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java @@ -10,6 +10,7 @@ import com.yahoo.config.model.application.provider.DeployData; import com.yahoo.config.model.application.provider.FilesApplicationPackage; import com.yahoo.config.model.deploy.DeployState; import com.yahoo.config.provision.ApplicationId; +import com.yahoo.config.provision.Tags; import com.yahoo.document.DataType; import com.yahoo.io.IOUtils; import com.yahoo.path.Path; @@ -225,17 +226,19 @@ public class ApplicationDeployTest { IOUtils.copyDirectory(new File(appPkg), tmp); ApplicationId applicationId = ApplicationId.from("tenant1", "application1", "instance1"); DeployData deployData = new DeployData("bar", - applicationId, - 13L, - false, - 1337L, - 3L); + applicationId, + Tags.fromString("tag1 tag2"), + 13L, + false, + 1337L, + 3L); FilesApplicationPackage app = FilesApplicationPackage.fromFileWithDeployData(tmp, deployData); app.writeMetaData(); FilesApplicationPackage newApp = FilesApplicationPackage.fromFileWithDeployData(tmp, deployData); ApplicationMetaData meta = newApp.getMetaData(); assertEquals("bar", meta.getDeployPath()); assertEquals(applicationId, meta.getApplicationId()); + assertEquals(Tags.fromString("tag1 tag2"), meta.getTags()); assertEquals(13L, (long) meta.getDeployTimestamp()); assertEquals(1337L, (long) meta.getGeneration()); assertEquals(3L, meta.getPreviousActiveGeneration()); diff --git a/config-model/src/test/java/com/yahoo/schema/processing/PagedAttributeValidatorTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/PagedAttributeValidatorTestCase.java index 719db2ffdcc..9de44d28c09 100644 --- a/config-model/src/test/java/com/yahoo/schema/processing/PagedAttributeValidatorTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/processing/PagedAttributeValidatorTestCase.java @@ -71,8 +71,13 @@ public class PagedAttributeValidatorTestCase { } @Test - void non_dense_tensor_attribute_does_not_support_paged_setting() throws ParseException { - assertPagedSettingNotSupported("tensor(x{},y[2])"); + void non_dense_none_fast_rank_tensor_attribute_supports_paged_setting() throws ParseException { + assertPagedSupported("tensor(x{},y[2])"); + } + + @Test + void non_dense_fast_rank_tensor_attribute_does_not_support_paged_setting() throws ParseException { + assertPagedSettingNotSupported("tensor(x{},y[2])", true); } @Test @@ -82,36 +87,45 @@ public class PagedAttributeValidatorTestCase { @Test void reference_attribute_support_paged_setting() throws ParseException { - assertPagedSupported("reference<parent>", Optional.of(getSd("parent", "int"))); + assertPagedSupported("reference<parent>", Optional.of(getSd("parent", "int", false))); } private void assertPagedSettingNotSupported(String fieldType) throws ParseException { - assertPagedSettingNotSupported(fieldType, Optional.empty()); + assertPagedSettingNotSupported(fieldType, false); + } + + private void assertPagedSettingNotSupported(String fieldType, boolean fastRank) throws ParseException { + assertPagedSettingNotSupported(fieldType, fastRank, Optional.empty()); } - private void assertPagedSettingNotSupported(String fieldType, Optional<String> parentSd) throws ParseException { + private void assertPagedSettingNotSupported(String fieldType, boolean fastRank, Optional<String> parentSd) throws ParseException { try { if (parentSd.isPresent()) { - createFromStrings(new BaseDeployLogger(), parentSd.get(), getSd(fieldType)); + createFromStrings(new BaseDeployLogger(), parentSd.get(), getSd(fieldType, fastRank)); } else { - createFromString(getSd(fieldType)); + createFromString(getSd(fieldType, fastRank)); } fail("Expected exception"); } catch (IllegalArgumentException e) { - assertEquals("For schema 'test', field 'foo': The 'paged' attribute setting is not supported for non-dense tensor, predicate and reference types", + assertEquals("For schema 'test', field 'foo': The 'paged' attribute setting is not supported for fast-rank tensor and predicate types", e.getMessage()); } } private String getSd(String fieldType) { - return getSd("test", fieldType); + return getSd(fieldType, false); + } + + private String getSd(String fieldType, boolean fastRank) { + return getSd("test", fieldType, fastRank); } - private String getSd(String docType, String fieldType) { + private String getSd(String docType, String fieldType, boolean fastRank) { return joinLines( "schema " + docType + " {", " document " + docType + " {", " field foo type " + fieldType + "{", + (fastRank ? "attribute: fast-rank" : ""), " indexing: attribute", " attribute: paged", " }", diff --git a/config-model/src/test/java/com/yahoo/vespa/model/admin/ClusterControllerTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/admin/ClusterControllerTestCase.java index 376cf49c396..eb77187014f 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/admin/ClusterControllerTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/admin/ClusterControllerTestCase.java @@ -413,6 +413,11 @@ public class ClusterControllerTestCase extends DomBuilderTest { assertEquals(0, qrStartConfig.jvm().directMemorySizeCache()); assertEquals(16, qrStartConfig.jvm().baseMaxDirectMemorySize()); + CuratorConfig.Builder curatorBuilder = new CuratorConfig.Builder(); + model.getConfig(curatorBuilder, "foo"); + CuratorConfig curatorConfig = curatorBuilder.build(); + assertEquals(120, curatorConfig.zookeeperSessionTimeoutSeconds()); + assertReindexingConfigPresent(model); assertReindexingConfiguredOnAdminCluster(model); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java index cc6b84de698..da70daa2b4d 100755 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java @@ -343,6 +343,7 @@ public class ContainerClusterTest { assertEquals(List.of("host-c1", "host-c2"), config.server().stream().map(CuratorConfig.Server::hostname).collect(Collectors.toList())); assertTrue(config.zookeeperLocalhostAffinity()); + assertEquals(12, config.zookeeperSessionTimeoutSeconds()); } @Test diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilderTest.java index 272dfa19f64..cf6b6365792 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilderTest.java @@ -570,6 +570,7 @@ public class ContainerModelBuilderTest extends ContainerModelBuilderTestBase { ApplicationContainerCluster cluster = model.getContainerClusters().get("default"); assertNotNull(cluster); assertComponentConfigured(cluster, "com.yahoo.vespa.curator.Curator"); + assertComponentConfigured(cluster, "com.yahoo.vespa.curator.CuratorWrapper"); cluster.getContainers().forEach(container -> { assertComponentConfigured(container, "com.yahoo.vespa.zookeeper.ReconfigurableVespaZooKeeperServer"); assertComponentConfigured(container, "com.yahoo.vespa.zookeeper.Reconfigurer"); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java index 0ba47d9c58b..c41840eaefa 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java @@ -1132,23 +1132,6 @@ public class ContentClusterTest extends ContentBaseTest { assertEquals(4, resolveTunedNumDistributorStripesConfig(65)); } - @Test - void unordered_merge_chaining_config_controlled_by_properties() throws Exception { - assertFalse(resolveUnorderedMergeChainingConfig(Optional.of(false))); - assertTrue(resolveUnorderedMergeChainingConfig(Optional.empty())); - } - - private boolean resolveUnorderedMergeChainingConfig(Optional<Boolean> unorderedMergeChaining) throws Exception { - var props = new TestProperties(); - if (unorderedMergeChaining.isPresent()) { - props.setUnorderedMergeChaining(unorderedMergeChaining.get()); - } - var cluster = createOneNodeCluster(props); - var builder = new StorDistributormanagerConfig.Builder(); - cluster.getDistributorNodes().getConfig(builder); - return (new StorDistributormanagerConfig(builder)).use_unordered_merge_chaining(); - } - private boolean resolveTwoPhaseGcConfigWithFeatureFlag(Boolean flagEnableTwoPhase) { var props = new TestProperties(); if (flagEnableTwoPhase != null) { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java index f7afcc281f9..f3a59733ece 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java @@ -120,9 +120,7 @@ public class StorageClusterTest { parse(cluster("foofighters", joinLines( "<tuning>", " <merges max-per-node=\"1K\" max-queue-size=\"10K\"/>", - "</tuning>")), - new TestProperties().setMaxMergeQueueSize(1919).setMaxConcurrentMergesPerNode(37) - ).getConfig(builder); + "</tuning>"))).getConfig(builder); StorServerConfig config = new StorServerConfig(builder); assertEquals(1024, config.max_merges_per_node()); @@ -174,9 +172,9 @@ public class StorageClusterTest { @Test void testMergeFeatureFlags() { - var config = configFromProperties(new TestProperties().setMaxMergeQueueSize(1919).setMaxConcurrentMergesPerNode(37)); - assertEquals(37, config.max_merges_per_node()); - assertEquals(1919, config.max_merge_queue_size()); + var config = configFromProperties(new TestProperties()); + assertEquals(16, config.max_merges_per_node()); + assertEquals(100, config.max_merge_queue_size()); } @Test @@ -186,19 +184,6 @@ public class StorageClusterTest { } @Test - void merge_throttling_policy_config_is_derived_from_flag() { - var config = configFromProperties(new TestProperties().setMergeThrottlingPolicy("STATIC")); - assertEquals(StorServerConfig.Merge_throttling_policy.Type.STATIC, config.merge_throttling_policy().type()); - - config = configFromProperties(new TestProperties().setMergeThrottlingPolicy("DYNAMIC")); - assertEquals(StorServerConfig.Merge_throttling_policy.Type.DYNAMIC, config.merge_throttling_policy().type()); - - // Invalid enum values fall back to the default - config = configFromProperties(new TestProperties().setMergeThrottlingPolicy("UKULELE")); - assertEquals(StorServerConfig.Merge_throttling_policy.Type.STATIC, config.merge_throttling_policy().type()); - } - - @Test void testVisitors() { StorVisitorConfig.Builder builder = new StorVisitorConfig.Builder(); parse(cluster("bees", @@ -340,23 +325,6 @@ public class StorageClusterTest { } @Test - void persistence_dynamic_throttling_parameters_can_be_set_through_feature_flags() { - var config = filestorConfigFromProducer(simpleCluster(new TestProperties() - .setPersistenceThrottlingWsDecrementFactor(1.5) - .setPersistenceThrottlingWsBackoff(0.8) - .setPersistenceThrottlingWindowSize(42) - .setPersistenceThrottlingWsResizeRate(2.5) - .setPersistenceThrottlingOfMergeFeedOps(false))); - assertEquals(1.5, config.async_operation_throttler().window_size_decrement_factor(), 0.0001); - assertEquals(0.8, config.async_operation_throttler().window_size_backoff(), 0.0001); - // If window size is set, min and max are locked to the same value - assertEquals(42, config.async_operation_throttler().min_window_size()); - assertEquals(42, config.async_operation_throttler().max_window_size()); - assertEquals(2.5, config.async_operation_throttler().resize_rate(), 0.0001); - assertFalse(config.async_operation_throttler().throttle_individual_merge_feed_ops()); - } - - @Test void integrity_checker_explicitly_disabled_when_not_running_with_vds_provider() { StorIntegritycheckerConfig.Builder builder = new StorIntegritycheckerConfig.Builder(); parse(cluster("bees", "")).getConfig(builder); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java index 8830e5484b3..ee885cdf43e 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java @@ -19,7 +19,6 @@ import com.yahoo.vespa.model.content.utils.DocType; import com.yahoo.vespa.model.search.IndexedSearchCluster; import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -55,7 +54,7 @@ public class DocumentDatabaseTestCase { @Test void requireThatMixedModeConcurrencyIsReflectedCorrectlyForDefault() { - verifyConcurrency(Arrays.asList(DocType.create("a", "index"), DocType.create("b", "streaming")), "", 1.0); + verifyConcurrency(List.of(DocType.create("a", "index"), DocType.create("b", "streaming")), "", 1.0); } @Test @@ -63,7 +62,7 @@ public class DocumentDatabaseTestCase { String feedTuning = "<feeding>" + " <concurrency>0.7</concurrency>" + "</feeding>\n"; - verifyConcurrency(Arrays.asList(DocType.create("a", "index"), DocType.create("b", "streaming")), feedTuning, 0.7); + verifyConcurrency(List.of(DocType.create("a", "index"), DocType.create("b", "streaming")), feedTuning, 0.7); } @Test @@ -77,11 +76,11 @@ public class DocumentDatabaseTestCase { } private void verifyConcurrency(String mode, String xmlTuning, double expectedConcurrency, double featureFlagConcurrency) { - verifyConcurrency(Arrays.asList(DocType.create("a", mode)), xmlTuning, expectedConcurrency, featureFlagConcurrency); + verifyConcurrency(List.of(DocType.create("a", mode)), xmlTuning, expectedConcurrency, featureFlagConcurrency); } private void verifyConcurrency(String mode, String xmlTuning, double expectedConcurrency) { - verifyConcurrency(Arrays.asList(DocType.create("a", mode)), xmlTuning, expectedConcurrency, null); + verifyConcurrency(List.of(DocType.create("a", mode)), xmlTuning, expectedConcurrency, null); } private void verifyConcurrency(List<DocType> nameAndModes, String xmlTuning, double expectedConcurrency) { @@ -114,14 +113,14 @@ public class DocumentDatabaseTestCase { @Test void requireFeedNicenessIsReflected() { - verifyFeedNiceness(Arrays.asList(DocType.create("a", "index")), 0.0, null); - verifyFeedNiceness(Arrays.asList(DocType.create("a", "index")), 0.32, 0.32); + verifyFeedNiceness(List.of(DocType.create("a", "index")), 0.0, null); + verifyFeedNiceness(List.of(DocType.create("a", "index")), 0.32, 0.32); } @Test void requireThatModeIsSet() { var tester = new SchemaTester(); - VespaModel model = tester.createModel(Arrays.asList(DocType.create("a", "index"), + VespaModel model = tester.createModel(List.of(DocType.create("a", "index"), DocType.create("b", "streaming"), DocType.create("c", "store-only")), ""); ContentSearchCluster contentSearchCluster = model.getContentClusters().get("test").getSearch(); @@ -150,8 +149,8 @@ public class DocumentDatabaseTestCase { @Test void requireThatMixedModeInitialDocumentCountIsReflectedCorrectlyForDefault() { final long DEFAULT = 1024L; - verifyInitialDocumentCount(Arrays.asList(DocType.create("a", "index"), DocType.create("b", "streaming")), - "", Arrays.asList(DEFAULT, DEFAULT)); + verifyInitialDocumentCount(List.of(DocType.create("a", "index"), DocType.create("b", "streaming")), + "", List.of(DEFAULT, DEFAULT)); } @Test @@ -160,8 +159,8 @@ public class DocumentDatabaseTestCase { String feedTuning = "<resizing>" + " <initialdocumentcount>1000000000</initialdocumentcount>" + "</resizing>\n"; - verifyInitialDocumentCount(Arrays.asList(DocType.create("a", "index"), DocType.create("b", "streaming")), - feedTuning, Arrays.asList(INITIAL, INITIAL)); + verifyInitialDocumentCount(List.of(DocType.create("a", "index"), DocType.create("b", "streaming")), + feedTuning, List.of(INITIAL, INITIAL)); } private void assertDocTypeConfig(VespaModel model, String configId, String indexField, String attributeField) { @@ -345,30 +344,30 @@ public class DocumentDatabaseTestCase { @Test void testThatAttributesMaxUnCommittedMemoryIsControlledByFeatureFlag() { - assertAttributesConfigIndependentOfMode("index", Arrays.asList("type1"), - Arrays.asList("test/search/cluster.test/type1"), - ImmutableMap.of("type1", Arrays.asList("f2", "f2_nfa")), + assertAttributesConfigIndependentOfMode("index", List.of("type1"), + List.of("test/search/cluster.test/type1"), + ImmutableMap.of("type1", List.of("f2", "f2_nfa")), new DeployState.Builder().properties(new TestProperties().maxUnCommittedMemory(193452)), 193452); } @Test void testThatAttributesConfigIsProducedForIndexed() { - assertAttributesConfigIndependentOfMode("index", Arrays.asList("type1"), - Arrays.asList("test/search/cluster.test/type1"), - ImmutableMap.of("type1", Arrays.asList("f2", "f2_nfa"))); + assertAttributesConfigIndependentOfMode("index", List.of("type1"), + List.of("test/search/cluster.test/type1"), + ImmutableMap.of("type1", List.of("f2", "f2_nfa"))); } @Test void testThatAttributesConfigIsProducedForStreamingForFastAccessFields() { - assertAttributesConfigIndependentOfMode("streaming", Arrays.asList("type1"), - Arrays.asList("test/search/type1"), - ImmutableMap.of("type1", Arrays.asList("f2"))); + assertAttributesConfigIndependentOfMode("streaming", List.of("type1"), + List.of("test/search/type1"), + ImmutableMap.of("type1", List.of("f2"))); } @Test void testThatAttributesConfigIsNotProducedForStoreOnlyEvenForFastAccessFields() { - assertAttributesConfigIndependentOfMode("store-only", Arrays.asList("type1"), - Arrays.asList("test/search"), Collections.emptyMap()); + assertAttributesConfigIndependentOfMode("store-only", List.of("type1"), + List.of("test/search"), Collections.emptyMap()); } } |