aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/vespa/model/search
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@yahooinc.com>2022-07-28 14:44:47 +0200
committerBjørn Christian Seime <bjorncs@yahooinc.com>2022-07-28 14:51:35 +0200
commit695209a356ecae42536fd394189a98cf5274518e (patch)
treefff14a30ce9efde18a83d15ff08bbdb672119477 /config-model/src/test/java/com/yahoo/vespa/model/search
parent9dab1e67022884f6644b3d8c9b02c6b3c466a879 (diff)
Convert config-model to junit5
Diffstat (limited to 'config-model/src/test/java/com/yahoo/vespa/model/search')
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/NodeResourcesTuningTest.java72
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java78
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentSelectionConverterTest.java19
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaClusterTest.java133
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaInfoTestCase.java36
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaTester.java2
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchNodeTest.java18
7 files changed, 178 insertions, 180 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/NodeResourcesTuningTest.java b/config-model/src/test/java/com/yahoo/vespa/model/search/NodeResourcesTuningTest.java
index 5571ead11ce..fece6ca47e3 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/search/NodeResourcesTuningTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/search/NodeResourcesTuningTest.java
@@ -6,13 +6,13 @@ import com.yahoo.config.provision.Flavor;
import com.yahoo.config.provisioning.FlavorsConfig;
import com.yahoo.vespa.config.search.core.ProtonConfig;
import com.yahoo.vespa.model.container.ApplicationContainerCluster;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.List;
import static com.yahoo.vespa.model.search.NodeResourcesTuning.reservedMemoryGb;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static com.yahoo.vespa.model.search.NodeResourcesTuning.MB;
import static com.yahoo.vespa.model.search.NodeResourcesTuning.GB;
@@ -26,19 +26,19 @@ public class NodeResourcesTuningTest {
private static final double DEFAULT_MEMORY_GAIN = 0.08;
@Test
- public void require_that_hwinfo_disk_size_is_set() {
+ void require_that_hwinfo_disk_size_is_set() {
ProtonConfig cfg = configFromDiskSetting(100);
assertEquals(100 * GB, cfg.hwinfo().disk().size());
}
@Test
- public void require_that_hwinfo_memory_size_is_set() {
+ void require_that_hwinfo_memory_size_is_set() {
assertEquals(24 * GB, configFromMemorySetting(24 + reservedMemoryGb, 0).hwinfo().memory().size());
- assertEquals(combinedFactor * 24 * GB, configFromMemorySetting(24 + reservedMemoryGb, ApplicationContainerCluster.heapSizePercentageOfTotalNodeMemoryWhenCombinedCluster*0.01).hwinfo().memory().size(), 1000);
+ assertEquals(combinedFactor * 24 * GB, configFromMemorySetting(24 + reservedMemoryGb, ApplicationContainerCluster.heapSizePercentageOfTotalNodeMemoryWhenCombinedCluster * 0.01).hwinfo().memory().size(), 1000);
}
@Test
- public void reserved_memory_on_content_node_is_0_5_gb() {
+ void reserved_memory_on_content_node_is_0_5_gb() {
assertEquals(0.5, reservedMemoryGb, delta);
}
@@ -65,19 +65,19 @@ public class NodeResourcesTuningTest {
}
@Test
- public void require_that_initial_numdocs_is_dependent_of_mode_and_searchablecopies() {
+ void require_that_initial_numdocs_is_dependent_of_mode_and_searchablecopies() {
verify_that_initial_numdocs_is_dependent_of_mode();
}
@Test
- public void require_that_hwinfo_cpu_cores_is_set() {
+ void require_that_hwinfo_cpu_cores_is_set() {
ProtonConfig cfg = configFromNumCoresSetting(24);
assertEquals(24, cfg.hwinfo().cpu().cores());
}
@Test
- public void require_that_num_search_threads_and_summary_threads_follow_cores() {
+ void require_that_num_search_threads_and_summary_threads_follow_cores() {
ProtonConfig cfg = configFromNumCoresSetting(4.5);
assertEquals(5, cfg.numsearcherthreads());
assertEquals(5, cfg.numsummarythreads());
@@ -85,7 +85,7 @@ public class NodeResourcesTuningTest {
}
@Test
- public void require_that_num_search_threads_and_considers_explict_num_threads_per_search() {
+ void require_that_num_search_threads_and_considers_explict_num_threads_per_search() {
ProtonConfig cfg = configFromNumCoresSetting(4.5, 3);
assertEquals(15, cfg.numsearcherthreads());
assertEquals(5, cfg.numsummarythreads());
@@ -93,45 +93,45 @@ public class NodeResourcesTuningTest {
}
@Test
- public void require_that_fast_disk_is_reflected_in_proton_config() {
+ void require_that_fast_disk_is_reflected_in_proton_config() {
ProtonConfig cfg = configFromDiskSetting(true);
assertEquals(200, cfg.hwinfo().disk().writespeed(), delta);
assertEquals(100, cfg.hwinfo().disk().slowwritespeedlimit(), delta);
}
@Test
- public void require_that_slow_disk_is_reflected_in_proton_config() {
+ void require_that_slow_disk_is_reflected_in_proton_config() {
ProtonConfig cfg = configFromDiskSetting(false);
assertEquals(40, cfg.hwinfo().disk().writespeed(), delta);
assertEquals(100, cfg.hwinfo().disk().slowwritespeedlimit(), delta);
}
@Test
- public void require_that_document_store_maxfilesize_is_set_based_on_available_memory() {
+ void require_that_document_store_maxfilesize_is_set_based_on_available_memory() {
assertDocumentStoreMaxFileSize(256 * MB, 4);
assertDocumentStoreMaxFileSize(256 * MB, 6);
assertDocumentStoreMaxFileSize(256 * MB, 8);
assertDocumentStoreMaxFileSize(256 * MB, 12);
- assertDocumentStoreMaxFileSize((long)(16*GB*0.02), 16);
- assertDocumentStoreMaxFileSize((long)(24*GB*0.02), 24);
- assertDocumentStoreMaxFileSize((long)(32*GB*0.02), 32);
- assertDocumentStoreMaxFileSize((long)(48*GB*0.02), 48);
- assertDocumentStoreMaxFileSize((long)(64*GB*0.02), 64);
- assertDocumentStoreMaxFileSize((long)(128*GB*0.02), 128);
- assertDocumentStoreMaxFileSize((long)(256*GB*0.02), 256);
- assertDocumentStoreMaxFileSize((long)(512*GB*0.02), 512);
+ assertDocumentStoreMaxFileSize((long) (16 * GB * 0.02), 16);
+ assertDocumentStoreMaxFileSize((long) (24 * GB * 0.02), 24);
+ assertDocumentStoreMaxFileSize((long) (32 * GB * 0.02), 32);
+ assertDocumentStoreMaxFileSize((long) (48 * GB * 0.02), 48);
+ assertDocumentStoreMaxFileSize((long) (64 * GB * 0.02), 64);
+ assertDocumentStoreMaxFileSize((long) (128 * GB * 0.02), 128);
+ assertDocumentStoreMaxFileSize((long) (256 * GB * 0.02), 256);
+ assertDocumentStoreMaxFileSize((long) (512 * GB * 0.02), 512);
}
@Test
- public void require_that_flush_strategy_memory_limits_are_set_based_on_available_memory() {
- assertFlushStrategyMemory((long)(4 * GB * DEFAULT_MEMORY_GAIN), 4);
- assertFlushStrategyMemory((long)(8 * GB * DEFAULT_MEMORY_GAIN), 8);
- assertFlushStrategyMemory((long)(24 * GB * DEFAULT_MEMORY_GAIN), 24);
- assertFlushStrategyMemory((long)(64 * GB * DEFAULT_MEMORY_GAIN), 64);
+ void require_that_flush_strategy_memory_limits_are_set_based_on_available_memory() {
+ assertFlushStrategyMemory((long) (4 * GB * DEFAULT_MEMORY_GAIN), 4);
+ assertFlushStrategyMemory((long) (8 * GB * DEFAULT_MEMORY_GAIN), 8);
+ assertFlushStrategyMemory((long) (24 * GB * DEFAULT_MEMORY_GAIN), 24);
+ assertFlushStrategyMemory((long) (64 * GB * DEFAULT_MEMORY_GAIN), 64);
}
@Test
- public void require_that_flush_strategy_tls_size_is_set_based_on_available_disk() {
+ void require_that_flush_strategy_tls_size_is_set_based_on_available_disk() {
assertFlushStrategyTlsSize(2 * GB, 10);
assertFlushStrategyTlsSize(2 * GB, 100);
assertFlushStrategyTlsSize(10 * GB, 500);
@@ -140,31 +140,31 @@ public class NodeResourcesTuningTest {
}
@Test
- public void require_that_summary_read_io_is_set_based_on_disk() {
+ void require_that_summary_read_io_is_set_based_on_disk() {
assertSummaryReadIo(ProtonConfig.Summary.Read.Io.DIRECTIO, true);
assertSummaryReadIo(ProtonConfig.Summary.Read.Io.MMAP, false);
}
@Test
- public void require_that_search_read_mmap_advise_is_set_based_on_disk() {
+ void require_that_search_read_mmap_advise_is_set_based_on_disk() {
assertSearchReadAdvise(ProtonConfig.Search.Mmap.Advise.RANDOM, true);
assertSearchReadAdvise(ProtonConfig.Search.Mmap.Advise.NORMAL, false);
}
@Test
- public void require_that_summary_cache_max_bytes_is_set_based_on_memory() {
- assertEquals(1*GB / 25, configFromMemorySetting(1 + reservedMemoryGb, 0).summary().cache().maxbytes());
- assertEquals(256*GB / 25, configFromMemorySetting(256 + reservedMemoryGb, 0).summary().cache().maxbytes());
+ void require_that_summary_cache_max_bytes_is_set_based_on_memory() {
+ assertEquals(1 * GB / 25, configFromMemorySetting(1 + reservedMemoryGb, 0).summary().cache().maxbytes());
+ assertEquals(256 * GB / 25, configFromMemorySetting(256 + reservedMemoryGb, 0).summary().cache().maxbytes());
}
@Test
- public void require_that_summary_cache_memory_is_reduced_with_combined_cluster() {
- assertEquals(combinedFactor * 1*GB / 25, configFromMemorySetting(1 + reservedMemoryGb, ApplicationContainerCluster.heapSizePercentageOfTotalNodeMemoryWhenCombinedCluster*0.01).summary().cache().maxbytes(), 1000);
- assertEquals(combinedFactor * 256*GB / 25, configFromMemorySetting(256 + reservedMemoryGb, ApplicationContainerCluster.heapSizePercentageOfTotalNodeMemoryWhenCombinedCluster*0.01).summary().cache().maxbytes(), 1000);
+ void require_that_summary_cache_memory_is_reduced_with_combined_cluster() {
+ assertEquals(combinedFactor * 1 * GB / 25, configFromMemorySetting(1 + reservedMemoryGb, ApplicationContainerCluster.heapSizePercentageOfTotalNodeMemoryWhenCombinedCluster * 0.01).summary().cache().maxbytes(), 1000);
+ assertEquals(combinedFactor * 256 * GB / 25, configFromMemorySetting(256 + reservedMemoryGb, ApplicationContainerCluster.heapSizePercentageOfTotalNodeMemoryWhenCombinedCluster * 0.01).summary().cache().maxbytes(), 1000);
}
@Test
- public void require_that_docker_node_is_tagged_with_shared_disk() {
+ void require_that_docker_node_is_tagged_with_shared_disk() {
assertSharedDisk(true, true);
}
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 a3c57dae2de..8830e5484b3 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
@@ -17,7 +17,7 @@ import com.yahoo.vespa.model.VespaModel;
import com.yahoo.vespa.model.content.ContentSearchCluster;
import com.yahoo.vespa.model.content.utils.DocType;
import com.yahoo.vespa.model.search.IndexedSearchCluster;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.Collections;
@@ -25,7 +25,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author geirst
@@ -35,31 +35,31 @@ public class DocumentDatabaseTestCase {
private static final double SMALL = 0.00000000000001;
@Test
- public void requireThatWeCanHaveOneSDForIndexedMode() {
+ void requireThatWeCanHaveOneSDForIndexedMode() {
new SchemaTester().assertSingleSD("index");
}
@Test
- public void requireThatConcurrencyIsReflectedCorrectlyForDefault() {
+ void requireThatConcurrencyIsReflectedCorrectlyForDefault() {
verifyConcurrency("index", "", 0.50);
verifyConcurrency("streaming", "", 1.0);
verifyConcurrency("store-only", "", 1.0);
}
@Test
- public void requireThatFeatureFlagConcurrencyIsReflectedCorrectlyForDefault() {
+ void requireThatFeatureFlagConcurrencyIsReflectedCorrectlyForDefault() {
verifyConcurrency("index", "", 0.30, 0.3);
verifyConcurrency("streaming", "", 0.6, 0.3);
verifyConcurrency("store-only", "", 0.8, 0.4);
}
@Test
- public void requireThatMixedModeConcurrencyIsReflectedCorrectlyForDefault() {
+ void requireThatMixedModeConcurrencyIsReflectedCorrectlyForDefault() {
verifyConcurrency(Arrays.asList(DocType.create("a", "index"), DocType.create("b", "streaming")), "", 1.0);
}
@Test
- public void requireThatMixedModeConcurrencyIsReflected() {
+ void requireThatMixedModeConcurrencyIsReflected() {
String feedTuning = "<feeding>" +
" <concurrency>0.7</concurrency>" +
"</feeding>\n";
@@ -67,10 +67,10 @@ public class DocumentDatabaseTestCase {
}
@Test
- public void requireThatConcurrencyIsReflected() {
+ void requireThatConcurrencyIsReflected() {
String feedTuning = "<feeding>" +
- " <concurrency>0.7</concurrency>" +
- "</feeding>\n";
+ " <concurrency>0.7</concurrency>" +
+ "</feeding>\n";
verifyConcurrency("index", feedTuning, 0.7);
verifyConcurrency("streaming", feedTuning, 0.7);
verifyConcurrency("store-only", feedTuning, 0.7);
@@ -113,17 +113,17 @@ public class DocumentDatabaseTestCase {
}
@Test
- public void requireFeedNicenessIsReflected() {
+ void requireFeedNicenessIsReflected() {
verifyFeedNiceness(Arrays.asList(DocType.create("a", "index")), 0.0, null);
verifyFeedNiceness(Arrays.asList(DocType.create("a", "index")), 0.32, 0.32);
}
@Test
- public void requireThatModeIsSet() {
+ void requireThatModeIsSet() {
var tester = new SchemaTester();
VespaModel model = tester.createModel(Arrays.asList(DocType.create("a", "index"),
- DocType.create("b", "streaming"),
- DocType.create("c", "store-only")), "");
+ DocType.create("b", "streaming"),
+ DocType.create("c", "store-only")), "");
ContentSearchCluster contentSearchCluster = model.getContentClusters().get("test").getSearch();
ProtonConfig proton = tester.getProtonConfig(contentSearchCluster);
assertEquals(3, proton.documentdb().size());
@@ -148,13 +148,14 @@ public class DocumentDatabaseTestCase {
}
@Test
- public void requireThatMixedModeInitialDocumentCountIsReflectedCorrectlyForDefault() {
+ void requireThatMixedModeInitialDocumentCountIsReflectedCorrectlyForDefault() {
final long DEFAULT = 1024L;
verifyInitialDocumentCount(Arrays.asList(DocType.create("a", "index"), DocType.create("b", "streaming")),
"", Arrays.asList(DEFAULT, DEFAULT));
}
+
@Test
- public void requireThatMixedModeInitialDocumentCountIsReflected() {
+ void requireThatMixedModeInitialDocumentCountIsReflected() {
final long INITIAL = 1000000000L;
String feedTuning = "<resizing>" +
" <initialdocumentcount>1000000000</initialdocumentcount>" +
@@ -176,11 +177,11 @@ public class DocumentDatabaseTestCase {
}
@Test
- public void testMultipleSchemas() {
+ void testMultipleSchemas() {
List<String> sds = List.of("type1", "type2", "type3");
var tester = new SchemaTester();
var model = tester.createModel(sds);
- IndexedSearchCluster indexedSearchCluster = (IndexedSearchCluster)model.getSearchClusters().get(0);
+ IndexedSearchCluster indexedSearchCluster = (IndexedSearchCluster) model.getSearchClusters().get(0);
ContentSearchCluster contentSearchCluster = model.getContentClusters().get("test").getSearch();
String type1Id = "test/search/cluster.test/type1";
String type2Id = "test/search/cluster.test/type2";
@@ -226,26 +227,26 @@ public class DocumentDatabaseTestCase {
}
@Test
- public void testRankingConstants() {
+ void testRankingConstants() {
List<String> schemas = List.of("type1");
var tester = new SchemaTester();
// Use lz4 endings to avoid having to provide file content to be validated
String schemaConstants =
" constant constant_1 {" +
- " file: constants/my_constant_1.json.lz4" +
- " type: tensor<float>(x{},y{})" +
- " }" +
- " constant constant_2 {" +
- " file: constants/my_constant_2.json.lz4" +
- " type: tensor(x[1000])" +
- " }";
+ " file: constants/my_constant_1.json.lz4" +
+ " type: tensor<float>(x{},y{})" +
+ " }" +
+ " constant constant_2 {" +
+ " file: constants/my_constant_2.json.lz4" +
+ " type: tensor(x[1000])" +
+ " }";
Map<Path, String> constants = new HashMap<>();
constants.put(Path.fromString("constants/my_constant_1.json.lz4"), "");
constants.put(Path.fromString("constants/my_constant_2.json.lz4"), "");
var model = tester.createModel(schemaConstants, "", schemas, constants);
- IndexedSearchCluster indexedSearchCluster = (IndexedSearchCluster)model.getSearchClusters().get(0);
+ IndexedSearchCluster indexedSearchCluster = (IndexedSearchCluster) model.getSearchClusters().get(0);
RankingConstantsConfig.Builder b = new RankingConstantsConfig.Builder();
indexedSearchCluster.getDocumentDbs().get(0).getConfig(b);
RankingConstantsConfig config = b.build();
@@ -263,14 +264,14 @@ public class DocumentDatabaseTestCase {
}
@Test
- public void requireThatRelevantConfigIsAvailableForClusterSearcher() {
+ void requireThatRelevantConfigIsAvailableForClusterSearcher() {
String inputsProfile =
" rank-profile inputs {" +
- " inputs {" +
- " query(foo) tensor<float>(x[10])" +
- " query(bar) tensor(key{},x[1000])" +
- " }" +
- " }";
+ " inputs {" +
+ " query(foo) tensor<float>(x[10])" +
+ " query(bar) tensor(key{},x[1000])" +
+ " }" +
+ " }";
List<String> schemas = List.of("type1", "type2");
var tester = new SchemaTester();
VespaModel model = tester.createModelWithRankProfile(inputsProfile, schemas);
@@ -305,7 +306,7 @@ public class DocumentDatabaseTestCase {
}
@Test
- public void requireThatDocumentDBConfigIsAvailableForStreaming() {
+ void requireThatDocumentDBConfigIsAvailableForStreaming() {
assertDocumentDBConfigAvailableForStreaming("streaming");
}
@@ -343,7 +344,7 @@ public class DocumentDatabaseTestCase {
}
@Test
- public void testThatAttributesMaxUnCommittedMemoryIsControlledByFeatureFlag() {
+ void testThatAttributesMaxUnCommittedMemoryIsControlledByFeatureFlag() {
assertAttributesConfigIndependentOfMode("index", Arrays.asList("type1"),
Arrays.asList("test/search/cluster.test/type1"),
ImmutableMap.of("type1", Arrays.asList("f2", "f2_nfa")),
@@ -351,20 +352,21 @@ public class DocumentDatabaseTestCase {
}
@Test
- public void testThatAttributesConfigIsProducedForIndexed() {
+ void testThatAttributesConfigIsProducedForIndexed() {
assertAttributesConfigIndependentOfMode("index", Arrays.asList("type1"),
Arrays.asList("test/search/cluster.test/type1"),
ImmutableMap.of("type1", Arrays.asList("f2", "f2_nfa")));
}
@Test
- public void testThatAttributesConfigIsProducedForStreamingForFastAccessFields() {
+ void testThatAttributesConfigIsProducedForStreamingForFastAccessFields() {
assertAttributesConfigIndependentOfMode("streaming", Arrays.asList("type1"),
Arrays.asList("test/search/type1"),
ImmutableMap.of("type1", Arrays.asList("f2")));
}
+
@Test
- public void testThatAttributesConfigIsNotProducedForStoreOnlyEvenForFastAccessFields() {
+ void testThatAttributesConfigIsNotProducedForStoreOnlyEvenForFastAccessFields() {
assertAttributesConfigIndependentOfMode("store-only", Arrays.asList("type1"),
Arrays.asList("test/search"), Collections.emptyMap());
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentSelectionConverterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentSelectionConverterTest.java
index 9f14a78d8c5..5efe75bdca5 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentSelectionConverterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentSelectionConverterTest.java
@@ -3,10 +3,10 @@ package com.yahoo.vespa.model.search.test;
import com.yahoo.document.select.parser.ParseException;
import com.yahoo.vespa.model.search.DocumentSelectionConverter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
/**
* Unit tests for RemoveSelection.
@@ -14,19 +14,20 @@ import static org.junit.Assert.assertTrue;
*/
public class DocumentSelectionConverterTest {
@Test
- public void testQueryConversion() throws ParseException, IllegalArgumentException, UnsupportedOperationException {
+ void testQueryConversion() throws ParseException, IllegalArgumentException, UnsupportedOperationException {
DocumentSelectionConverter converter = new DocumentSelectionConverter("music.expire>now() - 3600 and video.expire > now() - 300");
assertEquals("expire:>now(3600)", converter.getQuery("music"));
assertEquals("expire:<now(3600)", converter.getInvertedQuery("music"));
assertEquals("expire:>now(300)", converter.getQuery("video"));
assertEquals("expire:<now(300)", converter.getInvertedQuery("video"));
- assertTrue(null == converter.getQuery("book"));
- assertTrue(null == converter.getInvertedQuery("book"));
+ assertNull(converter.getQuery("book"));
+ assertNull(converter.getInvertedQuery("book"));
}
+
@Test
- public void testSelection() throws ParseException, IllegalArgumentException, UnsupportedOperationException {
+ void testSelection() throws ParseException, IllegalArgumentException, UnsupportedOperationException {
DocumentSelectionConverter converter = new DocumentSelectionConverter("music.expire>music.expire.nowdate");
- assertTrue(converter.getQuery("music") == null);
- assertTrue(converter.getInvertedQuery("music") == null);
+ assertNull(converter.getQuery("music"));
+ assertNull(converter.getInvertedQuery("music"));
}
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaClusterTest.java
index 1d15f973d21..3e5a473c1ca 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaClusterTest.java
@@ -21,12 +21,9 @@ import com.yahoo.vespa.model.container.component.Component;
import com.yahoo.vespa.model.search.SearchCluster;
import com.yahoo.vespa.model.test.utils.ApplicationPackageUtils;
import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
/**
@@ -38,7 +35,7 @@ import static org.junit.Assert.assertTrue;
public class SchemaClusterTest {
@Test
- public void testSdConfigLogical() {
+ void testSdConfigLogical() {
// sd1
SDDocumentType sdt1 = new SDDocumentType("s1");
Schema schema1 = new Schema("s1", MockApplicationPackage.createEmpty());
@@ -51,7 +48,7 @@ public class SchemaClusterTest {
// sd2
SDDocumentType sdt2 = new SDDocumentType("s2");
Schema schema2 = new Schema("s2", MockApplicationPackage.createEmpty());
- SDField f2=new SDField(sdt2, "f2", DataType.STRING);
+ SDField f2 = new SDField(sdt2, "f2", DataType.STRING);
f2.addAttribute(new Attribute("f2", DataType.STRING));
f2.setIndexingScript(new ScriptExpression(new StatementExpression(new AttributeExpression("f2"))));
sdt2.addField(f2);
@@ -64,76 +61,76 @@ public class SchemaClusterTest {
}
@Test
- public void search_model_is_connected_to_container_clusters_two_content_clusters() {
+ void search_model_is_connected_to_container_clusters_two_content_clusters() {
String vespaHosts = "<?xml version='1.0' encoding='utf-8' ?>" +
- "<hosts>" +
- " <host name='node0host'>" +
- " <alias>node0</alias>" +
- " </host>" +
- " <host name='node1host'>" +
- " <alias>node1</alias>" +
- " </host>" +
- " <host name='node2host'>" +
- " <alias>node2</alias>" +
- " </host>" +
- "</hosts>";
+ "<hosts>" +
+ " <host name='node0host'>" +
+ " <alias>node0</alias>" +
+ " </host>" +
+ " <host name='node1host'>" +
+ " <alias>node1</alias>" +
+ " </host>" +
+ " <host name='node2host'>" +
+ " <alias>node2</alias>" +
+ " </host>" +
+ "</hosts>";
String services =
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>" +
- "<services version=\"1.0\">" +
- " <admin version='2.0'>" +
- " <adminserver hostalias='node0' />" +
- " </admin>\n" +
- " <container version='1.0' id='j1'>\n" +
- " <search>" +
- " <chain id='s1Chain'>" +
- " <searcher id='S1ClusterSearcher'/>" +
- " </chain>" +
- " <provider cluster='normal' id='normal' type='local'/>\n" +
- " </search>" +
- " <nodes>" +
- " <node hostalias=\"node0\" />" +
- " </nodes>" +
- " </container>" +
-
- " <container version='1.0' id='j2'>" +
- " <search>" +
- " <chain id='s2Chain'>" +
- " <searcher id='S2ClusterSearcher'/>" +
- " </chain>" +
- " <provider cluster='xbulk' id='xbulk' type='local'/>" +
- " </search>" +
- " <nodes>" +
- " <node hostalias=\"node2\" />" +
- " </nodes>" +
- " </container>" +
-
- " <content id='xbulk' version=\"1.0\">" +
- " <redundancy>2</redundancy>" +
- " <documents>" +
- " <document mode='index' type=\"music\" />" +
- " </documents>" +
- " <nodes>" +
- " <node hostalias=\"node0\" distribution-key=\"0\" />" +
- " </nodes>" +
- " </content>" +
- " <content id=\"normal\" version='1.0'>" +
- " <redundancy>2</redundancy>" +
- " <documents>" +
- " <document mode='index' type=\"music\" />" +
- " </documents>" +
- " <nodes>" +
- " <node hostalias=\"node2\" distribution-key=\"0\" />" +
- " </nodes>" +
- " </content>" +
- "</services>";
+ "<services version=\"1.0\">" +
+ " <admin version='2.0'>" +
+ " <adminserver hostalias='node0' />" +
+ " </admin>\n" +
+ " <container version='1.0' id='j1'>\n" +
+ " <search>" +
+ " <chain id='s1Chain'>" +
+ " <searcher id='S1ClusterSearcher'/>" +
+ " </chain>" +
+ " <provider cluster='normal' id='normal' type='local'/>\n" +
+ " </search>" +
+ " <nodes>" +
+ " <node hostalias=\"node0\" />" +
+ " </nodes>" +
+ " </container>" +
+
+ " <container version='1.0' id='j2'>" +
+ " <search>" +
+ " <chain id='s2Chain'>" +
+ " <searcher id='S2ClusterSearcher'/>" +
+ " </chain>" +
+ " <provider cluster='xbulk' id='xbulk' type='local'/>" +
+ " </search>" +
+ " <nodes>" +
+ " <node hostalias=\"node2\" />" +
+ " </nodes>" +
+ " </container>" +
+
+ " <content id='xbulk' version=\"1.0\">" +
+ " <redundancy>2</redundancy>" +
+ " <documents>" +
+ " <document mode='index' type=\"music\" />" +
+ " </documents>" +
+ " <nodes>" +
+ " <node hostalias=\"node0\" distribution-key=\"0\" />" +
+ " </nodes>" +
+ " </content>" +
+ " <content id=\"normal\" version='1.0'>" +
+ " <redundancy>2</redundancy>" +
+ " <documents>" +
+ " <document mode='index' type=\"music\" />" +
+ " </documents>" +
+ " <nodes>" +
+ " <node hostalias=\"node2\" distribution-key=\"0\" />" +
+ " </nodes>" +
+ " </content>" +
+ "</services>";
VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, services, ApplicationPackageUtils.generateSchemas("music")).create();
- ContainerCluster containerCluster1 = (ContainerCluster)model.getConfigProducer("j1").get();
+ ContainerCluster containerCluster1 = (ContainerCluster) model.getConfigProducer("j1").get();
assertFalse(containerCluster1.getSearch().getChains().localProviders().isEmpty());
- ContainerCluster containerCluster2 = (ContainerCluster)model.getConfigProducer("j2").get();
+ ContainerCluster containerCluster2 = (ContainerCluster) model.getConfigProducer("j2").get();
assertFalse(containerCluster2.getSearch().getChains().localProviders().isEmpty());
QrSearchersConfig.Builder builder = new QrSearchersConfig.Builder();
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaInfoTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaInfoTestCase.java
index b8a14bc763b..622fcfdf4fd 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaInfoTestCase.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaInfoTestCase.java
@@ -4,34 +4,34 @@ package com.yahoo.vespa.model.search.test;
import com.yahoo.search.config.SchemaInfoConfig;
import com.yahoo.vespa.config.search.RankProfilesConfig;
import com.yahoo.vespa.model.VespaModel;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.List;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
public class SchemaInfoTestCase {
/** Schema-info should contain all schemas, independent of clusters. */
@Test
- public void requireThatSchemaInfoIsAvailable() {
- List.of(1.0,2.0,3.0).toArray(new Double[3]);
+ void requireThatSchemaInfoIsAvailable() {
+ List.of(1.0, 2.0, 3.0).toArray(new Double[3]);
String inputs =
" rank-profile inputs {" +
- " inputs {" +
- " query(foo) tensor<float>(x[10])" +
- " query(bar) tensor(key{},x[1000])" +
- " query(myDouble1) double: 0.5" +
- " query(myDouble2) tensor()" +
- " query(myMap) tensor(key{}): { label1:1.0,\n \"label2\": 2.0, 'label3': 3.0 }" +
- " query(myVector1) tensor(x[3]):\n\n[1 ,2.0,3]" +
- " query(myVector2) tensor(x[3]):{{x:0}:1,{x: 1}: 2 , { x:2}:3.0 }" +
- " query(myMatrix) tensor(x[2],y[3]):[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]" +
- " query(myMixed1) tensor(key{},x[2]): { key1:[-1.0, 1.1], key2: [1,2]}" +
- " query(myMixed2) tensor(k1{},k2{},x[2]): { {k1:l1,k2:l1}:[-1.0, 1.1], {k1:l1,k2:l2}: [1,2]}" +
- " }" +
- " }";
+ " inputs {" +
+ " query(foo) tensor<float>(x[10])" +
+ " query(bar) tensor(key{},x[1000])" +
+ " query(myDouble1) double: 0.5" +
+ " query(myDouble2) tensor()" +
+ " query(myMap) tensor(key{}): { label1:1.0,\n \"label2\": 2.0, 'label3': 3.0 }" +
+ " query(myVector1) tensor(x[3]):\n\n[1 ,2.0,3]" +
+ " query(myVector2) tensor(x[3]):{{x:0}:1,{x: 1}: 2 , { x:2}:3.0 }" +
+ " query(myMatrix) tensor(x[2],y[3]):[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]" +
+ " query(myMixed1) tensor(key{},x[2]): { key1:[-1.0, 1.1], key2: [1,2]}" +
+ " query(myMixed2) tensor(k1{},k2{},x[2]): { {k1:l1,k2:l1}:[-1.0, 1.1], {k1:l1,k2:l2}: [1,2]}" +
+ " }" +
+ " }";
List<String> schemas = List.of("type1", "type2");
var tester = new SchemaTester();
var model = tester.createModelWithRankProfile(inputs, schemas);
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaTester.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaTester.java
index 9d1aece61d4..3deccbbb679 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaTester.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaTester.java
@@ -16,7 +16,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author bratseth
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchNodeTest.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchNodeTest.java
index f8a68e4b4a5..7ed27018d5f 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchNodeTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchNodeTest.java
@@ -13,13 +13,11 @@ import com.yahoo.vespa.model.HostResource;
import com.yahoo.vespa.model.search.NodeSpec;
import com.yahoo.vespa.model.search.SearchNode;
import com.yahoo.vespa.model.search.TransactionLogServer;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Optional;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Unit tests for search node.
@@ -59,14 +57,14 @@ public class SearchNodeTest {
}
@Test
- public void requireThatSyncIsHonoured() {
+ void requireThatSyncIsHonoured() {
assertTrue(getTlsConfig(new TestProperties(), null).usefsync());
assertTrue(getTlsConfig(new TestProperties(), true).usefsync());
assertFalse(getTlsConfig(new TestProperties(), false).usefsync());
}
@Test
- public void requireThatBasedirIsCorrectForElasticMode() {
+ void requireThatBasedirIsCorrectForElasticMode() {
MockRoot root = new MockRoot("");
SearchNode node = createSearchNode(root, "mynode", 3, new NodeSpec(7, 5), false, root.getDeployState().isHosted(), new TestProperties());
prepare(root, node, true);
@@ -74,7 +72,7 @@ public class SearchNodeTest {
}
@Test
- public void requireThatPreShutdownCommandIsEmptyWhenNotActivated() {
+ void requireThatPreShutdownCommandIsEmptyWhenNotActivated() {
MockRoot root = new MockRoot("");
SearchNode node = createSearchNode(root, "mynode", 3, new NodeSpec(7, 5), false, root.getDeployState().isHosted(), new TestProperties());
node.setHostResource(new HostResource(new Host(node, "mynbode")));
@@ -83,7 +81,7 @@ public class SearchNodeTest {
}
@Test
- public void requireThatPreShutdownCommandUsesPrepareRestartWhenActivated() {
+ void requireThatPreShutdownCommandUsesPrepareRestartWhenActivated() {
MockRoot root = new MockRoot("");
SearchNode node = createSearchNode(root, "mynode2", 4, new NodeSpec(7, 5), true, root.getDeployState().isHosted(), new TestProperties());
node.setHostResource(new HostResource(new Host(node, "mynbode2")));
@@ -101,7 +99,7 @@ public class SearchNodeTest {
}
@Test
- public void requireThatCodePageTypeCanBeControlled() {
+ void requireThatCodePageTypeCanBeControlled() {
verifyCodePlacement(true);
verifyCodePlacement(false);
}
@@ -115,7 +113,7 @@ public class SearchNodeTest {
}
@Test
- public void requireThatSharedRepoReclaimCanBeControlled() {
+ void requireThatSharedRepoReclaimCanBeControlled() {
verifySharedStringRepoReclaim(true);
verifySharedStringRepoReclaim(false);
}