aboutsummaryrefslogtreecommitdiffstats
path: root/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core
diff options
context:
space:
mode:
Diffstat (limited to 'clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core')
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/AggregatedStatsMergePendingCheckerTest.java20
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterFeedBlockTest.java36
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateBundleTest.java51
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateGeneratorTest.java134
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateViewTest.java28
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregatorTest.java20
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsChangeTrackerTest.java18
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ContentClusterHtmlRendererTest.java8
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ContentNodeStatsTest.java20
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseHandlerTest.java22
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseTest.java21
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DistributionBitCountTest.java17
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/EventDiffCalculatorTest.java58
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/EventLogTest.java19
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/FleetControllerContextImplTest.java6
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/FleetControllerTest.java39
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAutoTakedownLiveConfigTest.java10
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAutoTakedownTest.java57
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAvailabilityCalculatorTest.java30
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/LeafGroupsTest.java10
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MaintenanceWhenPendingGlobalMergesTest.java16
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MasterElectionTest.java89
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MetricReporterTest.java14
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NoZooKeeperTest.java7
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeInfoTest.java24
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeSlobrokConfigurationMembershipTest.java10
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeStateChangeCheckerTest.java71
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ResourceExhaustionCalculatorTest.java73
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ResourceUsageStatsTest.java15
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/RpcServerTest.java144
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/RpcVersionAutoDowngradeTest.java6
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/SlobrokTest.java44
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeHandlerTest.java18
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java311
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateGatherTest.java6
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateVersionTrackerTest.java60
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/SystemStateBroadcasterTest.java42
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/UpEdgeMaintenanceTransitionConstraintTest.java16
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/WantedStateTest.java9
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ZooKeeperDatabaseTest.java44
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/HostInfoTest.java21
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java6
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/ClusterListTest.java91
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/ClusterTest.java102
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/NodeTest.java160
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/NotMasterTest.java72
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/PartitionTest.java48
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/RequestTest.java11
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/ServiceTest.java192
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/SetNodeStateTest.java143
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/SetNodeStateRequestTest.java20
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/rpc/RPCCommunicatorTest.java20
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/rpc/SlimeClusterStateBundleCodecTest.java18
53 files changed, 1262 insertions, 1285 deletions
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/AggregatedStatsMergePendingCheckerTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/AggregatedStatsMergePendingCheckerTest.java
index dece8019e2c..b12f37e092d 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/AggregatedStatsMergePendingCheckerTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/AggregatedStatsMergePendingCheckerTest.java
@@ -1,10 +1,10 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.core;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -52,43 +52,43 @@ public class AggregatedStatsMergePendingCheckerTest {
}
@Test
- public void unknown_content_node_may_have_merges_pending() {
+ void unknown_content_node_may_have_merges_pending() {
Fixture f = Fixture.fromBucketsPending(1);
assertTrue(f.mayHaveMergesPending("default", 2));
}
@Test
- public void unknown_bucket_space_has_no_merges_pending() {
+ void unknown_bucket_space_has_no_merges_pending() {
Fixture f = Fixture.fromBucketsPending(1);
assertFalse(f.mayHaveMergesPending("global", 1));
}
@Test
- public void valid_bucket_space_stats_can_have_no_merges_pending() {
+ void valid_bucket_space_stats_can_have_no_merges_pending() {
Fixture f = Fixture.fromBucketsPending(0);
assertFalse(f.mayHaveMergesPending("default", 1));
}
@Test
- public void valid_bucket_space_stats_may_have_merges_pending() {
+ void valid_bucket_space_stats_may_have_merges_pending() {
Fixture f = Fixture.fromBucketsPending(1);
assertTrue(f.mayHaveMergesPending("default", 1));
}
@Test
- public void invalid_bucket_space_stats_may_have_merges_pending() {
+ void invalid_bucket_space_stats_may_have_merges_pending() {
Fixture f = Fixture.fromInvalidBucketStats();
assertTrue(f.mayHaveMergesPending("default", 1));
}
@Test
- public void cluster_without_updates_from_all_distributors_may_have_merges_pending() {
+ void cluster_without_updates_from_all_distributors_may_have_merges_pending() {
Fixture f = Fixture.fromIncompleteStats();
assertTrue(f.mayHaveMergesPending("default", 1));
}
@Test
- public void min_merge_completion_ratio_is_used_when_calculating_may_have_merges_pending() {
+ void min_merge_completion_ratio_is_used_when_calculating_may_have_merges_pending() {
// Completion ratio is (5-3)/5 = 0.4
assertTrue(Fixture.fromBucketsPending(3, 0.6).mayHaveMergesPending("default", 1));
// Completion ratio is (5-2)/5 = 0.6
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterFeedBlockTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterFeedBlockTest.java
index f0b91102e8f..ec6255fd13b 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterFeedBlockTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterFeedBlockTest.java
@@ -10,8 +10,8 @@ import com.yahoo.vdslib.state.State;
import com.yahoo.vespa.clustercontroller.core.database.DatabaseHandler;
import com.yahoo.vespa.clustercontroller.core.database.ZooKeeperDatabaseFactory;
import com.yahoo.vespa.clustercontroller.utils.util.NoMetricReporter;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.HashSet;
@@ -22,10 +22,10 @@ import java.util.Set;
import static com.yahoo.vespa.clustercontroller.core.FeedBlockUtil.mapOf;
import static com.yahoo.vespa.clustercontroller.core.FeedBlockUtil.setOf;
import static com.yahoo.vespa.clustercontroller.core.FeedBlockUtil.usage;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static com.yahoo.vespa.clustercontroller.core.FeedBlockUtil.createResourceUsageJson;
-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.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class ClusterFeedBlockTest extends FleetControllerTest {
@@ -36,7 +36,7 @@ public class ClusterFeedBlockTest extends FleetControllerTest {
private FleetController ctrl;
private DummyCommunicator communicator;
- @Before
+ @BeforeEach
public void setUp() {
supervisor = new Supervisor(new Transport());
}
@@ -107,7 +107,7 @@ public class ClusterFeedBlockTest extends FleetControllerTest {
}
@Test
- public void cluster_feed_can_be_blocked_and_unblocked_by_single_node() throws Exception {
+ void cluster_feed_can_be_blocked_and_unblocked_by_single_node() throws Exception {
initialize(createOptions(mapOf(usage("cheese", 0.7), usage("wine", 0.4))));
assertFalse(ctrl.getClusterStateBundle().clusterFeedIsBlocked());
@@ -127,7 +127,7 @@ public class ClusterFeedBlockTest extends FleetControllerTest {
}
@Test
- public void cluster_feed_block_state_is_recomputed_when_options_are_updated() throws Exception {
+ void cluster_feed_block_state_is_recomputed_when_options_are_updated() throws Exception {
initialize(createOptions(mapOf(usage("cheese", 0.7), usage("wine", 0.4))));
assertFalse(ctrl.getClusterStateBundle().clusterFeedIsBlocked());
@@ -142,7 +142,7 @@ public class ClusterFeedBlockTest extends FleetControllerTest {
}
@Test
- public void cluster_feed_block_state_is_recomputed_when_resource_block_set_differs() throws Exception {
+ void cluster_feed_block_state_is_recomputed_when_resource_block_set_differs() throws Exception {
initialize(createOptions(mapOf(usage("cheese", 0.7), usage("wine", 0.4))));
assertFalse(ctrl.getClusterStateBundle().clusterFeedIsBlocked());
@@ -155,12 +155,12 @@ public class ClusterFeedBlockTest extends FleetControllerTest {
bundle = ctrl.getClusterStateBundle();
assertTrue(bundle.clusterFeedIsBlocked());
assertEquals("cheese on node 1 [unknown hostname] (0.800 > 0.700), " +
- "wine on node 1 [unknown hostname] (0.500 > 0.400)",
- bundle.getFeedBlock().get().getDescription());
+ "wine on node 1 [unknown hostname] (0.500 > 0.400)",
+ bundle.getFeedBlock().get().getDescription());
}
@Test
- public void cluster_feed_block_state_is_not_recomputed_when_only_resource_usage_levels_differ() throws Exception {
+ void cluster_feed_block_state_is_not_recomputed_when_only_resource_usage_levels_differ() throws Exception {
initialize(createOptions(mapOf(usage("cheese", 0.7), usage("wine", 0.4))));
assertFalse(ctrl.getClusterStateBundle().clusterFeedIsBlocked());
@@ -177,7 +177,7 @@ public class ClusterFeedBlockTest extends FleetControllerTest {
}
@Test
- public void cluster_feed_block_state_is_recomputed_when_usage_enters_hysteresis_range() throws Exception {
+ void cluster_feed_block_state_is_recomputed_when_usage_enters_hysteresis_range() throws Exception {
initialize(createOptions(mapOf(usage("cheese", 0.7), usage("wine", 0.4)), 0.1));
assertFalse(ctrl.getClusterStateBundle().clusterFeedIsBlocked());
@@ -193,22 +193,22 @@ public class ClusterFeedBlockTest extends FleetControllerTest {
// is not discovered here. Still correct in terms of what resources are blocked or not, but
// the description is not up to date here.
assertEquals("cheese on node 1 [unknown hostname] (0.750 > 0.700)",
- bundle.getFeedBlock().get().getDescription());
+ bundle.getFeedBlock().get().getDescription());
// Trigger an explicit recompute by adding a separate resource exhaustion
reportResourceUsageFromNode(1, setOf(usage("cheese", 0.67), usage("wine", 0.5)));
bundle = ctrl.getClusterStateBundle();
assertTrue(bundle.clusterFeedIsBlocked());
assertEquals("cheese on node 1 [unknown hostname] (0.670 > 0.600), " +
- "wine on node 1 [unknown hostname] (0.500 > 0.400)", // Not under hysteresis
- bundle.getFeedBlock().get().getDescription());
+ "wine on node 1 [unknown hostname] (0.500 > 0.400)", // Not under hysteresis
+ bundle.getFeedBlock().get().getDescription());
// Wine usage drops beyond hysteresis range, should be unblocked immediately.
reportResourceUsageFromNode(1, setOf(usage("cheese", 0.61), usage("wine", 0.2)));
bundle = ctrl.getClusterStateBundle();
assertTrue(bundle.clusterFeedIsBlocked());
assertEquals("cheese on node 1 [unknown hostname] (0.610 > 0.600)",
- bundle.getFeedBlock().get().getDescription());
+ bundle.getFeedBlock().get().getDescription());
// Cheese now drops below hysteresis range, should be unblocked as well.
reportResourceUsageFromNode(1, setOf(usage("cheese", 0.59), usage("wine", 0.2)));
@@ -217,7 +217,7 @@ public class ClusterFeedBlockTest extends FleetControllerTest {
}
@Test
- public void unavailable_nodes_are_not_considered_when_computing_feed_blocked_state() throws Exception {
+ void unavailable_nodes_are_not_considered_when_computing_feed_blocked_state() throws Exception {
initialize(createOptions(mapOf(usage("cheese", 0.7), usage("wine", 0.4)), 0.1));
assertFalse(ctrl.getClusterStateBundle().clusterFeedIsBlocked());
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateBundleTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateBundleTest.java
index d12541687f0..17c461a487b 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateBundleTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateBundleTest.java
@@ -6,7 +6,7 @@ import com.yahoo.vdslib.state.Node;
import com.yahoo.vdslib.state.NodeState;
import com.yahoo.vdslib.state.NodeType;
import com.yahoo.vdslib.state.State;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Set;
import java.util.function.Function;
@@ -15,9 +15,7 @@ import static com.yahoo.vespa.clustercontroller.core.FeedBlockUtil.exhaustion;
import static com.yahoo.vespa.clustercontroller.core.FeedBlockUtil.setOf;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
-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.*;
public class ClusterStateBundleTest {
@@ -67,7 +65,7 @@ public class ClusterStateBundleTest {
}
@Test
- public void builder_creates_baseline_state_and_derived_state_per_space() {
+ void builder_creates_baseline_state_and_derived_state_per_space() {
ClusterStateBundle bundle = createTestBundle();
assertThat(bundle.getBaselineClusterState(), equalTo(stateOf("distributor:2 storage:2")));
assertThat(bundle.getDerivedBucketSpaceStates().size(), equalTo(3));
@@ -77,7 +75,7 @@ public class ClusterStateBundleTest {
}
@Test
- public void version_clone_sets_version_for_all_spaces() {
+ void version_clone_sets_version_for_all_spaces() {
ClusterStateBundle bundle = createTestBundle().clonedWithVersionSet(123);
assertThat(bundle.getBaselineClusterState(), equalTo(stateOf("version:123 distributor:2 storage:2")));
assertThat(bundle.getDerivedBucketSpaceStates().size(), equalTo(3));
@@ -87,13 +85,13 @@ public class ClusterStateBundleTest {
}
@Test
- public void same_bundle_instance_considered_similar() {
+ void same_bundle_instance_considered_similar() {
ClusterStateBundle bundle = createTestBundle();
assertTrue(bundle.similarTo(bundle));
}
@Test
- public void similarity_test_considers_all_bucket_spaces() {
+ void similarity_test_considers_all_bucket_spaces() {
ClusterStateBundle bundle = createTestBundle(false);
ClusterStateBundle unchangedBundle = createTestBundle(false);
@@ -106,7 +104,7 @@ public class ClusterStateBundleTest {
}
@Test
- public void similarity_test_considers_cluster_feed_block_state() {
+ void similarity_test_considers_cluster_feed_block_state() {
var nonBlockingBundle = createTestBundle(false);
var blockingBundle = createTestBundleWithFeedBlock("foo");
var blockingBundleWithOtherDesc = createTestBundleWithFeedBlock("bar");
@@ -119,7 +117,7 @@ public class ClusterStateBundleTest {
}
@Test
- public void similarity_test_considers_cluster_feed_block_concrete_exhaustion_set() {
+ void similarity_test_considers_cluster_feed_block_concrete_exhaustion_set() {
var blockingBundleNoSet = createTestBundleWithFeedBlock("foo");
var blockingBundleWithSet = createTestBundleWithFeedBlock("bar", setOf(exhaustion(1, "beer"), exhaustion(1, "wine")));
var blockingBundleWithOtherSet = createTestBundleWithFeedBlock("bar", setOf(exhaustion(1, "beer"), exhaustion(1, "soda")));
@@ -132,7 +130,7 @@ public class ClusterStateBundleTest {
}
@Test
- public void feed_block_state_is_available() {
+ void feed_block_state_is_available() {
var nonBlockingBundle = createTestBundle(false);
var blockingBundle = createTestBundleWithFeedBlock("foo");
@@ -147,14 +145,14 @@ public class ClusterStateBundleTest {
}
@Test
- public void toString_without_bucket_space_states_prints_only_baseline_state() {
+ void toString_without_bucket_space_states_prints_only_baseline_state() {
ClusterStateBundle bundle = ClusterStateBundle.ofBaselineOnly(
annotatedStateOf("distributor:2 storage:2"));
assertThat(bundle.toString(), equalTo("ClusterStateBundle('distributor:2 storage:2')"));
}
@Test
- public void toString_includes_all_bucket_space_states() {
+ void toString_includes_all_bucket_space_states() {
ClusterStateBundle bundle = createTestBundle();
assertThat(bundle.toString(), equalTo("ClusterStateBundle('distributor:2 storage:2', " +
"default 'distributor:2 storage:2 .0.s:d', " +
@@ -163,7 +161,7 @@ public class ClusterStateBundleTest {
}
@Test
- public void toString_with_feed_blocked_includes_description() {
+ void toString_with_feed_blocked_includes_description() {
var blockingBundle = createTestBundleWithFeedBlock("bear sleeping on server rack");
assertThat(blockingBundle.toString(), equalTo("ClusterStateBundle('distributor:2 storage:2', " +
"default 'distributor:2 storage:2', " +
@@ -173,19 +171,19 @@ public class ClusterStateBundleTest {
}
@Test
- public void toString_without_derived_states_specifies_deferred_activation_iff_set() {
+ void toString_without_derived_states_specifies_deferred_activation_iff_set() {
var bundle = ClusterStateBundle.ofBaselineOnly(annotatedStateOf("distributor:2 storage:2"), null, true);
assertThat(bundle.toString(), equalTo("ClusterStateBundle('distributor:2 storage:2' (deferred activation))"));
}
@Test
- public void toString_without_derived_states_does_not_specify_deferred_activation_iff_not_set() {
+ void toString_without_derived_states_does_not_specify_deferred_activation_iff_not_set() {
var bundle = ClusterStateBundle.ofBaselineOnly(annotatedStateOf("distributor:2 storage:2"), null, false);
assertThat(bundle.toString(), equalTo("ClusterStateBundle('distributor:2 storage:2')"));
}
@Test
- public void toString_with_derived_states_specifies_deferred_activation_iff_set() {
+ void toString_with_derived_states_specifies_deferred_activation_iff_set() {
var bundle = createTestBundleBuilder(true).deferredActivation(true).deriveAndBuild();
assertThat(bundle.toString(), equalTo("ClusterStateBundle('distributor:2 storage:2', " +
"default 'distributor:2 storage:2 .0.s:d', " +
@@ -194,7 +192,7 @@ public class ClusterStateBundleTest {
}
@Test
- public void toString_with_derived_states_does_not_specify_deferred_activation_iff_not_set() {
+ void toString_with_derived_states_does_not_specify_deferred_activation_iff_not_set() {
var bundle = createTestBundleBuilder(true).deferredActivation(false).deriveAndBuild();
assertThat(bundle.toString(), equalTo("ClusterStateBundle('distributor:2 storage:2', " +
"default 'distributor:2 storage:2 .0.s:d', " +
@@ -203,25 +201,25 @@ public class ClusterStateBundleTest {
}
@Test
- public void deferred_activation_is_disabled_by_default() {
+ void deferred_activation_is_disabled_by_default() {
ClusterStateBundle bundle = createTestBundle();
assertFalse(bundle.deferredActivation());
}
@Test
- public void can_build_bundle_with_deferred_activation_enabled() {
+ void can_build_bundle_with_deferred_activation_enabled() {
var bundle = createTestBundleBuilder(false).deferredActivation(true).deriveAndBuild();
assertTrue(bundle.deferredActivation());
}
@Test
- public void can_build_bundle_with_deferred_activation_disabled() {
+ void can_build_bundle_with_deferred_activation_disabled() {
var bundle = createTestBundleBuilder(false).deferredActivation(false).deriveAndBuild();
assertFalse(bundle.deferredActivation());
}
@Test
- public void simple_bundle_without_derived_states_propagates_deferred_activation_flag() {
+ void simple_bundle_without_derived_states_propagates_deferred_activation_flag() {
var bundle = ClusterStateBundle
.builder(annotatedStateOf("distributor:2 storage:2"))
.deferredActivation(true) // defaults to false
@@ -230,22 +228,23 @@ public class ClusterStateBundleTest {
}
@Test
- public void cloning_preserves_false_deferred_activation_flag() {
+ void cloning_preserves_false_deferred_activation_flag() {
var bundle = createTestBundleBuilder(true).deferredActivation(false).deriveAndBuild();
var derived = bundle.cloneWithMapper(Function.identity());
assertEquals(bundle, derived);
}
@Test
- public void cloning_preserves_true_deferred_activation_flag() {
+ void cloning_preserves_true_deferred_activation_flag() {
var bundle = createTestBundleBuilder(true).deferredActivation(true).deriveAndBuild();
var derived = bundle.cloneWithMapper(Function.identity());
assertEquals(bundle, derived);
}
@Test
- public void cloning_preserves_feed_block_state() {
- var bundle = createTestBundleWithFeedBlock("foo");;
+ void cloning_preserves_feed_block_state() {
+ var bundle = createTestBundleWithFeedBlock("foo");
+ ;
var derived = bundle.cloneWithMapper(Function.identity());
assertEquals(bundle, derived);
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateGeneratorTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateGeneratorTest.java
index f857bfcee89..78911c414a2 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateGeneratorTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateGeneratorTest.java
@@ -6,7 +6,7 @@ import com.yahoo.vdslib.state.Node;
import com.yahoo.vdslib.state.NodeState;
import com.yahoo.vdslib.state.NodeType;
import com.yahoo.vdslib.state.State;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Optional;
import java.util.Set;
@@ -30,7 +30,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void cluster_with_all_nodes_reported_down_has_state_down() {
+ void cluster_with_all_nodes_reported_down_has_state_down() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(6).markEntireClusterDown();
final AnnotatedClusterState state = generateFromFixtureWithDefaultParams(fixture);
@@ -41,7 +41,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void cluster_with_all_nodes_up_state_correct_distributor_and_storage_count() {
+ void cluster_with_all_nodes_up_state_correct_distributor_and_storage_count() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(6).bringEntireClusterUp();
final AnnotatedClusterState state = generateFromFixtureWithDefaultParams(fixture);
@@ -49,7 +49,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void distributor_reported_states_reflected_in_generated_state() {
+ void distributor_reported_states_reflected_in_generated_state() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(9)
.bringEntireClusterUp()
.reportDistributorNodeState(2, State.DOWN)
@@ -61,7 +61,7 @@ public class ClusterStateGeneratorTest {
// NOTE: initializing state tested separately since it involves init progress state info
@Test
- public void storage_reported_states_reflected_in_generated_state() {
+ void storage_reported_states_reflected_in_generated_state() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(9)
.bringEntireClusterUp()
.reportStorageNodeState(0, State.DOWN)
@@ -72,7 +72,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void worse_distributor_wanted_state_overrides_reported_state() {
+ void worse_distributor_wanted_state_overrides_reported_state() {
// Maintenance mode is illegal for distributors and therefore not tested
final ClusterFixture fixture = ClusterFixture.forFlatCluster(7)
.bringEntireClusterUp()
@@ -85,7 +85,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void worse_storage_wanted_state_overrides_reported_state() {
+ void worse_storage_wanted_state_overrides_reported_state() {
// Does not test all maintenance mode overrides; see maintenance_mode_overrides_reported_state
// for that.
final ClusterFixture fixture = ClusterFixture.forFlatCluster(7)
@@ -100,7 +100,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void better_distributor_wanted_state_does_not_override_reported_state() {
+ void better_distributor_wanted_state_does_not_override_reported_state() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(7)
.bringEntireClusterUp()
.reportDistributorNodeState(0, State.DOWN)
@@ -111,7 +111,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void better_storage_wanted_state_does_not_override_reported_state() {
+ void better_storage_wanted_state_does_not_override_reported_state() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(7)
.bringEntireClusterUp()
.reportStorageNodeState(1, State.DOWN)
@@ -130,7 +130,7 @@ public class ClusterStateGeneratorTest {
* directly from Maintenance -> Up.
*/
@Test
- public void retired_node_in_init_state_is_set_to_maintenance() {
+ void retired_node_in_init_state_is_set_to_maintenance() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.bringEntireClusterUp()
.reportStorageNodeState(1, State.INITIALIZING)
@@ -152,7 +152,7 @@ public class ClusterStateGeneratorTest {
* value and triggering on a sufficiently low value.
*/
@Test
- public void storage_node_in_init_mode_while_listing_buckets_is_marked_down() {
+ void storage_node_in_init_mode_while_listing_buckets_is_marked_down() {
final NodeState initWhileListingBuckets = new NodeState(NodeType.STORAGE, State.INITIALIZING);
initWhileListingBuckets.setInitProgress(0.0f);
@@ -169,7 +169,7 @@ public class ClusterStateGeneratorTest {
* is set to Maintenance.
*/
@Test
- public void implicit_down_while_listing_buckets_does_not_override_wanted_state() {
+ void implicit_down_while_listing_buckets_does_not_override_wanted_state() {
final NodeState initWhileListingBuckets = new NodeState(NodeType.STORAGE, State.INITIALIZING);
initWhileListingBuckets.setInitProgress(0.0f);
@@ -183,7 +183,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void distributor_nodes_in_init_mode_are_not_mapped_to_down() {
+ void distributor_nodes_in_init_mode_are_not_mapped_to_down() {
final NodeState initWhileListingBuckets = new NodeState(NodeType.DISTRIBUTOR, State.INITIALIZING);
initWhileListingBuckets.setInitProgress(0.0f);
@@ -199,7 +199,7 @@ public class ClusterStateGeneratorTest {
* Maintenance mode overrides all reported states, even Down.
*/
@Test
- public void maintenance_mode_wanted_state_overrides_reported_state() {
+ void maintenance_mode_wanted_state_overrides_reported_state() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(7)
.bringEntireClusterUp()
.proposeStorageNodeWantedState(0, State.MAINTENANCE)
@@ -215,7 +215,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void wanted_state_description_carries_over_to_generated_state() {
+ void wanted_state_description_carries_over_to_generated_state() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(7)
.bringEntireClusterUp()
.proposeStorageNodeWantedState(1, State.MAINTENANCE, "foo")
@@ -230,7 +230,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void config_retired_mode_is_reflected_in_generated_state() {
+ void config_retired_mode_is_reflected_in_generated_state() {
ClusterFixture fixture = ClusterFixture.forFlatCluster(5)
.markNodeAsConfigRetired(2)
.bringEntireClusterUp();
@@ -241,7 +241,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void config_retired_mode_is_overridden_by_worse_wanted_state() {
+ void config_retired_mode_is_overridden_by_worse_wanted_state() {
ClusterFixture fixture = ClusterFixture.forFlatCluster(5)
.markNodeAsConfigRetired(2)
.markNodeAsConfigRetired(3)
@@ -279,17 +279,17 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void reported_down_node_within_transition_time_has_maintenance_generated_state() {
+ void reported_down_node_within_transition_time_has_maintenance_generated_state() {
do_test_change_within_node_transition_time_window_generates_maintenance(State.DOWN);
}
@Test
- public void reported_stopping_node_within_transition_time_has_maintenance_generated_state() {
+ void reported_stopping_node_within_transition_time_has_maintenance_generated_state() {
do_test_change_within_node_transition_time_window_generates_maintenance(State.STOPPING);
}
@Test
- public void reported_node_down_after_transition_time_has_down_generated_state() {
+ void reported_node_down_after_transition_time_has_down_generated_state() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(5).bringEntireClusterUp();
final ClusterStateGenerator.Params params = fixture.generatorParams()
.currentTimeInMilllis(11_000)
@@ -306,7 +306,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void distributor_nodes_are_not_implicitly_transitioned_to_maintenance_mode() {
+ void distributor_nodes_are_not_implicitly_transitioned_to_maintenance_mode() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(5).bringEntireClusterUp();
final ClusterStateGenerator.Params params = fixture.generatorParams()
.currentTimeInMilllis(10_000)
@@ -323,7 +323,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void transient_maintenance_mode_does_not_override_wanted_down_state() {
+ void transient_maintenance_mode_does_not_override_wanted_down_state() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(5).bringEntireClusterUp();
final ClusterStateGenerator.Params params = fixture.generatorParams()
.currentTimeInMilllis(10_000)
@@ -340,7 +340,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void reported_down_retired_node_within_transition_time_transitions_to_maintenance() {
+ void reported_down_retired_node_within_transition_time_transitions_to_maintenance() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(5).bringEntireClusterUp();
final ClusterStateGenerator.Params params = fixture.generatorParams()
.currentTimeInMilllis(10_000)
@@ -356,7 +356,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void crash_count_exceeding_limit_marks_node_as_down() {
+ void crash_count_exceeding_limit_marks_node_as_down() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(5).bringEntireClusterUp();
final ClusterStateGenerator.Params params = fixture.generatorParams().maxPrematureCrashes(10);
@@ -368,7 +368,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void crash_count_not_exceeding_limit_does_not_mark_node_as_down() {
+ void crash_count_not_exceeding_limit_does_not_mark_node_as_down() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(5).bringEntireClusterUp();
final ClusterStateGenerator.Params params = fixture.generatorParams().maxPrematureCrashes(10);
@@ -380,7 +380,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void exceeded_crash_count_does_not_override_wanted_maintenance_state() {
+ void exceeded_crash_count_does_not_override_wanted_maintenance_state() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(5)
.bringEntireClusterUp()
.proposeStorageNodeWantedState(1, State.MAINTENANCE);
@@ -395,7 +395,7 @@ public class ClusterStateGeneratorTest {
// Stopping -> Down is expected and does not indicate an unstable node.
@Test
- public void transition_from_controlled_stop_to_down_does_not_add_to_crash_counter() {
+ void transition_from_controlled_stop_to_down_does_not_add_to_crash_counter() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(2)
.bringEntireClusterUp()
.reportStorageNodeState(1, State.STOPPING, "controlled shutdown") // urgh, string matching logic
@@ -405,7 +405,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void non_observed_storage_node_start_timestamp_is_included_in_state() {
+ void non_observed_storage_node_start_timestamp_is_included_in_state() {
final NodeState nodeState = new NodeState(NodeType.STORAGE, State.UP);
// A reported state timestamp that is not yet marked as observed in the NodeInfo
// for the same node is considered not observed by other nodes and must therefore
@@ -421,7 +421,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void non_observed_distributor_start_timestamp_is_included_in_state() {
+ void non_observed_distributor_start_timestamp_is_included_in_state() {
final NodeState nodeState = new NodeState(NodeType.DISTRIBUTOR, State.UP);
nodeState.setStartTimestamp(6000);
@@ -434,7 +434,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void fully_observed_storage_node_timestamp_not_included_in_state() {
+ void fully_observed_storage_node_timestamp_not_included_in_state() {
final NodeState nodeState = new NodeState(NodeType.STORAGE, State.UP);
nodeState.setStartTimestamp(5000);
@@ -450,7 +450,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void fully_observed_distributor_timestamp_not_included_in_state() {
+ void fully_observed_distributor_timestamp_not_included_in_state() {
final NodeState nodeState = new NodeState(NodeType.DISTRIBUTOR, State.UP);
nodeState.setStartTimestamp(6000);
@@ -466,7 +466,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void cluster_down_if_less_than_min_count_of_storage_nodes_available() {
+ void cluster_down_if_less_than_min_count_of_storage_nodes_available() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.bringEntireClusterUp()
.reportStorageNodeState(0, State.DOWN)
@@ -479,7 +479,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void cluster_not_down_if_more_than_min_count_of_storage_nodes_are_available() {
+ void cluster_not_down_if_more_than_min_count_of_storage_nodes_are_available() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.bringEntireClusterUp()
.reportStorageNodeState(0, State.DOWN);
@@ -491,7 +491,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void cluster_down_if_less_than_min_count_of_distributors_available() {
+ void cluster_down_if_less_than_min_count_of_distributors_available() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.bringEntireClusterUp()
.reportDistributorNodeState(0, State.DOWN)
@@ -504,7 +504,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void cluster_not_down_if_more_than_min_count_of_distributors_are_available() {
+ void cluster_not_down_if_more_than_min_count_of_distributors_are_available() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.bringEntireClusterUp()
.reportDistributorNodeState(0, State.DOWN);
@@ -516,7 +516,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void maintenance_mode_counted_as_down_for_cluster_availability() {
+ void maintenance_mode_counted_as_down_for_cluster_availability() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.bringEntireClusterUp()
.reportStorageNodeState(0, State.DOWN)
@@ -528,7 +528,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void init_and_retired_counted_as_up_for_cluster_availability() {
+ void init_and_retired_counted_as_up_for_cluster_availability() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.bringEntireClusterUp()
.reportStorageNodeState(0, State.INITIALIZING)
@@ -541,7 +541,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void cluster_down_if_less_than_min_ratio_of_storage_nodes_available() {
+ void cluster_down_if_less_than_min_ratio_of_storage_nodes_available() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.bringEntireClusterUp()
.reportStorageNodeState(0, State.DOWN)
@@ -555,7 +555,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void cluster_not_down_if_more_than_min_ratio_of_storage_nodes_available() {
+ void cluster_not_down_if_more_than_min_ratio_of_storage_nodes_available() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.bringEntireClusterUp()
.reportStorageNodeState(0, State.DOWN);
@@ -568,7 +568,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void cluster_down_if_less_than_min_ratio_of_distributors_available() {
+ void cluster_down_if_less_than_min_ratio_of_distributors_available() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.bringEntireClusterUp()
.reportDistributorNodeState(0, State.DOWN)
@@ -582,7 +582,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void cluster_not_down_if_more_than_min_ratio_of_distributors_available() {
+ void cluster_not_down_if_more_than_min_ratio_of_distributors_available() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.bringEntireClusterUp()
.reportDistributorNodeState(0, State.DOWN);
@@ -594,7 +594,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void group_nodes_are_marked_down_if_group_availability_too_low() {
+ void group_nodes_are_marked_down_if_group_availability_too_low() {
final ClusterFixture fixture = ClusterFixture
.forHierarchicCluster(DistributionBuilder.withGroups(3).eachWithNodeCount(3))
.bringEntireClusterUp()
@@ -608,7 +608,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void group_nodes_are_not_marked_down_if_group_availability_sufficiently_high() {
+ void group_nodes_are_not_marked_down_if_group_availability_sufficiently_high() {
final ClusterFixture fixture = ClusterFixture
.forHierarchicCluster(DistributionBuilder.withGroups(3).eachWithNodeCount(3))
.bringEntireClusterUp()
@@ -620,7 +620,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void implicitly_downed_group_nodes_receive_a_state_description() {
+ void implicitly_downed_group_nodes_receive_a_state_description() {
final ClusterFixture fixture = ClusterFixture
.forHierarchicCluster(DistributionBuilder.withGroups(2).eachWithNodeCount(2))
.bringEntireClusterUp()
@@ -634,7 +634,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void implicitly_downed_group_nodes_are_annotated_with_group_reason() {
+ void implicitly_downed_group_nodes_are_annotated_with_group_reason() {
final ClusterFixture fixture = ClusterFixture
.forHierarchicCluster(DistributionBuilder.withGroups(2).eachWithNodeCount(2))
.bringEntireClusterUp()
@@ -647,7 +647,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void maintenance_nodes_in_downed_group_are_not_affected() {
+ void maintenance_nodes_in_downed_group_are_not_affected() {
final ClusterFixture fixture = ClusterFixture
.forHierarchicCluster(DistributionBuilder.withGroups(3).eachWithNodeCount(3))
.bringEntireClusterUp()
@@ -664,7 +664,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void group_nodes_are_marked_maintenance_if_group_availability_too_low_by_orchestrator() {
+ void group_nodes_are_marked_maintenance_if_group_availability_too_low_by_orchestrator() {
final ClusterFixture fixture = ClusterFixture
.forHierarchicCluster(DistributionBuilder.withGroups(3).eachWithNodeCount(3))
.bringEntireClusterUp()
@@ -679,7 +679,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void group_nodes_are_not_marked_maintenance_if_group_availability_high_by_orchestrator() {
+ void group_nodes_are_not_marked_maintenance_if_group_availability_high_by_orchestrator() {
final ClusterFixture fixture = ClusterFixture
.forHierarchicCluster(DistributionBuilder.withGroups(3).eachWithNodeCount(3))
.bringEntireClusterUp()
@@ -698,7 +698,7 @@ public class ClusterStateGeneratorTest {
* and any buckets caught over this level would not be accessible in the data space.
*/
@Test
- public void distribution_bits_bounded_by_reported_min_bits_from_storage_node() {
+ void distribution_bits_bounded_by_reported_min_bits_from_storage_node() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.bringEntireClusterUp()
.reportStorageNodeState(1, new NodeState(NodeType.STORAGE, State.UP).setMinUsedBits(7));
@@ -708,7 +708,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void distribution_bits_bounded_by_lowest_reporting_storage_node() {
+ void distribution_bits_bounded_by_lowest_reporting_storage_node() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.bringEntireClusterUp()
.reportStorageNodeState(0, new NodeState(NodeType.STORAGE, State.UP).setMinUsedBits(6))
@@ -719,7 +719,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void distribution_bits_bounded_by_config_parameter() {
+ void distribution_bits_bounded_by_config_parameter() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3).bringEntireClusterUp();
final ClusterStateGenerator.Params params = fixture.generatorParams().idealDistributionBits(12);
@@ -731,7 +731,7 @@ public class ClusterStateGeneratorTest {
// TODO We generally want to avoid distribution bit decreases if at all possible, since "collapsing"
// the top-level bucket space can cause data loss on timestamp collisions across super buckets.
@Test
- public void distribution_bit_not_influenced_by_nodes_down_or_in_maintenance() {
+ void distribution_bit_not_influenced_by_nodes_down_or_in_maintenance() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.bringEntireClusterUp()
.reportStorageNodeState(0, new NodeState(NodeType.STORAGE, State.UP).setMinUsedBits(7))
@@ -760,20 +760,20 @@ public class ClusterStateGeneratorTest {
* let e.g. a transition from 10 bits to 20 bits cause 10 interim full re-distributions.
*/
@Test
- public void published_distribution_bit_bound_by_low_watermark_when_nodes_report_less_than_config_bits() {
+ void published_distribution_bit_bound_by_low_watermark_when_nodes_report_less_than_config_bits() {
assertThat(do_test_distribution_bit_watermark(5, 5),
- equalTo("bits:5 distributor:3 storage:3"));
+ equalTo("bits:5 distributor:3 storage:3"));
assertThat(do_test_distribution_bit_watermark(5, 6),
- equalTo("bits:5 distributor:3 storage:3"));
+ equalTo("bits:5 distributor:3 storage:3"));
assertThat(do_test_distribution_bit_watermark(5, 15),
- equalTo("bits:5 distributor:3 storage:3"));
+ equalTo("bits:5 distributor:3 storage:3"));
}
@Test
- public void published_state_jumps_to_configured_ideal_bits_when_all_nodes_report_it() {
+ void published_state_jumps_to_configured_ideal_bits_when_all_nodes_report_it() {
// Note: the rest of the mocked nodes always report 16 bits by default
assertThat(do_test_distribution_bit_watermark(5, 16),
- equalTo("distributor:3 storage:3")); // "bits:16" implied
+ equalTo("distributor:3 storage:3")); // "bits:16" implied
}
private String do_test_storage_node_with_no_init_progress(State wantedState) {
@@ -793,9 +793,9 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void storage_node_with_no_init_progress_within_timeout_is_marked_down() {
+ void storage_node_with_no_init_progress_within_timeout_is_marked_down() {
assertThat(do_test_storage_node_with_no_init_progress(State.UP),
- equalTo("distributor:3 storage:3 .0.s:d"));
+ equalTo("distributor:3 storage:3 .0.s:d"));
}
/**
@@ -803,9 +803,9 @@ public class ClusterStateGeneratorTest {
* as the wanted state.
*/
@Test
- public void maintenance_wanted_state_overrides_storage_node_with_no_init_progress() {
+ void maintenance_wanted_state_overrides_storage_node_with_no_init_progress() {
assertThat(do_test_storage_node_with_no_init_progress(State.MAINTENANCE),
- equalTo("distributor:3 storage:3 .0.s:m"));
+ equalTo("distributor:3 storage:3 .0.s:m"));
}
/**
@@ -816,7 +816,7 @@ public class ClusterStateGeneratorTest {
* their init stage and would otherwise pop in and out of the cluster state.
*/
@Test
- public void unstable_init_storage_node_has_init_state_substituted_by_down() {
+ void unstable_init_storage_node_has_init_state_substituted_by_down() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(5)
.bringEntireClusterUp()
.reportStorageNodeState(0, State.INITIALIZING)
@@ -828,7 +828,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void storage_node_with_crashes_but_not_unstable_init_does_not_have_init_state_substituted_by_down() {
+ void storage_node_with_crashes_but_not_unstable_init_does_not_have_init_state_substituted_by_down() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(5)
.bringEntireClusterUp()
.reportStorageNodeState(0, new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.5f));
@@ -846,7 +846,7 @@ public class ClusterStateGeneratorTest {
* potentially contributing additional instability to the cluster.
*/
@Test
- public void unstable_retired_node_should_be_marked_down() {
+ void unstable_retired_node_should_be_marked_down() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(5)
.bringEntireClusterUp()
.proposeStorageNodeWantedState(3, State.RETIRED);
@@ -860,7 +860,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void generator_params_can_inherit_values_from_controller_options() {
+ void generator_params_can_inherit_values_from_controller_options() {
FleetControllerOptions options = new FleetControllerOptions("foocluster", Set.of(new ConfiguredNode(0, false)));
options.maxPrematureCrashes = 1;
options.minStorageNodesUp = 2;
@@ -881,7 +881,7 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void configured_zero_init_progress_time_disables_auto_init_to_down_feature() {
+ void configured_zero_init_progress_time_disables_auto_init_to_down_feature() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.bringEntireClusterUp()
.reportStorageNodeState(0, new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.5f));
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateViewTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateViewTest.java
index 1125c431cae..473007f6a7c 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateViewTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateViewTest.java
@@ -4,11 +4,11 @@ package com.yahoo.vespa.clustercontroller.core;
import com.yahoo.vdslib.state.*;
import com.yahoo.vespa.clustercontroller.core.hostinfo.HostInfo;
import com.yahoo.vespa.clustercontroller.core.hostinfo.StorageNodeStatsBridge;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Set;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.*;
/**
@@ -25,7 +25,7 @@ public class ClusterStateViewTest {
}
@Test
- public void testWrongNodeType() {
+ void testWrongNodeType() {
when(nodeInfo.isDistributor()).thenReturn(false);
clusterStateView.handleUpdatedHostInfo(nodeInfo, createHostInfo("101"));
@@ -34,7 +34,7 @@ public class ClusterStateViewTest {
}
@Test
- public void testStateVersionMismatch() {
+ void testStateVersionMismatch() {
when(nodeInfo.isDistributor()).thenReturn(true);
when(clusterState.getVersion()).thenReturn(101);
@@ -44,7 +44,7 @@ public class ClusterStateViewTest {
}
@Test
- public void testFailToGetStats() {
+ void testFailToGetStats() {
when(nodeInfo.isDistributor()).thenReturn(true);
when(clusterState.getVersion()).thenReturn(101);
@@ -54,17 +54,17 @@ public class ClusterStateViewTest {
}
@Test
- public void testSuccessCase() {
+ void testSuccessCase() {
when(nodeInfo.isDistributor()).thenReturn(true);
HostInfo hostInfo = HostInfo.createHostInfo(
"{" +
- " \"cluster-state-version\": 101," +
- " \"distributor\": {\n" +
- " \"storage-nodes\": [\n" +
- " {\n" +
- " \"node-index\": 3\n" +
- " }\n" +
- " ]}}");
+ " \"cluster-state-version\": 101," +
+ " \"distributor\": {\n" +
+ " \"storage-nodes\": [\n" +
+ " {\n" +
+ " \"node-index\": 3\n" +
+ " }\n" +
+ " ]}}");
when(nodeInfo.getNodeIndex()).thenReturn(3);
@@ -76,7 +76,7 @@ public class ClusterStateViewTest {
}
@Test
- public void testIndicesOfUpNodes() {
+ void testIndicesOfUpNodes() {
when(clusterState.getNodeCount(NodeType.DISTRIBUTOR)).thenReturn(7);
NodeState nodeState = mock(NodeState.class);
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregatorTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregatorTest.java
index 11c00414cb8..2b62915439f 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregatorTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregatorTest.java
@@ -2,13 +2,11 @@
package com.yahoo.vespa.clustercontroller.core;
import com.google.common.collect.Sets;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Set;
-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.*;
/**
* @author hakonhall
@@ -67,7 +65,7 @@ public class ClusterStatsAggregatorTest {
}
@Test
- public void aggregator_handles_updates_to_single_distributor_and_content_node() {
+ void aggregator_handles_updates_to_single_distributor_and_content_node() {
Fixture f = new Fixture(distributorNodes(1), contentNodes(3));
ContentClusterStatsBuilder stats = new ContentClusterStatsBuilder()
.add(3, "default", 10, 1)
@@ -77,7 +75,7 @@ public class ClusterStatsAggregatorTest {
}
@Test
- public void aggregator_handles_updates_to_multiple_distributors_and_content_nodes() {
+ void aggregator_handles_updates_to_multiple_distributors_and_content_nodes() {
Fixture f = new FourNodesFixture();
f.verify(new ContentClusterStatsBuilder()
@@ -88,7 +86,7 @@ public class ClusterStatsAggregatorTest {
}
@Test
- public void aggregator_handles_multiple_updates_from_same_distributor() {
+ void aggregator_handles_multiple_updates_from_same_distributor() {
Fixture f = new Fixture(distributorNodes(1, 2), contentNodes(3));
f.update(1, new ContentClusterStatsBuilder().add(3, "default"));
@@ -111,7 +109,7 @@ public class ClusterStatsAggregatorTest {
}
@Test
- public void aggregator_handles_more_content_nodes_that_distributors() {
+ void aggregator_handles_more_content_nodes_that_distributors() {
Fixture f = new Fixture(distributorNodes(1), contentNodes(3, 4));
ContentClusterStatsBuilder stats = new ContentClusterStatsBuilder()
.add(3, "default", 10, 1)
@@ -121,7 +119,7 @@ public class ClusterStatsAggregatorTest {
}
@Test
- public void aggregator_ignores_updates_to_unknown_distributor() {
+ void aggregator_ignores_updates_to_unknown_distributor() {
Fixture f = new Fixture(distributorNodes(1), contentNodes(3));
final int downDistributorIndex = 2;
f.update(downDistributorIndex, new ContentClusterStatsBuilder()
@@ -130,7 +128,7 @@ public class ClusterStatsAggregatorTest {
}
@Test
- public void aggregator_tracks_when_it_has_updates_from_all_distributors() {
+ void aggregator_tracks_when_it_has_updates_from_all_distributors() {
Fixture f = new Fixture(distributorNodes(1, 2), contentNodes(3));
assertFalse(f.hasUpdatesFromAllDistributors());
f.update(1, new ContentClusterStatsBuilder().add(3, "default"));
@@ -142,7 +140,7 @@ public class ClusterStatsAggregatorTest {
}
@Test
- public void aggregator_can_provide_aggregated_stats_per_distributor() {
+ void aggregator_can_provide_aggregated_stats_per_distributor() {
Fixture f = new FourNodesFixture();
f.verify(1, ContentNodeStatsBuilder.forNode(1)
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsChangeTrackerTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsChangeTrackerTest.java
index ae237b3330e..b9e7714671c 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsChangeTrackerTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsChangeTrackerTest.java
@@ -2,12 +2,12 @@
package com.yahoo.vespa.clustercontroller.core;
import com.google.common.collect.Sets;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Set;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class ClusterStatsChangeTrackerTest {
@@ -74,39 +74,39 @@ public class ClusterStatsChangeTrackerTest {
}
@Test
- public void stats_have_not_changed_if_not_all_distributors_are_updated() {
+ void stats_have_not_changed_if_not_all_distributors_are_updated() {
Fixture f = Fixture.empty();
assertFalse(f.statsHaveChanged());
}
@Test
- public void stats_have_changed_if_in_sync_node_not_found_in_previous_stats() {
+ void stats_have_changed_if_in_sync_node_not_found_in_previous_stats() {
Fixture f = Fixture.fromStats(stats().inSync(0));
assertTrue(f.statsHaveChanged());
}
@Test
- public void stats_have_changed_if_buckets_pending_node_not_found_in_previous_stats() {
+ void stats_have_changed_if_buckets_pending_node_not_found_in_previous_stats() {
Fixture f = Fixture.fromStats(stats().bucketsPending(0));
assertTrue(f.statsHaveChanged());
}
@Test
- public void stats_have_changed_if_one_node_has_in_sync_to_buckets_pending_transition() {
+ void stats_have_changed_if_one_node_has_in_sync_to_buckets_pending_transition() {
Fixture f = Fixture.fromStats(stats().bucketsPending(0).inSync(1));
f.newAggregatedStats(stats().bucketsPending(0).bucketsPending(1));
assertTrue(f.statsHaveChanged());
}
@Test
- public void stats_have_changed_if_one_node_has_buckets_pending_to_in_sync_transition() {
+ void stats_have_changed_if_one_node_has_buckets_pending_to_in_sync_transition() {
Fixture f = Fixture.fromStats(stats().bucketsPending(0).bucketsPending(1));
f.newAggregatedStats(stats().bucketsPending(0).inSync(1));
assertTrue(f.statsHaveChanged());
}
@Test
- public void stats_have_not_changed_if_no_nodes_have_changed_state() {
+ void stats_have_not_changed_if_no_nodes_have_changed_state() {
Fixture f = Fixture.fromStats(stats().bucketsPending(0).bucketsPending(1));
f.newAggregatedStats(stats().bucketsPending(0).bucketsPending(1));
assertFalse(f.statsHaveChanged());
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ContentClusterHtmlRendererTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ContentClusterHtmlRendererTest.java
index ff1c5b0bb17..d43a3e13c6a 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ContentClusterHtmlRendererTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ContentClusterHtmlRendererTest.java
@@ -7,8 +7,8 @@ import com.yahoo.vespa.clustercontroller.core.hostinfo.HostInfo;
import com.yahoo.vespa.clustercontroller.core.status.statuspage.VdsClusterHtmlRenderer;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONWriter;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import java.io.StringWriter;
import java.io.Writer;
@@ -27,7 +27,7 @@ public class ContentClusterHtmlRendererTest {
private final TreeMap<Integer, NodeInfo> distributorNodeInfoByIndex = new TreeMap<>();
private String result;
- @Before
+ @BeforeEach
public void before() throws JSONException {
final ClusterStateBundle stateBundle = ClusterStateBundle.ofBaselineOnly(
AnnotatedClusterState.withoutAnnotations(
@@ -71,7 +71,7 @@ public class ContentClusterHtmlRendererTest {
}
@Test
- public void testVtagRendering() {
+ void testVtagRendering() {
// 9 distribution nodes should have green tag on release1.
assertThat(result.split("<td bgcolor=\"#c0ffc0\" align=\"right\"><nobr>release1</nobr></td>").length, is(10));
// 1 distribution node should have warning on release1bad.
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ContentNodeStatsTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ContentNodeStatsTest.java
index 47d1970e4d6..d30de6f7954 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ContentNodeStatsTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ContentNodeStatsTest.java
@@ -1,18 +1,16 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.core;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static com.yahoo.vespa.clustercontroller.core.ContentNodeStats.BucketSpaceStats;
-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.*;
public class ContentNodeStatsTest {
@Test
- public void bucket_space_stats_can_transition_from_valid_to_invalid() {
- BucketSpaceStats stats = BucketSpaceStats.of(5,1);
+ void bucket_space_stats_can_transition_from_valid_to_invalid() {
+ BucketSpaceStats stats = BucketSpaceStats.of(5, 1);
assertTrue(stats.valid());
stats.merge(BucketSpaceStats.invalid(), 1);
@@ -21,7 +19,7 @@ public class ContentNodeStatsTest {
}
@Test
- public void bucket_space_stats_can_transition_from_invalid_to_valid() {
+ void bucket_space_stats_can_transition_from_invalid_to_valid() {
BucketSpaceStats stats = BucketSpaceStats.invalid();
assertFalse(stats.valid());
@@ -33,7 +31,7 @@ public class ContentNodeStatsTest {
}
@Test
- public void bucket_space_stats_tracks_multiple_layers_of_invalid() {
+ void bucket_space_stats_tracks_multiple_layers_of_invalid() {
BucketSpaceStats stats = BucketSpaceStats.invalid();
stats.merge(BucketSpaceStats.invalid(), 1);
assertFalse(stats.valid());
@@ -52,19 +50,19 @@ public class ContentNodeStatsTest {
}
@Test
- public void invalid_bucket_space_stats_may_have_pending_buckets() {
+ void invalid_bucket_space_stats_may_have_pending_buckets() {
assertTrue(BucketSpaceStats.invalid().mayHaveBucketsPending(1.0));
}
@Test
- public void bucket_space_stats_without_buckets_total_use_buckets_pending_to_calculate_may_have_buckets_pending() {
+ void bucket_space_stats_without_buckets_total_use_buckets_pending_to_calculate_may_have_buckets_pending() {
assertTrue(BucketSpaceStats.of(0, 2).mayHaveBucketsPending(0.6));
assertTrue(BucketSpaceStats.of(0, 1).mayHaveBucketsPending(0.6));
assertFalse(BucketSpaceStats.of(0, 0).mayHaveBucketsPending(0.6));
}
@Test
- public void min_merge_completion_ratio_is_used_to_calculate_bucket_space_stats_may_have_buckets_pending() {
+ void min_merge_completion_ratio_is_used_to_calculate_bucket_space_stats_may_have_buckets_pending() {
assertTrue(BucketSpaceStats.of(5, 6).mayHaveBucketsPending(0.6));
assertTrue(BucketSpaceStats.of(5, 5).mayHaveBucketsPending(0.6));
assertTrue(BucketSpaceStats.of(5, 4).mayHaveBucketsPending(0.6));
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseHandlerTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseHandlerTest.java
index 1f7b9293960..4d8c7799c58 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseHandlerTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseHandlerTest.java
@@ -10,9 +10,9 @@ import com.yahoo.vespa.clustercontroller.core.database.DatabaseFactory;
import com.yahoo.vespa.clustercontroller.core.database.DatabaseHandler;
import com.yahoo.vespa.clustercontroller.core.listeners.NodeListener;
import com.yahoo.vespa.clustercontroller.core.listeners.SlobrokListener;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.MockitoAnnotations;
@@ -20,8 +20,8 @@ import org.mockito.MockitoAnnotations;
import java.util.Map;
import java.util.TreeMap;
-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.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
@@ -89,18 +89,18 @@ public class DatabaseHandlerTest {
}
}
- @Before
+ @BeforeEach
public void setUp() {
openMock = MockitoAnnotations.openMocks(this);
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
openMock.close();
}
@Test
- public void can_store_latest_cluster_state_bundle() throws Exception {
+ void can_store_latest_cluster_state_bundle() throws Exception {
Fixture f = new Fixture();
DatabaseHandler handler = f.createHandler();
handler.doNextZooKeeperTask(f.createMockContext()); // Database setup step
@@ -110,7 +110,7 @@ public class DatabaseHandlerTest {
}
@Test
- public void can_load_latest_cluster_state_bundle() throws Exception {
+ void can_load_latest_cluster_state_bundle() throws Exception {
Fixture f = new Fixture();
DatabaseHandler handler = f.createHandler();
handler.doNextZooKeeperTask(f.createMockContext()); // Database setup step
@@ -124,7 +124,7 @@ public class DatabaseHandlerTest {
// FIXME I don't like the semantics of this, but it mirrors the legacy behavior for the
// rest of the DB load operations exposed by the DatabaseHandler.
@Test
- public void empty_bundle_is_returned_if_no_db_connection() throws Exception {
+ void empty_bundle_is_returned_if_no_db_connection() throws Exception {
Fixture f = new Fixture();
DatabaseHandler handler = f.createHandler();
// Note: no DB setup step
@@ -134,7 +134,7 @@ public class DatabaseHandlerTest {
}
@Test
- public void save_wanted_state_of_configured_nodes() throws Exception {
+ void save_wanted_state_of_configured_nodes() throws Exception {
var fixture = new Fixture();
DatabaseHandler handler = fixture.createHandler();
DatabaseHandler.DatabaseContext databaseContext = fixture.createMockContext();
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseTest.java
index 2ff48e00d0f..dc297e7a549 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseTest.java
@@ -12,22 +12,21 @@ import com.yahoo.vdslib.state.Node;
import com.yahoo.vdslib.state.NodeState;
import com.yahoo.vdslib.state.NodeType;
import com.yahoo.vdslib.state.State;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Map;
import java.util.TreeMap;
import java.util.logging.Logger;
-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.assertTrue;
public class DatabaseTest extends FleetControllerTest {
private static final Logger log = Logger.getLogger(DatabaseTest.class.getName());
@Test
- public void testWantedStatesInZooKeeper() throws Exception {
+ void testWantedStatesInZooKeeper() throws Exception {
startingTest("DatabaseTest::testWantedStatesInZooKeeper");
FleetControllerOptions options = defaultOptions("mycluster");
options.zooKeeperServerAddress = "127.0.0.1";
@@ -81,7 +80,7 @@ public class DatabaseTest extends FleetControllerTest {
}
@Test
- public void testWantedStateOfUnknownNode() throws Exception {
+ void testWantedStateOfUnknownNode() throws Exception {
startingTest("DatabaseTest::testWantedStatesOfUnknownNode");
FleetControllerOptions options = defaultOptions("mycluster");
options.minRatioOfDistributorNodesUp = 0;
@@ -124,7 +123,7 @@ public class DatabaseTest extends FleetControllerTest {
assertWantedStates(wantedStates);
stopFleetController();
- for (int i=6; i<nodes.size(); ++i) nodes.get(i).disconnect();
+ for (int i = 6; i < nodes.size(); ++i) nodes.get(i).disconnect();
startFleetController();
waitForState("version:\\d+ distributor:3 storage:7 .1.s:m .3.s:d .4.s:d .5.s:d .6.s:m");
@@ -132,14 +131,14 @@ public class DatabaseTest extends FleetControllerTest {
setWantedState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.UP), wantedStates);
waitForState("version:\\d+ distributor:3 storage:3 .1.s:m");
- for (int i=6; i<nodes.size(); ++i) nodes.get(i).connect();
+ for (int i = 6; i < nodes.size(); ++i) nodes.get(i).connect();
waitForState("version:\\d+ distributor:10 .8.s:d storage:10 .1.s:m .7.s:r .8.s:d");
assertWantedStates(wantedStates);
}
private void assertWantedStates(Map<Node, NodeState> wantedStates) {
for (DummyVdsNode node : nodes) {
- assertEquals(node.getNode().toString(), wantedStates.get(node.getNode()), fleetController.getWantedNodeState(node.getNode()));
+ assertEquals(wantedStates.get(node.getNode()), fleetController.getWantedNodeState(node.getNode()), node.getNode().toString());
}
}
@@ -156,8 +155,8 @@ public class DatabaseTest extends FleetControllerTest {
req.parameters().add(new StringValue("storage/cluster.mycluster/" + n.getType().toString() + "/" + n.getIndex()));
req.parameters().add(new StringValue(ns.serialize(true)));
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
- assertTrue(req.toString(), req.checkReturnTypes("s"));
+ assertEquals(ErrorCode.NONE, req.errorCode(), req.toString());
+ assertTrue(req.checkReturnTypes("s"), req.toString());
wantedStates.put(n, ns);
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DistributionBitCountTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DistributionBitCountTest.java
index e9d3a9cf83e..d3b0addbb13 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DistributionBitCountTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DistributionBitCountTest.java
@@ -6,12 +6,12 @@ import com.yahoo.vdslib.state.ClusterState;
import com.yahoo.vdslib.state.NodeState;
import com.yahoo.vdslib.state.NodeType;
import com.yahoo.vdslib.state.State;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class DistributionBitCountTest extends FleetControllerTest {
@@ -37,7 +37,7 @@ public class DistributionBitCountTest extends FleetControllerTest {
* Test that then altering config to increased bit count, that a new system state is not sent out (and not altered) if a storagenode needs it to be no further split.
*/
@Test
- public void testDistributionBitCountConfigIncrease() throws Exception {
+ void testDistributionBitCountConfigIncrease() throws Exception {
setUpSystem("DistributionBitCountTest::testDistributionBitCountConfigIncrease");
options.distributionBits = 20;
fleetController.updateOptions(options);
@@ -53,7 +53,7 @@ public class DistributionBitCountTest extends FleetControllerTest {
* Test that then altering config to decrease bit count, that a new system state is sent out with that bit count.
*/
@Test
- public void testDistributionBitCountConfigDecrease() throws Exception {
+ void testDistributionBitCountConfigDecrease() throws Exception {
setUpSystem("DistributionBitCountTest::testDistributionBitCountConfigDecrease");
options.distributionBits = 12;
fleetController.updateOptions(options);
@@ -69,7 +69,7 @@ public class DistributionBitCountTest extends FleetControllerTest {
* node now being lowest, the fleetcontroller adjusts to use that bit in system state.
*/
@Test
- public void testStorageNodeReportingHigherBitCount() throws Exception {
+ void testStorageNodeReportingHigherBitCount() throws Exception {
setUpSystem("DistributionBitCountTest::testStorageNodeReportingHigherBitCount");
nodes.get(1).setNodeState(new NodeState(NodeType.STORAGE, State.UP).setMinUsedBits(11));
@@ -78,12 +78,11 @@ public class DistributionBitCountTest extends FleetControllerTest {
ClusterState startState = waitForState("version:\\d+ bits:11 distributor:10 storage:10");
nodes.get(1).setNodeState(new NodeState(NodeType.STORAGE, State.UP).setMinUsedBits(12));
- assertEquals(startState + "->" + fleetController.getSystemState(),
- startState.getVersion(), fleetController.getSystemState().getVersion());
+ assertEquals(startState.getVersion(), fleetController.getSystemState().getVersion(), startState + "->" + fleetController.getSystemState());
for (int i = 0; i < 10; ++i) {
// nodes is array of [distr.0, stor.0, distr.1, stor.1, ...] and we just want the storage nodes
- nodes.get(i*2 + 1).setNodeState(new NodeState(NodeType.STORAGE, State.UP).setMinUsedBits(17));
+ nodes.get(i * 2 + 1).setNodeState(new NodeState(NodeType.STORAGE, State.UP).setMinUsedBits(17));
}
assertEquals(startState.getVersion() + 1, waitForState("version:\\d+ bits:17 distributor:10 storage:10").getVersion());
}
@@ -93,7 +92,7 @@ public class DistributionBitCountTest extends FleetControllerTest {
* Test that then storage node report lower bit count, and then becomes the smallest, the fleetcontroller adjusts to use that bit in system state.
*/
@Test
- public void testStorageNodeReportingLowerBitCount() throws Exception {
+ void testStorageNodeReportingLowerBitCount() throws Exception {
setUpSystem("DistributionBitCountTest::testStorageNodeReportingLowerBitCount");
nodes.get(1).setNodeState(new NodeState(NodeType.STORAGE, State.UP).setMinUsedBits(13));
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/EventDiffCalculatorTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/EventDiffCalculatorTest.java
index 48d6ccbf655..8b07c216774 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/EventDiffCalculatorTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/EventDiffCalculatorTest.java
@@ -18,7 +18,7 @@ import static org.hamcrest.CoreMatchers.hasItem;
import static com.yahoo.vespa.clustercontroller.core.ClusterFixture.storageNode;
import static com.yahoo.vespa.clustercontroller.core.ClusterFixture.distributorNode;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.List;
@@ -124,7 +124,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void single_storage_node_state_transition_emits_altered_node_state_event() {
+ void single_storage_node_state_transition_emits_altered_node_state_event() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.clusterStateAfter("distributor:3 storage:3 .0.s:d");
@@ -138,7 +138,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void single_distributor_node_state_transition_emits_altered_node_state_event() {
+ void single_distributor_node_state_transition_emits_altered_node_state_event() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.clusterStateAfter("distributor:3 .1.s:d storage:3");
@@ -152,7 +152,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void node_state_change_event_is_tagged_with_given_time() {
+ void node_state_change_event_is_tagged_with_given_time() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.clusterStateAfter("distributor:3 storage:3 .0.s:d")
@@ -164,7 +164,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void multiple_node_state_transitions_emit_multiple_node_state_events() {
+ void multiple_node_state_transitions_emit_multiple_node_state_events() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3 .1.s:d")
.clusterStateAfter("distributor:3 .2.s:d storage:3 .0.s:r");
@@ -183,7 +183,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void no_emitted_node_state_event_when_node_state_not_changed() {
+ void no_emitted_node_state_event_when_node_state_not_changed() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.clusterStateAfter("distributor:3 storage:3");
@@ -193,7 +193,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void node_down_edge_with_group_down_reason_has_separate_event_emitted() {
+ void node_down_edge_with_group_down_reason_has_separate_event_emitted() {
// We sneakily use a flat cluster here but still use a 'group down' reason. Differ doesn't currently care.
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
@@ -213,7 +213,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void group_down_to_group_down_does_not_emit_new_event() {
+ void group_down_to_group_down_does_not_emit_new_event() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3 .1.s:d")
.clusterStateAfter("distributor:3 storage:3 .1.s:m")
@@ -229,7 +229,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void group_down_to_clear_reason_emits_group_up_event() {
+ void group_down_to_clear_reason_emits_group_up_event() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3 .2.s:d")
.clusterStateAfter("distributor:3 storage:3")
@@ -247,7 +247,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void cluster_up_edge_emits_sufficient_node_availability_event() {
+ void cluster_up_edge_emits_sufficient_node_availability_event() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("cluster:d distributor:3 storage:3")
.clusterStateAfter("distributor:3 storage:3");
@@ -259,7 +259,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void cluster_down_event_without_reason_annotation_emits_generic_down_event() {
+ void cluster_down_event_without_reason_annotation_emits_generic_down_event() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.clusterStateAfter("cluster:d distributor:3 storage:3");
@@ -271,7 +271,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void cluster_event_is_tagged_with_given_time() {
+ void cluster_event_is_tagged_with_given_time() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.clusterStateAfter("cluster:d distributor:3 storage:3")
@@ -283,7 +283,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void no_event_emitted_for_cluster_down_to_down_edge() {
+ void no_event_emitted_for_cluster_down_to_down_edge() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("cluster:d distributor:3 storage:3")
.clusterStateAfter("cluster:d distributor:3 storage:3");
@@ -293,7 +293,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void too_few_storage_nodes_cluster_down_reason_emits_corresponding_event() {
+ void too_few_storage_nodes_cluster_down_reason_emits_corresponding_event() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.clusterStateAfter("cluster:d distributor:3 storage:3")
@@ -307,7 +307,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void too_few_distributor_nodes_cluster_down_reason_emits_corresponding_event() {
+ void too_few_distributor_nodes_cluster_down_reason_emits_corresponding_event() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.clusterStateAfter("cluster:d distributor:3 storage:3")
@@ -320,7 +320,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void too_low_storage_node_ratio_cluster_down_reason_emits_corresponding_event() {
+ void too_low_storage_node_ratio_cluster_down_reason_emits_corresponding_event() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.clusterStateAfter("cluster:d distributor:3 storage:3")
@@ -333,7 +333,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void too_low_distributor_node_ratio_cluster_down_reason_emits_corresponding_event() {
+ void too_low_distributor_node_ratio_cluster_down_reason_emits_corresponding_event() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.clusterStateAfter("cluster:d distributor:3 storage:3")
@@ -346,7 +346,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void may_have_merges_pending_up_edge_event_emitted_if_derived_bucket_space_state_differs_from_baseline() {
+ void may_have_merges_pending_up_edge_event_emitted_if_derived_bucket_space_state_differs_from_baseline() {
EventFixture f = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.derivedClusterStateBefore("default", "distributor:3 storage:3")
@@ -367,7 +367,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void may_have_merges_pending_down_edge_event_emitted_if_derived_bucket_space_state_differs_from_baseline() {
+ void may_have_merges_pending_down_edge_event_emitted_if_derived_bucket_space_state_differs_from_baseline() {
EventFixture f = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.derivedClusterStateBefore("default", "distributor:3 storage:3 .1.s:m")
@@ -388,7 +388,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void both_baseline_and_derived_bucket_space_state_events_are_emitted() {
+ void both_baseline_and_derived_bucket_space_state_events_are_emitted() {
EventFixture f = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.derivedClusterStateBefore("default", "distributor:3 storage:3")
@@ -408,7 +408,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void derived_bucket_space_state_events_are_not_emitted_if_similar_to_baseline() {
+ void derived_bucket_space_state_events_are_not_emitted_if_similar_to_baseline() {
EventFixture f = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.derivedClusterStateBefore("default", "distributor:3 storage:3")
@@ -426,7 +426,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void storage_node_passed_maintenance_grace_period_emits_event() {
+ void storage_node_passed_maintenance_grace_period_emits_event() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3 .0.s:m")
.clusterStateAfter("distributor:3 storage:3 .0.s:d")
@@ -443,7 +443,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void storage_node_maintenance_grace_period_event_only_emitted_on_maintenance_to_down_edge() {
+ void storage_node_maintenance_grace_period_event_only_emitted_on_maintenance_to_down_edge() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3 .0.s:u")
.clusterStateAfter("distributor:3 storage:3 .0.s:d")
@@ -457,7 +457,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void feed_block_engage_edge_emits_cluster_event() {
+ void feed_block_engage_edge_emits_cluster_event() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.feedBlockBefore(null)
@@ -471,7 +471,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void feed_block_disengage_edge_emits_cluster_event() {
+ void feed_block_disengage_edge_emits_cluster_event() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.feedBlockBefore(ClusterStateBundle.FeedBlock.blockedWithDescription("we're closed"))
@@ -484,7 +484,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void feed_block_engaged_to_engaged_edge_does_not_emit_new_cluster_event() {
+ void feed_block_engaged_to_engaged_edge_does_not_emit_new_cluster_event() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.feedBlockBefore(ClusterStateBundle.FeedBlock.blockedWithDescription("we're closed"))
@@ -496,7 +496,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void feed_block_engage_edge_with_node_exhaustion_info_emits_cluster_and_node_events() {
+ void feed_block_engage_edge_with_node_exhaustion_info_emits_cluster_and_node_events() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.feedBlockBefore(null)
@@ -515,7 +515,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void added_exhaustion_in_feed_block_resource_set_emits_node_event() {
+ void added_exhaustion_in_feed_block_resource_set_emits_node_event() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.feedBlockBefore(ClusterStateBundle.FeedBlock.blockedWith(
@@ -533,7 +533,7 @@ public class EventDiffCalculatorTest {
}
@Test
- public void removed_exhaustion_in_feed_block_resource_set_emits_node_event() {
+ void removed_exhaustion_in_feed_block_resource_set_emits_node_event() {
final EventFixture fixture = EventFixture.createForNodes(3)
.clusterStateBefore("distributor:3 storage:3")
.feedBlockBefore(ClusterStateBundle.FeedBlock.blockedWith(
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/EventLogTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/EventLogTest.java
index afbc50124e2..eee0cb41eeb 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/EventLogTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/EventLogTest.java
@@ -3,19 +3,22 @@ package com.yahoo.vespa.clustercontroller.core;
import com.yahoo.vdslib.state.Node;
import com.yahoo.vdslib.state.NodeType;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.mockito.junit.jupiter.MockitoSettings;
+import org.mockito.quality.Strictness;
import java.util.logging.Level;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
+@MockitoSettings(strictness = Strictness.LENIENT)
public class EventLogTest {
private final MetricUpdater metricUpdater = mock(MetricUpdater.class);
private final NodeEvent nodeEvent = mock(NodeEvent.class);
@@ -33,7 +36,7 @@ public class EventLogTest {
}
@Test
- public void testMetric() {
+ void testMetric() {
initialize(metricUpdater);
eventLog.addNodeOnlyEvent(nodeEvent, Level.INFO);
@@ -43,7 +46,7 @@ public class EventLogTest {
}
@Test
- public void testNullMetricReporter() {
+ void testNullMetricReporter() {
initialize(null);
eventLog.addNodeOnlyEvent(nodeEvent, Level.INFO);
@@ -52,7 +55,7 @@ public class EventLogTest {
}
@Test
- public void testNoEventsDoNotThrowException() {
+ void testNoEventsDoNotThrowException() {
initialize(metricUpdater);
StringBuilder builder = new StringBuilder();
Node nonExistantNode = new Node(NodeType.DISTRIBUTOR, 0);
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/FleetControllerContextImplTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/FleetControllerContextImplTest.java
index 450975076bb..96ce050f33b 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/FleetControllerContextImplTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/FleetControllerContextImplTest.java
@@ -1,7 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.core;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
@@ -9,7 +9,7 @@ import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author hakonhall
@@ -20,7 +20,7 @@ public class FleetControllerContextImplTest {
private final FleetControllerContextImpl context = new FleetControllerContextImpl(id);
@Test
- public void verify() {
+ void verify() {
context.log(logger, Level.INFO, "A %s message", "log");
assertEquals(1, logger.records.size());
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/FleetControllerTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/FleetControllerTest.java
index a5eeb69e126..5e4b62e0462 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/FleetControllerTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/FleetControllerTest.java
@@ -27,11 +27,10 @@ import com.yahoo.vespa.clustercontroller.core.testutils.WaitCondition;
import com.yahoo.vespa.clustercontroller.core.testutils.WaitTask;
import com.yahoo.vespa.clustercontroller.core.testutils.Waiter;
import com.yahoo.vespa.clustercontroller.utils.util.NoMetricReporter;
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.rules.TestRule;
-import org.junit.rules.TestWatcher;
-import org.junit.runner.Description;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.TestWatcher;
import java.util.ArrayList;
import java.util.Arrays;
@@ -49,11 +48,12 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author HÃ¥kon Humberset
*/
+@ExtendWith(FleetControllerTest.CleanupZookeeperLogsOnSuccess.class)
public abstract class FleetControllerTest implements Waiter {
private static final Logger log = Logger.getLogger(FleetControllerTest.class.getName());
@@ -96,30 +96,31 @@ public abstract class FleetControllerTest implements Waiter {
public boolean shouldInform(double v) { return false; }
}
- protected class CleanupZookeeperLogsOnSuccess extends TestWatcher {
+ public static class CleanupZookeeperLogsOnSuccess implements TestWatcher {
+
+ public CleanupZookeeperLogsOnSuccess() {}
+
@Override
- protected void failed(Throwable e, Description description) {
+ public void testFailed(ExtensionContext context, Throwable cause) {
System.err.println("TEST FAILED - NOT cleaning up zookeeper directory");
- shutdownZooKeeper(false);
+ shutdownZooKeeper(context, false);
}
@Override
- protected void succeeded(Description description) {
+ public void testSuccessful(ExtensionContext context) {
System.err.println("TEST SUCCEEDED - cleaning up zookeeper directory");
- shutdownZooKeeper(true);
+ shutdownZooKeeper(context, true);
}
- private void shutdownZooKeeper(boolean cleanupZooKeeperDir) {
- if (zooKeeperServer != null) {
- zooKeeperServer.shutdown(cleanupZooKeeperDir);
- zooKeeperServer = null;
+ private void shutdownZooKeeper(ExtensionContext ctx, boolean cleanupZooKeeperDir) {
+ FleetControllerTest test = (FleetControllerTest) ctx.getTestInstance().orElseThrow();
+ if (test.zooKeeperServer != null) {
+ test.zooKeeperServer.shutdown(cleanupZooKeeperDir);
+ test.zooKeeperServer = null;
}
}
}
- @Rule
- public TestRule cleanupZookeeperLogsOnSuccess = new CleanupZookeeperLogsOnSuccess();
-
protected void startingTest(String name) {
System.err.println("STARTING TEST: " + name);
testName = name;
@@ -330,7 +331,7 @@ public abstract class FleetControllerTest implements Waiter {
}
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
tearDownSystem();
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAutoTakedownLiveConfigTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAutoTakedownLiveConfigTest.java
index e6c5c31010f..7f6684e595d 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAutoTakedownLiveConfigTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAutoTakedownLiveConfigTest.java
@@ -1,11 +1,11 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.core;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.HashSet;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertFalse;
public class GroupAutoTakedownLiveConfigTest extends FleetControllerTest {
@@ -53,14 +53,14 @@ public class GroupAutoTakedownLiveConfigTest extends FleetControllerTest {
}
@Test
- public void bootstrap_min_ratio_option_is_propagated_to_group_availability_logic() throws Exception {
+ void bootstrap_min_ratio_option_is_propagated_to_group_availability_logic() throws Exception {
setUp3x3ClusterWithMinNodeRatio(0.67);
takeDownContentNode(0);
waitForStateExcludingNodeSubset("version:\\d+ distributor:9 storage:9 .0.s:d .1.s:d .2.s:d", asIntSet(0));
}
@Test
- public void min_ratio_live_reconfig_immediately_takes_effect() throws Exception {
+ void min_ratio_live_reconfig_immediately_takes_effect() throws Exception {
// Initially, arbitrarily many nodes may be down in a group.
setUp3x3ClusterWithMinNodeRatio(0.0);
takeDownContentNode(3);
@@ -75,7 +75,7 @@ public class GroupAutoTakedownLiveConfigTest extends FleetControllerTest {
}
@Test
- public void live_distribution_config_changes_trigger_cluster_state_change() throws Exception {
+ void live_distribution_config_changes_trigger_cluster_state_change() throws Exception {
setUp3x3ClusterWithMinNodeRatio(0.65);
takeDownContentNode(6);
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAutoTakedownTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAutoTakedownTest.java
index 1d4b2a73560..f0c8503fed9 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAutoTakedownTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAutoTakedownTest.java
@@ -8,7 +8,7 @@ import com.yahoo.vdslib.state.NodeType;
import com.yahoo.vdslib.state.State;
import com.yahoo.vespa.clustercontroller.core.database.DatabaseHandler;
import com.yahoo.vespa.clustercontroller.core.listeners.NodeListener;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.HashSet;
import java.util.List;
@@ -19,7 +19,7 @@ import static com.yahoo.vespa.clustercontroller.core.matchers.NodeEventWithDescr
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.AllOf.allOf;
import static org.hamcrest.core.IsCollectionContaining.hasItem;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -71,17 +71,17 @@ public class GroupAutoTakedownTest {
* not apply to a flat structure.
*/
@Test
- public void config_does_not_apply_to_flat_hierarchy_clusters() {
+ void config_does_not_apply_to_flat_hierarchy_clusters() {
ClusterFixture fixture = createFixtureForAllUpFlatCluster(5, 0.99);
assertEquals("distributor:5 storage:5", fixture.generatedClusterState());
assertEquals("distributor:5 storage:5 .1.s:d",
- stateAfterStorageTransition(fixture, 1, State.DOWN));
+ stateAfterStorageTransition(fixture, 1, State.DOWN));
}
@Test
- public void group_node_down_edge_implicitly_marks_down_rest_of_nodes_in_group() {
+ void group_node_down_edge_implicitly_marks_down_rest_of_nodes_in_group() {
ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.51);
@@ -89,28 +89,28 @@ public class GroupAutoTakedownTest {
// Same group as node 4
assertEquals("distributor:6 storage:4",
- stateAfterStorageTransition(fixture, 5, State.DOWN));
+ stateAfterStorageTransition(fixture, 5, State.DOWN));
// Same group as node 1
assertEquals("distributor:6 storage:4 .0.s:d .1.s:d",
- stateAfterStorageTransition(fixture, 0, State.DOWN));
+ stateAfterStorageTransition(fixture, 0, State.DOWN));
}
@Test
- public void restored_group_node_availability_takes_group_back_up_automatically() {
+ void restored_group_node_availability_takes_group_back_up_automatically() {
ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.51);
// Group #2 -> down
assertEquals("distributor:6 storage:4",
- stateAfterStorageTransition(fixture, 5, State.DOWN));
+ stateAfterStorageTransition(fixture, 5, State.DOWN));
// Group #2 -> back up again
assertEquals("distributor:6 storage:6",
- stateAfterStorageTransition(fixture, 5, State.UP));
+ stateAfterStorageTransition(fixture, 5, State.UP));
}
@Test
- public void no_op_for_downed_nodes_in_already_downed_group() {
+ void no_op_for_downed_nodes_in_already_downed_group() {
ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.51);
@@ -123,7 +123,7 @@ public class GroupAutoTakedownTest {
}
@Test
- public void verbose_node_state_description_updated_for_implicitly_downed_nodes() {
+ void verbose_node_state_description_updated_for_implicitly_downed_nodes() {
ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(3), 0.75);
@@ -131,15 +131,15 @@ public class GroupAutoTakedownTest {
// Node 8 is taken down by the fixture and gets a fixture-assigned message that
// we should _not_ lose/overwrite.
assertEquals("distributor:9 storage:9 .6.s:d " +
- ".6.m:group\\x20node\\x20availability\\x20below\\x20configured\\x20threshold " +
- ".7.s:d " +
- ".7.m:group\\x20node\\x20availability\\x20below\\x20configured\\x20threshold " +
- ".8.s:d .8.m:mockdesc",
- verboseStateAfterStorageTransition(fixture, 8, State.DOWN));
+ ".6.m:group\\x20node\\x20availability\\x20below\\x20configured\\x20threshold " +
+ ".7.s:d " +
+ ".7.m:group\\x20node\\x20availability\\x20below\\x20configured\\x20threshold " +
+ ".8.s:d .8.m:mockdesc",
+ verboseStateAfterStorageTransition(fixture, 8, State.DOWN));
}
@Test
- public void legacy_cluster_wide_availabilty_ratio_is_computed_after_group_takedowns() {
+ void legacy_cluster_wide_availabilty_ratio_is_computed_after_group_takedowns() {
ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.51);
fixture.setMinNodesUp(5, 5, 0.51, 0.51);
@@ -152,7 +152,7 @@ public class GroupAutoTakedownTest {
}
@Test
- public void maintenance_wanted_state_not_overwritten() {
+ void maintenance_wanted_state_not_overwritten() {
ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(3), 0.99);
@@ -166,7 +166,7 @@ public class GroupAutoTakedownTest {
}
@Test
- public void transient_maintenance_mode_on_down_edge_does_not_take_down_group() {
+ void transient_maintenance_mode_on_down_edge_does_not_take_down_group() {
ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(3), 0.99);
fixture.enableTransientMaintenanceModeOnDown(1000);
@@ -190,7 +190,7 @@ public class GroupAutoTakedownTest {
}
@Test
- public void taking_down_node_adds_node_specific_event() {
+ void taking_down_node_adds_node_specific_event() {
ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.51);
@@ -205,7 +205,7 @@ public class GroupAutoTakedownTest {
}
@Test
- public void bringing_node_back_up_adds_node_specific_event() {
+ void bringing_node_back_up_adds_node_specific_event() {
ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.51);
@@ -223,7 +223,7 @@ public class GroupAutoTakedownTest {
}
@Test
- public void wanted_state_retired_implicitly_down_node_is_transitioned_to_retired_mode_immediately() {
+ void wanted_state_retired_implicitly_down_node_is_transitioned_to_retired_mode_immediately() {
ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(3), 0.99);
@@ -237,7 +237,7 @@ public class GroupAutoTakedownTest {
}
@Test
- public void downed_config_retired_node_transitions_back_to_retired_on_up_edge() {
+ void downed_config_retired_node_transitions_back_to_retired_on_up_edge() {
ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.49);
@@ -252,14 +252,15 @@ public class GroupAutoTakedownTest {
nodes.add(new ConfiguredNode(5, true));
// TODO this should ideally also set the retired flag in the distribution
// config, but only the ConfiguredNodes are actually looked at currently.
- fixture.cluster.setNodes(nodes, new NodeListener() {});
+ fixture.cluster.setNodes(nodes, new NodeListener() {
+ });
assertEquals("distributor:6 storage:6 .4.s:d .5.s:r",
stateAfterStorageTransition(fixture, 5, State.UP));
}
@Test
- public void init_progress_is_preserved_across_group_down_up_edge() {
+ void init_progress_is_preserved_across_group_down_up_edge() {
ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.51);
@@ -277,7 +278,7 @@ public class GroupAutoTakedownTest {
}
@Test
- public void down_wanted_state_is_preserved_across_group_down_up_edge() {
+ void down_wanted_state_is_preserved_across_group_down_up_edge() {
ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(3), 0.60);
@@ -294,7 +295,7 @@ public class GroupAutoTakedownTest {
}
@Test
- public void previously_cleared_start_timestamps_are_not_reintroduced_on_up_edge() throws Exception {
+ void previously_cleared_start_timestamps_are_not_reintroduced_on_up_edge() throws Exception {
ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.51);
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAvailabilityCalculatorTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAvailabilityCalculatorTest.java
index a5357e0a639..d176455f4c0 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAvailabilityCalculatorTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAvailabilityCalculatorTest.java
@@ -2,7 +2,7 @@
package com.yahoo.vespa.clustercontroller.core;
import com.yahoo.vdslib.state.ClusterState;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.text.ParseException;
import java.util.Collections;
@@ -49,7 +49,7 @@ public class GroupAvailabilityCalculatorTest {
private static Set<Integer> emptySet() { return indices(); }
@Test
- public void flat_cluster_does_not_implicitly_take_down_nodes() {
+ void flat_cluster_does_not_implicitly_take_down_nodes() {
GroupAvailabilityCalculator calc = calcForFlatCluster(5, 0.99);
assertThat(calc.nodesThatShouldBeDown(clusterState(
@@ -58,7 +58,7 @@ public class GroupAvailabilityCalculatorTest {
}
@Test
- public void group_node_down_edge_implicitly_marks_down_rest_of_nodes_in_group() {
+ void group_node_down_edge_implicitly_marks_down_rest_of_nodes_in_group() {
// 3 groups of 2 nodes, take down node #4 (1st node in last group). Since we require
// at least 51% of group capacity to be available, implicitly take down the last group
// entirely.
@@ -72,7 +72,7 @@ public class GroupAvailabilityCalculatorTest {
// Setting 50% as min ratio in a group with 2 nodes should let group be up if
// one node goes down.
@Test
- public void min_ratio_per_group_is_closed_interval() {
+ void min_ratio_per_group_is_closed_interval() {
GroupAvailabilityCalculator calc = calcForHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.50);
assertThat(calc.nodesThatShouldBeDown(clusterState(
@@ -80,7 +80,7 @@ public class GroupAvailabilityCalculatorTest {
}
@Test
- public void retired_node_is_counted_as_down() {
+ void retired_node_is_counted_as_down() {
GroupAvailabilityCalculator calc = calcForHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.99);
assertThat(calc.nodesThatShouldBeDown(clusterState(
@@ -88,7 +88,7 @@ public class GroupAvailabilityCalculatorTest {
}
@Test
- public void initializing_node_not_counted_as_down() {
+ void initializing_node_not_counted_as_down() {
GroupAvailabilityCalculator calc = calcForHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.99);
assertThat(calc.nodesThatShouldBeDown(clusterState(
@@ -96,7 +96,7 @@ public class GroupAvailabilityCalculatorTest {
}
@Test
- public void maintenance_node_not_counted_as_down() {
+ void maintenance_node_not_counted_as_down() {
GroupAvailabilityCalculator calc = calcForHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.99);
assertThat(calc.nodesThatShouldBeDown(clusterState(
@@ -104,7 +104,7 @@ public class GroupAvailabilityCalculatorTest {
}
@Test
- public void existing_maintenance_node_not_implicitly_downed_when_group_taken_down() {
+ void existing_maintenance_node_not_implicitly_downed_when_group_taken_down() {
GroupAvailabilityCalculator calc = calcForHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(3), 0.99);
assertThat(calc.nodesThatShouldBeDown(clusterState(
@@ -112,7 +112,7 @@ public class GroupAvailabilityCalculatorTest {
}
@Test
- public void existing_retired_node_not_implicitly_downed_when_group_taken_down() {
+ void existing_retired_node_not_implicitly_downed_when_group_taken_down() {
GroupAvailabilityCalculator calc = calcForHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(3), 0.99);
assertThat(calc.nodesThatShouldBeDown(clusterState(
@@ -120,7 +120,7 @@ public class GroupAvailabilityCalculatorTest {
}
@Test
- public void down_to_down_edge_keeps_group_down() {
+ void down_to_down_edge_keeps_group_down() {
GroupAvailabilityCalculator calc = calcForHierarchicCluster(
DistributionBuilder.withGroups(2).eachWithNodeCount(4), 0.76);
@@ -135,7 +135,7 @@ public class GroupAvailabilityCalculatorTest {
// causing "storage:6 .5.s:d" to be reduced to "storage:5". This still implies a
// node is down according to the distribution config and must be handled as such.
@Test
- public void implicitly_downed_node_at_state_end_is_counted_as_explicitly_down() {
+ void implicitly_downed_node_at_state_end_is_counted_as_explicitly_down() {
GroupAvailabilityCalculator calc = calcForHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.99);
assertThat(calc.nodesThatShouldBeDown(clusterState(
@@ -143,7 +143,7 @@ public class GroupAvailabilityCalculatorTest {
}
@Test
- public void non_uniform_group_sizes_are_supported() {
+ void non_uniform_group_sizes_are_supported() {
GroupAvailabilityCalculator calc = calcForHierarchicCluster(
DistributionBuilder.withGroupNodes(1, 2, 3, 4), 0.67);
@@ -167,7 +167,7 @@ public class GroupAvailabilityCalculatorTest {
}
@Test
- public void min_ratio_of_zero_never_takes_down_groups_implicitly() {
+ void min_ratio_of_zero_never_takes_down_groups_implicitly() {
GroupAvailabilityCalculator calc = calcForHierarchicCluster(
DistributionBuilder.withGroups(2).eachWithNodeCount(4), 0.0);
assertThat(calc.nodesThatShouldBeDown(clusterState(
@@ -184,7 +184,7 @@ public class GroupAvailabilityCalculatorTest {
}
@Test
- public void one_safe_maintenance_node_does_not_take_down_group() {
+ void one_safe_maintenance_node_does_not_take_down_group() {
// 2 groups of 5 nodes each. Set node #5 safely in maintenance (1st node in last group).
// Since the minimum number of nodes that can safely be set to maintenance before taking
// the whole group down is 2, the whole group should NOT be taken down.
@@ -204,7 +204,7 @@ public class GroupAvailabilityCalculatorTest {
}
@Test
- public void two_safe_maintenance_nodes_takes_down_group() {
+ void two_safe_maintenance_nodes_takes_down_group() {
// 2 groups of 5 nodes each. Set nodes #5 and #6 safely in maintenance (1st and 2nd nodes
// in last group, respectively). Since the minimum number of nodes that can safely be set to
// maintenance before taking the whole group down is 2, the whole group should be taken down.
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/LeafGroupsTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/LeafGroupsTest.java
index 418400b3fff..b6bd6a3bf75 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/LeafGroupsTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/LeafGroupsTest.java
@@ -2,7 +2,7 @@
package com.yahoo.vespa.clustercontroller.core;
import com.yahoo.vdslib.distribution.Group;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.List;
@@ -12,7 +12,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
public class LeafGroupsTest {
@Test
- public void rootGroupCountedAsLeafWhenNoChildren() {
+ void rootGroupCountedAsLeafWhenNoChildren() {
Group g = new Group(0, "donkeykong");
List<Group> leaves = LeafGroups.enumerateFrom(g);
@@ -25,7 +25,7 @@ public class LeafGroupsTest {
}
@Test
- public void singleLeafIsEnumerated() throws Exception {
+ void singleLeafIsEnumerated() throws Exception {
Group g = new Group(0, "donkeykong", dummyDistribution());
Group child = new Group(1, "mario");
g.addSubGroup(child);
@@ -36,7 +36,7 @@ public class LeafGroupsTest {
}
@Test
- public void singleLeafIsEnumeratedInNestedCase() throws Exception {
+ void singleLeafIsEnumeratedInNestedCase() throws Exception {
Group g = new Group(0, "donkeykong", dummyDistribution());
Group child = new Group(1, "mario", dummyDistribution());
child.addSubGroup(new Group(2, "toad"));
@@ -48,7 +48,7 @@ public class LeafGroupsTest {
}
@Test
- public void multipleLeafGroupsAreEnumerated() throws Exception {
+ void multipleLeafGroupsAreEnumerated() throws Exception {
Group g = new Group(0, "donkeykong", dummyDistribution());
Group child = new Group(1, "mario", dummyDistribution());
child.addSubGroup(new Group(2, "toad"));
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MaintenanceWhenPendingGlobalMergesTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MaintenanceWhenPendingGlobalMergesTest.java
index 2f79ad3fa95..6a05cc78508 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MaintenanceWhenPendingGlobalMergesTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MaintenanceWhenPendingGlobalMergesTest.java
@@ -3,7 +3,7 @@ package com.yahoo.vespa.clustercontroller.core;
import com.yahoo.document.FixedBucketSpaces;
import com.yahoo.vdslib.state.ClusterState;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
@@ -53,7 +53,7 @@ public class MaintenanceWhenPendingGlobalMergesTest {
}
@Test
- public void no_nodes_set_to_maintenance_in_global_bucket_space_state() {
+ void no_nodes_set_to_maintenance_in_global_bucket_space_state() {
Fixture f = new Fixture();
when(f.mockPendingChecker.mayHaveMergesPending(eq(globalSpace()), anyInt())).thenReturn(true); // False returned by default otherwise
AnnotatedClusterState derived = f.deriver.derivedFrom(stateFromString("distributor:2 storage:2"), globalSpace());
@@ -61,7 +61,7 @@ public class MaintenanceWhenPendingGlobalMergesTest {
}
@Test
- public void content_nodes_with_global_merge_pending_set_to_maintenance_in_default_space_state() {
+ void content_nodes_with_global_merge_pending_set_to_maintenance_in_default_space_state() {
Fixture f = new Fixture();
when(f.mockPendingChecker.mayHaveMergesPending(globalSpace(), 1)).thenReturn(true);
when(f.mockPendingChecker.mayHaveMergesPending(globalSpace(), 3)).thenReturn(true);
@@ -71,14 +71,14 @@ public class MaintenanceWhenPendingGlobalMergesTest {
}
@Test
- public void no_nodes_set_to_maintenance_when_no_merges_pending() {
+ void no_nodes_set_to_maintenance_when_no_merges_pending() {
Fixture f = new Fixture();
AnnotatedClusterState derived = f.deriver.derivedFrom(stateFromString("distributor:5 storage:5"), defaultSpace());
assertThat(derived, equalTo(stateFromString("distributor:5 storage:5")));
}
@Test
- public void default_space_merges_do_not_count_towards_maintenance() {
+ void default_space_merges_do_not_count_towards_maintenance() {
Fixture f = new Fixture();
when(f.mockPendingChecker.mayHaveMergesPending(eq(defaultSpace()), anyInt())).thenReturn(true);
AnnotatedClusterState derived = f.deriver.derivedFrom(stateFromString("distributor:2 storage:2"), defaultSpace());
@@ -86,7 +86,7 @@ public class MaintenanceWhenPendingGlobalMergesTest {
}
@Test
- public void nodes_only_set_to_maintenance_when_marked_up_init_or_retiring() {
+ void nodes_only_set_to_maintenance_when_marked_up_init_or_retiring() {
Fixture f = new Fixture();
when(f.mockPendingChecker.mayHaveMergesPending(eq(globalSpace()), anyInt())).thenReturn(true);
AnnotatedClusterState derived = f.deriver.derivedFrom(stateFromString("distributor:5 storage:5 .1.s:m .2.s:r .3.s:i .4.s:d"), defaultSpace());
@@ -96,7 +96,7 @@ public class MaintenanceWhenPendingGlobalMergesTest {
}
@Test
- public void node_state_reasons_are_used_as_baseline_in_default_bucket_space_state() {
+ void node_state_reasons_are_used_as_baseline_in_default_bucket_space_state() {
Fixture f = new Fixture();
when(f.mockPendingChecker.mayHaveMergesPending(globalSpace(), 1)).thenReturn(true);
when(f.mockPendingChecker.mayHaveMergesPending(globalSpace(), 3)).thenReturn(true);
@@ -108,7 +108,7 @@ public class MaintenanceWhenPendingGlobalMergesTest {
}
@Test
- public void node_with_pending_merges_only_set_to_maintenance_if_eligible() {
+ void node_with_pending_merges_only_set_to_maintenance_if_eligible() {
Fixture f = new Fixture();
Arrays.asList(1, 2, 3).forEach(idx -> when(f.mockPendingChecker.mayHaveMergesPending(globalSpace(), idx)).thenReturn(true));
Arrays.asList(1, 2, 4).forEach(idx -> when(f.mockTransitionConstraint.maintenanceTransitionAllowed(idx)).thenReturn(false));
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MasterElectionTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MasterElectionTest.java
index 257bb54047c..ae7ffd248d6 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MasterElectionTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MasterElectionTest.java
@@ -12,10 +12,9 @@ import com.yahoo.vdslib.state.NodeState;
import com.yahoo.vdslib.state.NodeType;
import com.yahoo.vdslib.state.State;
import com.yahoo.vespa.clustercontroller.core.status.StatusHandler;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.api.extension.ExtendWith;
import java.util.ArrayList;
import java.util.List;
@@ -24,10 +23,12 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Stream;
-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.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+@ExtendWith(FleetControllerTest.CleanupZookeeperLogsOnSuccess.class)
+@Timeout(120)
public class MasterElectionTest extends FleetControllerTest {
private static final Logger log = Logger.getLogger(MasterElectionTest.class.getName());
@@ -35,12 +36,6 @@ public class MasterElectionTest extends FleetControllerTest {
private Supervisor supervisor;
private final List<FleetController> fleetControllers = new ArrayList<>();
- @Rule
- public TestRule cleanupZookeeperLogsOnSuccess = new CleanupZookeeperLogsOnSuccess();
-
- @Rule
- public Timeout globalTimeout = Timeout.seconds(120);
-
private static int defaultZkSessionTimeoutInMillis() { return 30_000; }
protected void setUpFleetController(int count, boolean useFakeTimer, FleetControllerOptions options) throws Exception {
@@ -116,7 +111,7 @@ public class MasterElectionTest extends FleetControllerTest {
}
@Test
- public void testMasterElection() throws Exception {
+ void testMasterElection() throws Exception {
startingTest("MasterElectionTest::testMasterElection");
log.log(Level.INFO, "STARTING TEST: MasterElectionTest::testMasterElection()");
FleetControllerOptions options = defaultOptions("mycluster");
@@ -135,7 +130,7 @@ public class MasterElectionTest extends FleetControllerTest {
// Too few for there to be a master at this point
for (int i = 0; i < fleetControllers.size(); ++i) {
if (fleetControllers.get(i).isRunning()) waitForCompleteCycle(i);
- assertFalse("Fleet controller " + i, fleetControllers.get(i).isMaster());
+ assertFalse(fleetControllers.get(i).isMaster(), "Fleet controller " + i);
}
StatusHandler.ContainerStatusPageServer statusPageServer = new StatusHandler.ContainerStatusPageServer();
@@ -222,7 +217,7 @@ public class MasterElectionTest extends FleetControllerTest {
}
@Test
- public void testClusterStateVersionIncreasesAcrossMasterElections() throws Exception {
+ void testClusterStateVersionIncreasesAcrossMasterElections() throws Exception {
startingTest("MasterElectionTest::testClusterStateVersionIncreasesAcrossMasterElections");
FleetControllerOptions options = defaultOptions("mycluster");
options.masterZooKeeperCooldownPeriod = 1;
@@ -243,7 +238,7 @@ public class MasterElectionTest extends FleetControllerTest {
}
@Test
- public void testVotingCorrectnessInFaceOfZKDisconnect() throws Exception {
+ void testVotingCorrectnessInFaceOfZKDisconnect() throws Exception {
startingTest("MasterElectionTest::testVotingCorrectnessInFaceOfZKDisconnect");
FleetControllerOptions options = defaultOptions("mycluster");
// "Magic" port value is in range allocated to module for testing.
@@ -264,7 +259,7 @@ public class MasterElectionTest extends FleetControllerTest {
}
@Test
- public void testZooKeeperUnavailable() throws Exception {
+ void testZooKeeperUnavailable() throws Exception {
startingTest("MasterElectionTest::testZooKeeperUnavailable");
FleetControllerOptions options = defaultOptions("mycluster");
options.masterZooKeeperCooldownPeriod = 100;
@@ -279,7 +274,7 @@ public class MasterElectionTest extends FleetControllerTest {
// No one can be master if server is unavailable
log.log(Level.INFO, "Checking master status");
for (int i = 0; i < fleetControllers.size(); ++i) {
- assertFalse("Index " + i, fleetControllers.get(i).isMaster());
+ assertFalse(fleetControllers.get(i).isMaster(), "Index " + i);
}
zooKeeperServer = new ZooKeeperTestServer();
@@ -295,7 +290,7 @@ public class MasterElectionTest extends FleetControllerTest {
}
@Test
- public void testMasterZooKeeperCooldown() throws Exception {
+ void testMasterZooKeeperCooldown() throws Exception {
startingTest("MasterElectionTest::testMasterZooKeeperCooldown");
FleetControllerOptions options = defaultOptions("mycluster");
options.masterZooKeeperCooldownPeriod = 3600 * 1000; // An hour
@@ -343,7 +338,7 @@ public class MasterElectionTest extends FleetControllerTest {
}
@Test
- public void testGetMaster() throws Exception {
+ void testGetMaster() throws Exception {
startingTest("MasterElectionTest::testGetMaster");
FleetControllerOptions options = defaultOptions("mycluster");
options.masterZooKeeperCooldownPeriod = 3600 * 1000; // An hour
@@ -364,33 +359,33 @@ public class MasterElectionTest extends FleetControllerTest {
Request req = new Request("getMaster");
- for (int nodeIndex = 0; nodeIndex<3; ++nodeIndex) {
+ for (int nodeIndex = 0; nodeIndex < 3; ++nodeIndex) {
for (int retry = 0; retry < FleetControllerTest.timeoutS * 10; ++retry) {
req = new Request("getMaster");
connections.get(nodeIndex).invokeSync(req, FleetControllerTest.timeoutS);
- assertFalse(req.errorMessage(), req.isError());
+ assertFalse(req.isError(), req.errorMessage());
if (req.returnValues().get(0).asInt32() == 0 &&
- req.returnValues().get(1).asString().equals("All 3 nodes agree that 0 is current master.")) {
+ req.returnValues().get(1).asString().equals("All 3 nodes agree that 0 is current master.")) {
break;
}
}
- assertEquals(req.toString(), 0, req.returnValues().get(0).asInt32());
- assertEquals(req.toString(), "All 3 nodes agree that 0 is current master.", req.returnValues().get(1).asString());
+ assertEquals(0, req.returnValues().get(0).asInt32(), req.toString());
+ assertEquals("All 3 nodes agree that 0 is current master.", req.returnValues().get(1).asString(), req.toString());
}
log.log(Level.INFO, "SHUTTING DOWN FLEET CONTROLLER 0");
fleetControllers.get(0).shutdown();
- // Wait until fc 1 & 2 votes for node 1
+ // Wait until fc 1 & 2 votes for node 1
waitForCompleteCycle(1);
waitForCompleteCycle(2);
- // 5 minutes is not long enough period to wait before letting this node be master.
+ // 5 minutes is not long enough period to wait before letting this node be master.
timer.advanceTime(300 * 1000); // 5 minutes
- int[] remainingNodes = { 1, 2 };
+ int[] remainingNodes = {1, 2};
waitForMasterReason(
"2 of 3 nodes agree 1 should be master, but old master cooldown period of 3600000 ms has not passed yet. To ensure it has got time to realize it is no longer master before we elect a new one, currently there is no master.",
-1, connections, remainingNodes);
- // Verify that fc 1 is not master, and the correct reasons for why not
+ // Verify that fc 1 is not master, and the correct reasons for why not
assertFalse(fleetControllers.get(1).isMaster());
// But after an hour it should become one.
@@ -399,31 +394,31 @@ public class MasterElectionTest extends FleetControllerTest {
req = new Request("getMaster");
connections.get(0).invokeSync(req, FleetControllerTest.timeoutS);
- assertEquals(req.toString(), 104, req.errorCode());
- assertEquals(req.toString(), "Connection error", req.errorMessage());
+ assertEquals(104, req.errorCode(), req.toString());
+ assertEquals("Connection error", req.errorMessage(), req.toString());
- for (int i=0; i<FleetControllerTest.timeoutS * 10; ++i) {
+ for (int i = 0; i < FleetControllerTest.timeoutS * 10; ++i) {
req = new Request("getMaster");
connections.get(1).invokeSync(req, FleetControllerTest.timeoutS);
- assertFalse(req.errorMessage(), req.isError());
+ assertFalse(req.isError(), req.errorMessage());
if (req.returnValues().get(0).asInt32() != -1) break;
- // We may have bad timing causing node not to have realized it is master yet
+ // We may have bad timing causing node not to have realized it is master yet
}
- assertEquals(req.toString(), 1, req.returnValues().get(0).asInt32());
- assertEquals(req.toString(), "2 of 3 nodes agree 1 is master.", req.returnValues().get(1).asString());
+ assertEquals(1, req.returnValues().get(0).asInt32(), req.toString());
+ assertEquals("2 of 3 nodes agree 1 is master.", req.returnValues().get(1).asString(), req.toString());
- for (int i=0; i<FleetControllerTest.timeoutS * 10; ++i) {
+ for (int i = 0; i < FleetControllerTest.timeoutS * 10; ++i) {
req = new Request("getMaster");
connections.get(2).invokeSync(req, FleetControllerTest.timeoutS);
- assertFalse(req.errorMessage(), req.isError());
+ assertFalse(req.isError(), req.errorMessage());
if (req.returnValues().get(0).asInt32() != -1) break;
}
- assertEquals(req.toString(), 1, req.returnValues().get(0).asInt32());
- assertEquals(req.toString(), "2 of 3 nodes agree 1 is master.", req.returnValues().get(1).asString());
+ assertEquals(1, req.returnValues().get(0).asInt32(), req.toString());
+ assertEquals("2 of 3 nodes agree 1 is master.", req.returnValues().get(1).asString(), req.toString());
}
@Test
- public void testReconfigure() throws Exception {
+ void testReconfigure() throws Exception {
startingTest("MasterElectionTest::testReconfigure");
FleetControllerOptions options = defaultOptions("mycluster");
options.masterZooKeeperCooldownPeriod = 1;
@@ -431,7 +426,7 @@ public class MasterElectionTest extends FleetControllerTest {
waitForMaster(0);
FleetControllerOptions newOptions = options.clone();
- for (int i=0; i<fleetControllers.size(); ++i) {
+ for (int i = 0; i < fleetControllers.size(); ++i) {
FleetControllerOptions nodeOptions = adjustConfig(newOptions, i, fleetControllers.size());
fleetControllers.get(i).updateOptions(nodeOptions);
}
@@ -448,7 +443,7 @@ public class MasterElectionTest extends FleetControllerTest {
* risk rolling back the version number in the face of a reelection.
*/
@Test
- public void cluster_state_version_written_to_zookeeper_even_with_empty_send_set() throws Exception {
+ void cluster_state_version_written_to_zookeeper_even_with_empty_send_set() throws Exception {
startingTest("MasterElectionTest::cluster_state_version_written_to_zookeeper_even_with_empty_send_set");
FleetControllerOptions options = defaultOptions("mycluster");
options.masterZooKeeperCooldownPeriod = 1;
@@ -474,7 +469,7 @@ public class MasterElectionTest extends FleetControllerTest {
n.disconnectImmediately();
waitForCompleteCycle(0);
});
- setWantedState(this.nodes.get(2*10 - 1), State.MAINTENANCE, "bar");
+ setWantedState(this.nodes.get(2 * 10 - 1), State.MAINTENANCE, "bar");
waitForCompleteCycle(0);
// This receives the version number of the highest _working_ cluster state, with
@@ -494,7 +489,7 @@ public class MasterElectionTest extends FleetControllerTest {
}
@Test
- public void previously_published_state_is_taken_into_account_for_default_space_when_controller_bootstraps() throws Exception {
+ void previously_published_state_is_taken_into_account_for_default_space_when_controller_bootstraps() throws Exception {
startingTest("MasterElectionTest::previously_published_state_is_taken_into_account_for_default_space_when_controller_bootstraps");
FleetControllerOptions options = defaultOptions("mycluster");
options.clusterHasGlobalDocumentTypes = true;
@@ -537,7 +532,7 @@ public class MasterElectionTest extends FleetControllerTest {
}
@Test
- public void default_space_nodes_not_marked_as_maintenance_when_cluster_has_no_global_document_types() throws Exception {
+ void default_space_nodes_not_marked_as_maintenance_when_cluster_has_no_global_document_types() throws Exception {
startingTest("MasterElectionTest::default_space_nodes_not_marked_as_maintenance_when_cluster_has_no_global_document_types");
FleetControllerOptions options = defaultOptions("mycluster");
options.clusterHasGlobalDocumentTypes = false;
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MetricReporterTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MetricReporterTest.java
index 4cd2fcdfbd5..a6defaee7fe 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MetricReporterTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MetricReporterTest.java
@@ -4,7 +4,7 @@ package com.yahoo.vespa.clustercontroller.core;
import com.yahoo.vdslib.state.ClusterState;
import com.yahoo.vespa.clustercontroller.core.matchers.HasMetricContext;
import com.yahoo.vespa.clustercontroller.utils.util.MetricReporter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Map;
@@ -57,7 +57,7 @@ public class MetricReporterTest {
}
@Test
- public void metrics_are_emitted_for_different_node_state_counts() {
+ void metrics_are_emitted_for_different_node_state_counts() {
Fixture f = new Fixture();
f.metricUpdater.updateClusterStateMetrics(f.clusterFixture.cluster(),
ClusterState.stateFromString("distributor:10 .1.s:d storage:9 .1.s:d .2.s:m .4.s:d"),
@@ -90,28 +90,28 @@ public class MetricReporterTest {
}
@Test
- public void metrics_are_emitted_for_partial_node_availability_ratio() {
+ void metrics_are_emitted_for_partial_node_availability_ratio() {
// Only Up, Init, Retired and Maintenance are counted as available states
doTestRatiosInState("distributor:10 .1.s:d storage:9 .1.s:d .2.s:m .4.s:r .5.s:i .6.s:s", 0.9, 0.7);
}
@Test
- public void metrics_are_emitted_for_full_node_availability_ratio() {
+ void metrics_are_emitted_for_full_node_availability_ratio() {
doTestRatiosInState("distributor:10 storage:10", 1.0, 1.0);
}
@Test
- public void metrics_are_emitted_for_zero_node_availability_ratio() {
+ void metrics_are_emitted_for_zero_node_availability_ratio() {
doTestRatiosInState("cluster:d", 0.0, 0.0);
}
@Test
- public void maintenance_mode_is_counted_as_available() {
+ void maintenance_mode_is_counted_as_available() {
doTestRatiosInState("distributor:10 storage:10 .0.s:m", 1.0, 1.0);
}
@Test
- public void metrics_are_emitted_for_resource_usage() {
+ void metrics_are_emitted_for_resource_usage() {
Fixture f = new Fixture();
f.metricUpdater.updateClusterStateMetrics(f.clusterFixture.cluster(),
ClusterState.stateFromString("distributor:10 storage:10"),
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NoZooKeeperTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NoZooKeeperTest.java
index bd1ffac089c..62a49ecf969 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NoZooKeeperTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NoZooKeeperTest.java
@@ -1,13 +1,14 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.core;
-import org.junit.Test;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class NoZooKeeperTest extends FleetControllerTest {
@Test
- public void testWantedStatesInZooKeeper() throws Exception {
+ void testWantedStatesInZooKeeper() throws Exception {
startingTest("NoZooKeeperTest::testWantedStatesInZooKeeper");
FleetControllerOptions options = defaultOptions("mycluster");
options.zooKeeperServerAddress = null;
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeInfoTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeInfoTest.java
index 129c70d1d29..4b068d107bf 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeInfoTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeInfoTest.java
@@ -4,16 +4,14 @@ package com.yahoo.vespa.clustercontroller.core;
import com.yahoo.vdslib.state.Node;
import com.yahoo.vdslib.state.NodeType;
import com.yahoo.vdslib.state.State;
-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.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
public class NodeInfoTest {
@Test
- public void unstable_init_flag_is_initially_clear() {
+ void unstable_init_flag_is_initially_clear() {
ClusterFixture fixture = ClusterFixture.forFlatCluster(3);
final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 1));
assertFalse(nodeInfo.recentlyObservedUnstableDuringInit());
@@ -26,7 +24,7 @@ public class NodeInfoTest {
}
@Test
- public void down_edge_during_init_state_marks_as_unstable_init() {
+ void down_edge_during_init_state_marks_as_unstable_init() {
ClusterFixture fixture = fixtureWithNodeMarkedAsUnstableInit(1);
final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 1));
@@ -34,7 +32,7 @@ public class NodeInfoTest {
}
@Test
- public void stopping_edge_during_init_does_not_mark_as_unstable_init() {
+ void stopping_edge_during_init_does_not_mark_as_unstable_init() {
ClusterFixture fixture = ClusterFixture.forFlatCluster(3).reportStorageNodeState(0, State.INITIALIZING);
fixture.reportStorageNodeState(0, State.STOPPING);
final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 0));
@@ -48,7 +46,7 @@ public class NodeInfoTest {
* from haunting a now stable node.
*/
@Test
- public void zeroing_crash_count_resets_unstable_init_flag() {
+ void zeroing_crash_count_resets_unstable_init_flag() {
ClusterFixture fixture = fixtureWithNodeMarkedAsUnstableInit(1);
final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 1));
@@ -61,7 +59,7 @@ public class NodeInfoTest {
* further instabilities and should not clear the unstable init flag.
*/
@Test
- public void non_zero_crash_count_update_does_not_reset_unstable_init_flag() {
+ void non_zero_crash_count_update_does_not_reset_unstable_init_flag() {
ClusterFixture fixture = fixtureWithNodeMarkedAsUnstableInit(1);
final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 1));
@@ -70,7 +68,7 @@ public class NodeInfoTest {
}
@Test
- public void non_zero_crash_count_does_not_implicitly_set_unstable_init_flag() {
+ void non_zero_crash_count_does_not_implicitly_set_unstable_init_flag() {
ClusterFixture fixture = ClusterFixture.forFlatCluster(3);
final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 1));
@@ -79,7 +77,7 @@ public class NodeInfoTest {
}
@Test
- public void down_wanted_state_overrides_config_retired_state() {
+ void down_wanted_state_overrides_config_retired_state() {
ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.markNodeAsConfigRetired(1)
.proposeStorageNodeWantedState(1, State.DOWN);
@@ -89,7 +87,7 @@ public class NodeInfoTest {
}
@Test
- public void maintenance_wanted_state_overrides_config_retired_state() {
+ void maintenance_wanted_state_overrides_config_retired_state() {
ClusterFixture fixture = ClusterFixture.forFlatCluster(3)
.markNodeAsConfigRetired(1)
.proposeStorageNodeWantedState(1, State.MAINTENANCE);
@@ -99,7 +97,7 @@ public class NodeInfoTest {
}
@Test
- public void retired_state_overrides_default_up_wanted_state() {
+ void retired_state_overrides_default_up_wanted_state() {
final ClusterFixture fixture = ClusterFixture.forFlatCluster(3).markNodeAsConfigRetired(1);
NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 1));
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeSlobrokConfigurationMembershipTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeSlobrokConfigurationMembershipTest.java
index ea539cc13e0..69ddf8e2c02 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeSlobrokConfigurationMembershipTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeSlobrokConfigurationMembershipTest.java
@@ -2,12 +2,12 @@
package com.yahoo.vespa.clustercontroller.core;
import com.yahoo.vdslib.distribution.ConfiguredNode;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Set;
import java.util.TreeSet;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class NodeSlobrokConfigurationMembershipTest extends FleetControllerTest {
@@ -32,13 +32,13 @@ public class NodeSlobrokConfigurationMembershipTest extends FleetControllerTest
}
@Test
- public void testSlobrokNodeOutsideConfiguredIndexSetIsNotIncludedInCluster() throws Exception {
+ void testSlobrokNodeOutsideConfiguredIndexSetIsNotIncludedInCluster() throws Exception {
setUpClusterWithForeignNode(nodeIndices, foreignNode);
waitForStateExcludingNodeSubset("version:\\d+ distributor:4 storage:4", asIntSet(foreignNode));
}
@Test
- public void testNodeSetReconfigurationForcesFreshSlobrokFetch() throws Exception {
+ void testNodeSetReconfigurationForcesFreshSlobrokFetch() throws Exception {
setUpClusterWithForeignNode(nodeIndices, foreignNode);
waitForStateExcludingNodeSubset("version:\\d+ distributor:4 storage:4", asIntSet(foreignNode));
@@ -53,7 +53,7 @@ public class NodeSlobrokConfigurationMembershipTest extends FleetControllerTest
}
@Test
- public void test_removed_retired_node_is_not_included_in_state() throws Exception {
+ void test_removed_retired_node_is_not_included_in_state() throws Exception {
final Set<ConfiguredNode> configuredNodes = asConfiguredNodes(nodeIndices);
FleetControllerOptions options = optionsForConfiguredNodes(configuredNodes);
setUpFleetController(true, options);
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeStateChangeCheckerTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeStateChangeCheckerTest.java
index 87e102c67c1..6af852aa3ed 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeStateChangeCheckerTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeStateChangeCheckerTest.java
@@ -13,17 +13,14 @@ import com.yahoo.vdslib.state.State;
import com.yahoo.vespa.clustercontroller.core.hostinfo.HostInfo;
import com.yahoo.vespa.clustercontroller.utils.staterestapi.requests.SetUnitStateRequest;
import com.yahoo.vespa.config.content.StorDistributionConfig;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -107,7 +104,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testCanUpgradeForce() {
+ void testCanUpgradeForce() {
NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(createCluster(createNodes(1)));
NodeState newState = new NodeState(NodeType.STORAGE, State.INITIALIZING);
NodeStateChangeChecker.Result result = nodeStateChangeChecker.evaluateTransition(
@@ -118,7 +115,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testDeniedInMoratorium() {
+ void testDeniedInMoratorium() {
ContentCluster cluster = createCluster(createNodes(4));
NodeStateChangeChecker nodeStateChangeChecker = new NodeStateChangeChecker(
requiredRedundancy, noopVisiting, cluster.clusterInfo(), true);
@@ -131,7 +128,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testUnknownStorageNode() {
+ void testUnknownStorageNode() {
ContentCluster cluster = createCluster(createNodes(4));
NodeStateChangeChecker nodeStateChangeChecker = new NodeStateChangeChecker(
requiredRedundancy, noopVisiting, cluster.clusterInfo(), false);
@@ -144,7 +141,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testSafeMaintenanceDisallowedWhenOtherStorageNodeInFlatClusterIsSuspended() {
+ void testSafeMaintenanceDisallowedWhenOtherStorageNodeInFlatClusterIsSuspended() {
// Nodes 0-3, storage node 0 being in maintenance with "Orchestrator" description.
ContentCluster cluster = createCluster(createNodes(4));
cluster.clusterInfo().getStorageNodeInfo(0).setWantedState(new NodeState(NodeType.STORAGE, State.MAINTENANCE).setDescription("Orchestrator"));
@@ -164,7 +161,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testSafeMaintenanceDisallowedWhenOtherDistributorInFlatClusterIsSuspended() {
+ void testSafeMaintenanceDisallowedWhenOtherDistributorInFlatClusterIsSuspended() {
// Nodes 0-3, storage node 0 being in maintenance with "Orchestrator" description.
ContentCluster cluster = createCluster(createNodes(4));
cluster.clusterInfo().getDistributorNodeInfo(0)
@@ -185,7 +182,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testSafeMaintenanceDisallowedWhenDistributorInGroupIsDown() {
+ void testSafeMaintenanceDisallowedWhenDistributorInGroupIsDown() {
// Nodes 0-3, distributor 0 being in maintenance with "Orchestrator" description.
// 2 groups: nodes 0-1 is group 0, 2-3 is group 1.
ContentCluster cluster = createCluster(createNodes(4));
@@ -214,13 +211,13 @@ public class NodeStateChangeCheckerTest {
NodeStateChangeChecker.Result result = nodeStateChangeChecker.evaluateTransition(
new Node(NodeType.STORAGE, 1), clusterStateWith0InMaintenance,
SetUnitStateRequest.Condition.SAFE, UP_NODE_STATE, MAINTENANCE_NODE_STATE);
- assertFalse(result.getReason(), result.settingWantedStateIsAllowed());
+ assertFalse(result.settingWantedStateIsAllowed(), result.getReason());
assertEquals("Another distributor wants state DOWN: 0", result.getReason());
}
}
@Test
- public void testSafeMaintenanceWhenOtherStorageNodeInGroupIsSuspended() {
+ void testSafeMaintenanceWhenOtherStorageNodeInGroupIsSuspended() {
// Nodes 0-3, storage node 0 being in maintenance with "Orchestrator" description.
// 2 groups: nodes 0-1 is group 0, 2-3 is group 1.
ContentCluster cluster = createCluster(createNodes(4));
@@ -249,7 +246,7 @@ public class NodeStateChangeCheckerTest {
NodeStateChangeChecker.Result result = nodeStateChangeChecker.evaluateTransition(
new Node(NodeType.STORAGE, 1), clusterStateWith0InMaintenance,
SetUnitStateRequest.Condition.SAFE, UP_NODE_STATE, MAINTENANCE_NODE_STATE);
- assertTrue(result.getReason(), result.settingWantedStateIsAllowed());
+ assertTrue(result.settingWantedStateIsAllowed(), result.getReason());
assertFalse(result.wantedStateAlreadySet());
}
}
@@ -295,7 +292,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testSafeSetStateDistributors() {
+ void testSafeSetStateDistributors() {
NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(createCluster(createNodes(1)));
NodeStateChangeChecker.Result result = nodeStateChangeChecker.evaluateTransition(
nodeDistributor, defaultAllUpClusterState(), SetUnitStateRequest.Condition.SAFE,
@@ -306,7 +303,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testCanUpgradeSafeMissingStorage() {
+ void testCanUpgradeSafeMissingStorage() {
// Create a content cluster with 4 nodes, and storage node with index 3 down.
ContentCluster cluster = createCluster(createNodes(4));
setAllNodesUp(cluster, HostInfo.createHostInfo(createDistributorHostInfo(4, 5, 6)));
@@ -327,14 +324,14 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testCanUpgradeStorageSafeYes() {
+ void testCanUpgradeStorageSafeYes() {
NodeStateChangeChecker.Result result = transitionToMaintenanceWithNoStorageNodesDown();
assertTrue(result.settingWantedStateIsAllowed());
assertFalse(result.wantedStateAlreadySet());
}
@Test
- public void testSetUpFailsIfReportedIsDown() {
+ void testSetUpFailsIfReportedIsDown() {
ContentCluster cluster = createCluster(createNodes(4));
NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(cluster);
// Not setting nodes up -> all are down
@@ -349,7 +346,7 @@ public class NodeStateChangeCheckerTest {
// A node may be reported as Up but have a generated state of Down if it's part of
// nodes taken down implicitly due to a group having too low node availability.
@Test
- public void testSetUpSucceedsIfReportedIsUpButGeneratedIsDown() {
+ void testSetUpSucceedsIfReportedIsUpButGeneratedIsDown() {
ContentCluster cluster = createCluster(createNodes(4));
NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(cluster);
@@ -367,7 +364,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testCanSetUpEvenIfOldWantedStateIsDown() {
+ void testCanSetUpEvenIfOldWantedStateIsDown() {
ContentCluster cluster = createCluster(createNodes(4));
NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(cluster);
setAllNodesUp(cluster, HostInfo.createHostInfo(createDistributorHostInfo(4, 3, 6)));
@@ -380,7 +377,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testCanUpgradeStorageSafeNo() {
+ void testCanUpgradeStorageSafeNo() {
ContentCluster cluster = createCluster(createNodes(4));
NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(cluster);
setAllNodesUp(cluster, HostInfo.createHostInfo(createDistributorHostInfo(4, 3, 6)));
@@ -395,7 +392,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testCanUpgradeIfMissingMinReplicationFactor() {
+ void testCanUpgradeIfMissingMinReplicationFactor() {
ContentCluster cluster = createCluster(createNodes(4));
NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(cluster);
setAllNodesUp(cluster, HostInfo.createHostInfo(createDistributorHostInfo(4, 3, 6)));
@@ -408,7 +405,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testCanUpgradeIfStorageNodeMissingFromNodeInfo() {
+ void testCanUpgradeIfStorageNodeMissingFromNodeInfo() {
ContentCluster cluster = createCluster(createNodes(4));
NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(cluster);
String hostInfo = "{\n" +
@@ -432,7 +429,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testMissingDistributorState() {
+ void testMissingDistributorState() {
ContentCluster cluster = createCluster(createNodes(4));
NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(cluster);
cluster.clusterInfo().getStorageNodeInfo(1).setReportedState(new NodeState(NodeType.STORAGE, State.UP), 0);
@@ -460,20 +457,20 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testSettingUpWhenUpCausesAlreadySet() {
+ void testSettingUpWhenUpCausesAlreadySet() {
NodeStateChangeChecker.Result result = transitionToSameState(State.UP, "foo", "bar");
assertTrue(result.wantedStateAlreadySet());
}
@Test
- public void testSettingAlreadySetState() {
+ void testSettingAlreadySetState() {
NodeStateChangeChecker.Result result = transitionToSameState("foo", "foo");
assertFalse(result.settingWantedStateIsAllowed());
assertTrue(result.wantedStateAlreadySet());
}
@Test
- public void testDifferentDescriptionImpliesDenied() {
+ void testDifferentDescriptionImpliesDenied() {
NodeStateChangeChecker.Result result = transitionToSameState("foo", "bar");
assertFalse(result.settingWantedStateIsAllowed());
assertFalse(result.wantedStateAlreadySet());
@@ -526,28 +523,28 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testCanUpgradeWhenAllUp() {
+ void testCanUpgradeWhenAllUp() {
NodeStateChangeChecker.Result result = transitionToMaintenanceWithNoStorageNodesDown();
assertTrue(result.settingWantedStateIsAllowed());
assertFalse(result.wantedStateAlreadySet());
}
@Test
- public void testCanUpgradeWhenAllUpOrRetired() {
+ void testCanUpgradeWhenAllUpOrRetired() {
NodeStateChangeChecker.Result result = transitionToMaintenanceWithNoStorageNodesDown();
assertTrue(result.settingWantedStateIsAllowed());
assertFalse(result.wantedStateAlreadySet());
}
@Test
- public void testCanUpgradeWhenStorageIsDown() {
+ void testCanUpgradeWhenStorageIsDown() {
NodeStateChangeChecker.Result result = transitionToMaintenanceWithOneStorageNodeDown(nodeStorage.getIndex());
assertTrue(result.settingWantedStateIsAllowed());
assertFalse(result.wantedStateAlreadySet());
}
@Test
- public void testCannotUpgradeWhenOtherStorageIsDown() {
+ void testCannotUpgradeWhenOtherStorageIsDown() {
int otherIndex = 2;
// If this fails, just set otherIndex to some other valid index.
assertNotEquals(nodeStorage.getIndex(), otherIndex);
@@ -559,7 +556,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testNodeRatioRequirementConsidersGeneratedNodeStates() {
+ void testNodeRatioRequirementConsidersGeneratedNodeStates() {
ContentCluster cluster = createCluster(createNodes(4));
NodeStateChangeChecker nodeStateChangeChecker = createChangeChecker(cluster);
@@ -581,7 +578,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testDownDisallowedByNonRetiredState() {
+ void testDownDisallowedByNonRetiredState() {
NodeStateChangeChecker.Result result = evaluateDownTransition(
defaultAllUpClusterState(),
State.UP,
@@ -593,7 +590,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testDownDisallowedByBuckets() {
+ void testDownDisallowedByBuckets() {
NodeStateChangeChecker.Result result = evaluateDownTransition(
retiredClusterStateSuffix(),
State.UP,
@@ -605,7 +602,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testDownDisallowedByReportedState() {
+ void testDownDisallowedByReportedState() {
NodeStateChangeChecker.Result result = evaluateDownTransition(
retiredClusterStateSuffix(),
State.INITIALIZING,
@@ -617,7 +614,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testDownDisallowedByVersionMismatch() {
+ void testDownDisallowedByVersionMismatch() {
NodeStateChangeChecker.Result result = evaluateDownTransition(
retiredClusterStateSuffix(),
State.UP,
@@ -630,7 +627,7 @@ public class NodeStateChangeCheckerTest {
}
@Test
- public void testAllowedToSetDown() {
+ void testAllowedToSetDown() {
NodeStateChangeChecker.Result result = evaluateDownTransition(
retiredClusterStateSuffix(),
State.UP,
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ResourceExhaustionCalculatorTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ResourceExhaustionCalculatorTest.java
index e136ddfa72d..24945d0d261 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ResourceExhaustionCalculatorTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ResourceExhaustionCalculatorTest.java
@@ -2,7 +2,7 @@
package com.yahoo.vespa.clustercontroller.core;
import com.yahoo.vdslib.state.State;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static com.yahoo.vespa.clustercontroller.core.ClusterFixture.storageNode;
import static com.yahoo.vespa.clustercontroller.core.FeedBlockUtil.createFixtureWithReportedUsages;
@@ -11,27 +11,24 @@ import static com.yahoo.vespa.clustercontroller.core.FeedBlockUtil.forNode;
import static com.yahoo.vespa.clustercontroller.core.FeedBlockUtil.mapOf;
import static com.yahoo.vespa.clustercontroller.core.FeedBlockUtil.setOf;
import static com.yahoo.vespa.clustercontroller.core.FeedBlockUtil.usage;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
public class ResourceExhaustionCalculatorTest {
@Test
- public void no_feed_block_returned_when_no_resources_lower_than_limit() {
+ void no_feed_block_returned_when_no_resources_lower_than_limit() {
var calc = new ResourceExhaustionCalculator(true, mapOf(usage("disk", 0.5), usage("memory", 0.8)));
var cf = createFixtureWithReportedUsages(forNode(1, usage("disk", 0.49), usage("memory", 0.79)),
- forNode(2, usage("disk", 0.4), usage("memory", 0.6)));
+ forNode(2, usage("disk", 0.4), usage("memory", 0.6)));
var feedBlock = calc.inferContentClusterFeedBlockOrNull(cf.cluster().getNodeInfos());
assertNull(feedBlock);
}
@Test
- public void feed_block_returned_when_single_resource_beyond_limit() {
+ void feed_block_returned_when_single_resource_beyond_limit() {
var calc = new ResourceExhaustionCalculator(true, mapOf(usage("disk", 0.5), usage("memory", 0.8)));
var cf = createFixtureWithReportedUsages(forNode(1, usage("disk", 0.51), usage("memory", 0.79)),
- forNode(2, usage("disk", 0.4), usage("memory", 0.6)));
+ forNode(2, usage("disk", 0.4), usage("memory", 0.6)));
var feedBlock = calc.inferContentClusterFeedBlockOrNull(cf.cluster().getNodeInfos());
assertNotNull(feedBlock);
assertTrue(feedBlock.blockFeedInCluster());
@@ -39,10 +36,10 @@ public class ResourceExhaustionCalculatorTest {
}
@Test
- public void feed_block_description_can_contain_optional_name_component() {
+ void feed_block_description_can_contain_optional_name_component() {
var calc = new ResourceExhaustionCalculator(true, mapOf(usage("disk", 0.5), usage("memory", 0.8)));
var cf = createFixtureWithReportedUsages(forNode(1, usage("disk", "a-fancy-disk", 0.51), usage("memory", 0.79)),
- forNode(2, usage("disk", 0.4), usage("memory", 0.6)));
+ forNode(2, usage("disk", 0.4), usage("memory", 0.6)));
var feedBlock = calc.inferContentClusterFeedBlockOrNull(cf.cluster().getNodeInfos());
assertNotNull(feedBlock);
assertTrue(feedBlock.blockFeedInCluster());
@@ -50,80 +47,80 @@ public class ResourceExhaustionCalculatorTest {
}
@Test
- public void missing_or_malformed_rpc_addresses_are_emitted_as_unknown_hostnames() {
+ void missing_or_malformed_rpc_addresses_are_emitted_as_unknown_hostnames() {
var calc = new ResourceExhaustionCalculator(true, mapOf(usage("disk", 0.5), usage("memory", 0.8)));
var cf = createFixtureWithReportedUsages(forNode(1, usage("disk", 0.51), usage("memory", 0.79)),
- forNode(2, usage("disk", 0.4), usage("memory", 0.85)));
+ forNode(2, usage("disk", 0.4), usage("memory", 0.85)));
cf.cluster().getNodeInfo(storageNode(1)).setRpcAddress(null);
cf.cluster().getNodeInfo(storageNode(2)).setRpcAddress("max mekker");
var feedBlock = calc.inferContentClusterFeedBlockOrNull(cf.cluster().getNodeInfos());
assertNotNull(feedBlock);
assertTrue(feedBlock.blockFeedInCluster());
assertEquals("disk on node 1 [unknown hostname] (0.510 > 0.500), " +
- "memory on node 2 [unknown hostname] (0.850 > 0.800)", feedBlock.getDescription());
+ "memory on node 2 [unknown hostname] (0.850 > 0.800)", feedBlock.getDescription());
}
@Test
- public void feed_block_returned_when_multiple_resources_beyond_limit() {
+ void feed_block_returned_when_multiple_resources_beyond_limit() {
var calc = new ResourceExhaustionCalculator(true, mapOf(usage("disk", 0.4), usage("memory", 0.8)));
var cf = createFixtureWithReportedUsages(forNode(1, usage("disk", 0.51), usage("memory", 0.85)),
- forNode(2, usage("disk", 0.45), usage("memory", 0.6)));
+ forNode(2, usage("disk", 0.45), usage("memory", 0.6)));
var feedBlock = calc.inferContentClusterFeedBlockOrNull(cf.cluster().getNodeInfos());
assertNotNull(feedBlock);
assertTrue(feedBlock.blockFeedInCluster());
assertEquals("disk on node 1 [storage.1.local] (0.510 > 0.400), " +
- "memory on node 1 [storage.1.local] (0.850 > 0.800), " +
- "disk on node 2 [storage.2.local] (0.450 > 0.400)",
- feedBlock.getDescription());
+ "memory on node 1 [storage.1.local] (0.850 > 0.800), " +
+ "disk on node 2 [storage.2.local] (0.450 > 0.400)",
+ feedBlock.getDescription());
}
@Test
- public void feed_block_description_is_bounded_in_number_of_described_resources() {
+ void feed_block_description_is_bounded_in_number_of_described_resources() {
var calc = new ResourceExhaustionCalculator(true, mapOf(usage("disk", 0.4), usage("memory", 0.8)));
var cf = createFixtureWithReportedUsages(forNode(1, usage("disk", 0.51), usage("memory", 0.85)),
- forNode(2, usage("disk", 0.45), usage("memory", 0.6)),
- forNode(3, usage("disk", 0.6), usage("memory", 0.9)));
+ forNode(2, usage("disk", 0.45), usage("memory", 0.6)),
+ forNode(3, usage("disk", 0.6), usage("memory", 0.9)));
var feedBlock = calc.inferContentClusterFeedBlockOrNull(cf.cluster().getNodeInfos());
assertNotNull(feedBlock);
assertTrue(feedBlock.blockFeedInCluster());
assertEquals("disk on node 1 [storage.1.local] (0.510 > 0.400), " +
- "memory on node 1 [storage.1.local] (0.850 > 0.800), " +
- "disk on node 2 [storage.2.local] (0.450 > 0.400) (... and 2 more)",
- feedBlock.getDescription());
+ "memory on node 1 [storage.1.local] (0.850 > 0.800), " +
+ "disk on node 2 [storage.2.local] (0.450 > 0.400) (... and 2 more)",
+ feedBlock.getDescription());
}
@Test
- public void no_feed_block_returned_when_feed_block_disabled() {
+ void no_feed_block_returned_when_feed_block_disabled() {
var calc = new ResourceExhaustionCalculator(false, mapOf(usage("disk", 0.5), usage("memory", 0.8)));
var cf = createFixtureWithReportedUsages(forNode(1, usage("disk", 0.51), usage("memory", 0.79)),
- forNode(2, usage("disk", 0.4), usage("memory", 0.6)));
+ forNode(2, usage("disk", 0.4), usage("memory", 0.6)));
var feedBlock = calc.inferContentClusterFeedBlockOrNull(cf.cluster().getNodeInfos());
assertNull(feedBlock);
}
@Test
- public void retain_node_feed_block_status_when_within_hysteresis_window_limit_crossed_edge_case() {
+ void retain_node_feed_block_status_when_within_hysteresis_window_limit_crossed_edge_case() {
var curFeedBlock = ClusterStateBundle.FeedBlock.blockedWith("foo", setOf(exhaustion(1, "memory", 0.51)));
var calc = new ResourceExhaustionCalculator(true, mapOf(usage("disk", 0.5), usage("memory", 0.5)), curFeedBlock, 0.1);
// Node 1 goes from 0.51 to 0.49, crossing the 0.5 threshold. Should still be blocked.
// Node 2 is at 0.49 but was not previously blocked and should not be blocked now either.
var cf = createFixtureWithReportedUsages(forNode(1, usage("disk", 0.3), usage("memory", 0.49)),
- forNode(2, usage("disk", 0.3), usage("memory", 0.49)));
+ forNode(2, usage("disk", 0.3), usage("memory", 0.49)));
var feedBlock = calc.inferContentClusterFeedBlockOrNull(cf.cluster().getNodeInfos());
assertNotNull(feedBlock);
// TODO should we not change the limits themselves? Explicit mention of hysteresis state?
assertEquals("memory on node 1 [storage.1.local] (0.490 > 0.400)",
- feedBlock.getDescription());
+ feedBlock.getDescription());
}
@Test
- public void retain_node_feed_block_status_when_within_hysteresis_window_under_limit_edge_case() {
+ void retain_node_feed_block_status_when_within_hysteresis_window_under_limit_edge_case() {
var curFeedBlock = ClusterStateBundle.FeedBlock.blockedWith("foo", setOf(exhaustion(1, "memory", 0.49)));
var calc = new ResourceExhaustionCalculator(true, mapOf(usage("disk", 0.5), usage("memory", 0.5)), curFeedBlock, 0.1);
// Node 1 goes from 0.49 to 0.48, NOT crossing the 0.5 threshold. Should still be blocked.
// Node 2 is at 0.49 but was not previously blocked and should not be blocked now either.
var cf = createFixtureWithReportedUsages(forNode(1, usage("disk", 0.3), usage("memory", 0.48)),
- forNode(2, usage("disk", 0.3), usage("memory", 0.49)));
+ forNode(2, usage("disk", 0.3), usage("memory", 0.49)));
var feedBlock = calc.inferContentClusterFeedBlockOrNull(cf.cluster().getNodeInfos());
assertNotNull(feedBlock);
assertEquals("memory on node 1 [storage.1.local] (0.480 > 0.400)",
@@ -131,22 +128,22 @@ public class ResourceExhaustionCalculatorTest {
}
@Test
- public void retained_node_feed_block_cleared_once_hysteresis_threshold_is_passed() {
+ void retained_node_feed_block_cleared_once_hysteresis_threshold_is_passed() {
var curFeedBlock = ClusterStateBundle.FeedBlock.blockedWith("foo", setOf(exhaustion(1, "memory", 0.48)));
var calc = new ResourceExhaustionCalculator(true, mapOf(usage("disk", 0.5), usage("memory", 0.5)), curFeedBlock, 0.1);
// Node 1 goes from 0.48 to 0.39. Should be unblocked
// Node 2 is at 0.49 but was not previously blocked and should not be blocked now either.
var cf = createFixtureWithReportedUsages(forNode(1, usage("disk", 0.3), usage("memory", 0.39)),
- forNode(2, usage("disk", 0.3), usage("memory", 0.49)));
+ forNode(2, usage("disk", 0.3), usage("memory", 0.49)));
var feedBlock = calc.inferContentClusterFeedBlockOrNull(cf.cluster().getNodeInfos());
assertNull(feedBlock);
}
@Test
- public void node_must_be_available_in_reported_state_to_trigger_feed_block() {
+ void node_must_be_available_in_reported_state_to_trigger_feed_block() {
var calc = new ResourceExhaustionCalculator(true, mapOf(usage("disk", 0.5), usage("memory", 0.8)));
var cf = createFixtureWithReportedUsages(forNode(1, usage("disk", 0.51), usage("memory", 0.79)),
- forNode(2, usage("disk", 0.6), usage("memory", 0.6)));
+ forNode(2, usage("disk", 0.6), usage("memory", 0.6)));
cf.reportStorageNodeState(1, State.DOWN);
cf.reportStorageNodeState(2, State.DOWN);
var feedBlock = calc.inferContentClusterFeedBlockOrNull(cf.cluster().getNodeInfos());
@@ -154,10 +151,10 @@ public class ResourceExhaustionCalculatorTest {
}
@Test
- public void node_must_be_available_in_wanted_state_to_trigger_feed_block() {
+ void node_must_be_available_in_wanted_state_to_trigger_feed_block() {
var calc = new ResourceExhaustionCalculator(true, mapOf(usage("disk", 0.5), usage("memory", 0.8)));
var cf = createFixtureWithReportedUsages(forNode(1, usage("disk", 0.51), usage("memory", 0.79)),
- forNode(2, usage("disk", 0.6), usage("memory", 0.6)));
+ forNode(2, usage("disk", 0.6), usage("memory", 0.6)));
cf.proposeStorageNodeWantedState(1, State.DOWN);
cf.proposeStorageNodeWantedState(2, State.MAINTENANCE);
var feedBlock = calc.inferContentClusterFeedBlockOrNull(cf.cluster().getNodeInfos());
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ResourceUsageStatsTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ResourceUsageStatsTest.java
index 2eeaf7658ff..fddd5b52aa2 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ResourceUsageStatsTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ResourceUsageStatsTest.java
@@ -1,7 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.core;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Collection;
import java.util.Collections;
@@ -13,15 +13,14 @@ import static com.yahoo.vespa.clustercontroller.core.FeedBlockUtil.exhaustion;
import static com.yahoo.vespa.clustercontroller.core.FeedBlockUtil.forNode;
import static com.yahoo.vespa.clustercontroller.core.FeedBlockUtil.setOf;
import static com.yahoo.vespa.clustercontroller.core.FeedBlockUtil.usage;
-
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class ResourceUsageStatsTest {
private final double DELTA = 0.00001;
@Test
- public void disk_and_memory_utilization_is_max_among_all_content_nodes() {
+ void disk_and_memory_utilization_is_max_among_all_content_nodes() {
var stats = ResourceUsageStats.calculateFrom(createNodeInfo(
forNode(1, usage("disk", 0.3), usage("memory", 0.6)),
forNode(2, usage("disk", 0.4), usage("memory", 0.5))),
@@ -34,7 +33,7 @@ public class ResourceUsageStatsTest {
}
@Test
- public void disk_and_memory_utilization_is_zero_if_no_samples_are_available() {
+ void disk_and_memory_utilization_is_zero_if_no_samples_are_available() {
var stats = ResourceUsageStats.calculateFrom(createNodeInfo(
forNode(1), forNode(2)),
createFeedBlockLimits(0.8, 0.9),
@@ -46,20 +45,20 @@ public class ResourceUsageStatsTest {
}
@Test
- public void nodes_above_limit_is_zero_without_feed_block_status() {
+ void nodes_above_limit_is_zero_without_feed_block_status() {
var stats = ResourceUsageStats.calculateFrom(Collections.emptyList(), Collections.emptyMap(), Optional.empty());
assertEquals(0, stats.getNodesAboveLimit());
}
@Test
- public void nodes_above_limit_is_equal_to_node_resource_exhaustions() {
+ void nodes_above_limit_is_equal_to_node_resource_exhaustions() {
var stats = ResourceUsageStats.calculateFrom(Collections.emptyList(), Collections.emptyMap(),
createFeedBlock(exhaustion(1, "disk"), exhaustion(2, "memory")));
assertEquals(2, stats.getNodesAboveLimit());
}
@Test
- public void nodes_above_limit_counts_each_node_only_once() {
+ void nodes_above_limit_counts_each_node_only_once() {
var stats = ResourceUsageStats.calculateFrom(Collections.emptyList(), Collections.emptyMap(),
createFeedBlock(exhaustion(1, "disk"), exhaustion(1, "memory")));
assertEquals(1, stats.getNodesAboveLimit());
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/RpcServerTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/RpcServerTest.java
index fee1d33725c..41d7465b602 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/RpcServerTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/RpcServerTest.java
@@ -20,7 +20,7 @@ import com.yahoo.vdslib.state.State;
import com.yahoo.vespa.clustercontroller.core.rpc.RpcServer;
import com.yahoo.vespa.clustercontroller.core.testutils.LogFormatter;
import com.yahoo.vespa.clustercontroller.core.testutils.WaitCondition;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
@@ -30,10 +30,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author humbe
@@ -52,7 +49,7 @@ public class RpcServerTest extends FleetControllerTest {
}
@Test
- public void testRebinding() throws Exception {
+ void testRebinding() throws Exception {
startingTest("RpcServerTest::testRebinding");
Slobrok slobrok = new Slobrok();
String[] slobrokConnectionSpecs = new String[1];
@@ -81,17 +78,18 @@ public class RpcServerTest extends FleetControllerTest {
* similar things, so strange if it should be from them too though. Maybe last test there.
*/
@Test
- public void testFailOccasionallyAndIgnoreToSeeIfOtherTestsThenWork() {
- try{
+ void testFailOccasionallyAndIgnoreToSeeIfOtherTestsThenWork() {
+ try {
startingTest("RpcServerTest::testFailOccasionallyAndIgnoreToSeeIfOtherTestsThenWork");
setUpFleetController(true, defaultOptions("mycluster"));
setUpVdsNodes(true, new DummyVdsNodeOptions());
waitForStableSystem();
- } catch (Throwable t) {}
+ } catch (Throwable t) {
+ }
}
@Test
- public void testGetSystemState() throws Exception {
+ void testGetSystemState() throws Exception {
LogFormatter.initializeLogging();
startingTest("RpcServerTest::testGetSystemState");
FleetControllerOptions options = defaultOptions("mycluster");
@@ -131,12 +129,12 @@ public class RpcServerTest extends FleetControllerTest {
Request req = new Request("getSystemState");
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
- assertTrue(req.toString(), req.checkReturnTypes("ss"));
+ assertEquals(ErrorCode.NONE, req.errorCode(), req.toString());
+ assertTrue(req.checkReturnTypes("ss"), req.toString());
String systemState = req.returnValues().get(1).asString();
ClusterState retrievedClusterState = new ClusterState(systemState);
- assertEquals(systemState, State.DOWN, retrievedClusterState.getNodeState(new Node(NodeType.DISTRIBUTOR, 0)).getState());
- assertTrue(systemState, retrievedClusterState.getNodeState(new Node(NodeType.STORAGE, 9)).getState().oneOf("md"));
+ assertEquals(State.DOWN, retrievedClusterState.getNodeState(new Node(NodeType.DISTRIBUTOR, 0)).getState(), systemState);
+ assertTrue(retrievedClusterState.getNodeState(new Node(NodeType.STORAGE, 9)).getState().oneOf("md"), systemState);
}
private void setWantedNodeState(State newState, NodeType nodeType, int nodeIndex) {
@@ -154,12 +152,12 @@ public class RpcServerTest extends FleetControllerTest {
req.parameters().add(new StringValue("storage/cluster.mycluster/" + node.getType().toString() + "/" + node.getIndex()));
req.parameters().add(new StringValue(newNodeState.serialize(true)));
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
- assertTrue(req.toString(), req.checkReturnTypes("s"));
+ assertEquals(ErrorCode.NONE, req.errorCode(), req.toString());
+ assertTrue(req.checkReturnTypes("s"), req.toString());
}
@Test
- public void testGetNodeState() throws Exception {
+ void testGetNodeState() throws Exception {
startingTest("RpcServerTest::testGetNodeState");
Set<ConfiguredNode> configuredNodes = new TreeSet<>();
for (int i = 0; i < 10; i++)
@@ -199,19 +197,19 @@ public class RpcServerTest extends FleetControllerTest {
req.parameters().add(new StringValue("distributor"));
req.parameters().add(new Int32Value(0));
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
- assertTrue(req.toString(), req.checkReturnTypes("ssss"));
+ assertEquals(ErrorCode.NONE, req.errorCode(), req.toString());
+ assertTrue(req.checkReturnTypes("ssss"), req.toString());
assertEquals(State.DOWN, NodeState.deserialize(NodeType.DISTRIBUTOR, req.returnValues().get(0).asString()).getState());
NodeState reported = NodeState.deserialize(NodeType.DISTRIBUTOR, req.returnValues().get(1).asString());
- assertTrue(req.returnValues().get(1).asString(), reported.getState().oneOf("d-"));
+ assertTrue(reported.getState().oneOf("d-"), req.returnValues().get(1).asString());
assertEquals("", req.returnValues().get(2).asString());
req = new Request("getNodeState");
req.parameters().add(new StringValue("distributor"));
req.parameters().add(new Int32Value(2));
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
- assertTrue(req.toString(), req.checkReturnTypes("ssss"));
+ assertEquals(ErrorCode.NONE, req.errorCode(), req.toString());
+ assertTrue(req.checkReturnTypes("ssss"), req.toString());
assertEquals(State.DOWN, NodeState.deserialize(NodeType.DISTRIBUTOR, req.returnValues().get(0).asString()).getState());
assertEquals("t:946080000", req.returnValues().get(1).asString());
assertEquals(State.DOWN, NodeState.deserialize(NodeType.DISTRIBUTOR, req.returnValues().get(2).asString()).getState());
@@ -220,8 +218,8 @@ public class RpcServerTest extends FleetControllerTest {
req.parameters().add(new StringValue("distributor"));
req.parameters().add(new Int32Value(4));
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
- assertTrue(req.toString(), req.checkReturnTypes("ssss"));
+ assertEquals(ErrorCode.NONE, req.errorCode(), req.toString());
+ assertTrue(req.checkReturnTypes("ssss"), req.toString());
assertEquals("", req.returnValues().get(0).asString());
assertEquals("t:946080000", req.returnValues().get(1).asString());
assertEquals("", req.returnValues().get(2).asString());
@@ -230,16 +228,16 @@ public class RpcServerTest extends FleetControllerTest {
req.parameters().add(new StringValue("distributor"));
req.parameters().add(new Int32Value(15));
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), ErrorCode.METHOD_FAILED, req.errorCode());
+ assertEquals(ErrorCode.METHOD_FAILED, req.errorCode(), req.toString());
assertEquals("No node distributor.15 exists in cluster mycluster", req.errorMessage());
- assertFalse(req.toString(), req.checkReturnTypes("ssss"));
+ assertFalse(req.checkReturnTypes("ssss"), req.toString());
req = new Request("getNodeState");
req.parameters().add(new StringValue("storage"));
req.parameters().add(new Int32Value(1));
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
- assertTrue(req.toString(), req.checkReturnTypes("ssss"));
+ assertEquals(ErrorCode.NONE, req.errorCode(), req.toString());
+ assertTrue(req.checkReturnTypes("ssss"), req.toString());
assertEquals("s:i i:0.2", req.returnValues().get(0).asString());
assertEquals("s:i i:0.2", req.returnValues().get(1).asString());
assertEquals("", req.returnValues().get(2).asString());
@@ -248,19 +246,19 @@ public class RpcServerTest extends FleetControllerTest {
req.parameters().add(new StringValue("storage"));
req.parameters().add(new Int32Value(2));
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
- assertTrue(req.toString(), req.checkReturnTypes("ssss"));
+ assertEquals(ErrorCode.NONE, req.errorCode(), req.toString());
+ assertTrue(req.checkReturnTypes("ssss"), req.toString());
assertEquals(State.DOWN, NodeState.deserialize(NodeType.STORAGE, req.returnValues().get(0).asString()).getState());
reported = NodeState.deserialize(NodeType.STORAGE, req.returnValues().get(1).asString());
- assertTrue(req.returnValues().get(1).asString(), reported.getState().oneOf("d-"));
+ assertTrue(reported.getState().oneOf("d-"), req.returnValues().get(1).asString());
assertEquals(State.RETIRED, NodeState.deserialize(NodeType.STORAGE, req.returnValues().get(2).asString()).getState());
req = new Request("getNodeState");
req.parameters().add(new StringValue("storage"));
req.parameters().add(new Int32Value(5));
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
- assertTrue(req.toString(), req.checkReturnTypes("ssss"));
+ assertEquals(ErrorCode.NONE, req.errorCode(), req.toString());
+ assertTrue(req.checkReturnTypes("ssss"), req.toString());
assertEquals("", req.returnValues().get(0).asString());
assertEquals("t:946080000", req.returnValues().get(1).asString());
assertEquals("", req.returnValues().get(2).asString());
@@ -269,15 +267,15 @@ public class RpcServerTest extends FleetControllerTest {
req.parameters().add(new StringValue("storage"));
req.parameters().add(new Int32Value(7));
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
- assertTrue(req.toString(), req.checkReturnTypes("ssss"));
+ assertEquals(ErrorCode.NONE, req.errorCode(), req.toString());
+ assertTrue(req.checkReturnTypes("ssss"), req.toString());
assertEquals(State.MAINTENANCE, NodeState.deserialize(NodeType.STORAGE, req.returnValues().get(0).asString()).getState());
assertEquals("t:946080000", req.returnValues().get(1).asString());
assertEquals(State.MAINTENANCE, NodeState.deserialize(NodeType.STORAGE, req.returnValues().get(2).asString()).getState());
}
@Test
- public void testGetNodeStateWithConfiguredRetired() throws Exception {
+ void testGetNodeStateWithConfiguredRetired() throws Exception {
startingTest("RpcServerTest::testGetNodeStateWithConfiguredRetired");
List<ConfiguredNode> configuredNodes = new ArrayList<>();
for (int i = 0; i < 4; i++)
@@ -311,7 +309,7 @@ public class RpcServerTest extends FleetControllerTest {
}
@Test
- public void testGetNodeStateWithConfigurationChangeToRetiredWhileNodeDown() throws Exception {
+ void testGetNodeStateWithConfigurationChangeToRetiredWhileNodeDown() throws Exception {
startingTest("RpcServerTest::testGetNodeStateWithConfigurationChangeToRetiredWhileNodeDown");
{ // Configuration: 5 nodes, all normal
@@ -392,7 +390,7 @@ public class RpcServerTest extends FleetControllerTest {
}
@Test
- public void testGetNodeStateWithConfigurationChangeToRetired() throws Exception {
+ void testGetNodeStateWithConfigurationChangeToRetired() throws Exception {
startingTest("RpcServerTest::testGetNodeStateWithConfigurationChangeToRetired");
{ // Configuration: 5 nodes, all normal
@@ -450,27 +448,27 @@ public class RpcServerTest extends FleetControllerTest {
{ // Configuration change: Remove the previously retired nodes
/*
- TODO: Verify current result: version:23 distributor:7 .0.s:d .1.s:d .2.s:d .3.s:d .4.s:d storage:7 .0.s:m .1.s:m .2.s:m .3.s:m .4.s:m
- TODO: Make this work without stopping/disconnecting (see StateChangeHandler.setNodes
- Set<ConfiguredNode> configuredNodes = new TreeSet<>();
- configuredNodes.add(new ConfiguredNode(5, false));
- configuredNodes.add(new ConfiguredNode(6, false));
- FleetControllerOptions options = new FleetControllerOptions("mycluster", configuredNodes);
- options.slobrokConnectionSpecs = this.options.slobrokConnectionSpecs;
- this.options.maxInitProgressTimeMs = 30000;
- this.options.stableStateTimePeriod = 60000;
- fleetController.updateOptions(options, 0);
- for (int i = 0; i < 5*2; i++) {
- nodes.get(i).disconnectSlobrok();
- nodes.get(i).disconnect();
- }
- waitForState("version:\\d+ distributor:7 storage:7 .0.s:d .1.s:d .2.s:d .3.s:d .4.s:d");
- */
+ TODO: Verify current result: version:23 distributor:7 .0.s:d .1.s:d .2.s:d .3.s:d .4.s:d storage:7 .0.s:m .1.s:m .2.s:m .3.s:m .4.s:m
+ TODO: Make this work without stopping/disconnecting (see StateChangeHandler.setNodes
+ Set<ConfiguredNode> configuredNodes = new TreeSet<>();
+ configuredNodes.add(new ConfiguredNode(5, false));
+ configuredNodes.add(new ConfiguredNode(6, false));
+ FleetControllerOptions options = new FleetControllerOptions("mycluster", configuredNodes);
+ options.slobrokConnectionSpecs = this.options.slobrokConnectionSpecs;
+ this.options.maxInitProgressTimeMs = 30000;
+ this.options.stableStateTimePeriod = 60000;
+ fleetController.updateOptions(options, 0);
+ for (int i = 0; i < 5*2; i++) {
+ nodes.get(i).disconnectSlobrok();
+ nodes.get(i).disconnect();
+ }
+ waitForState("version:\\d+ distributor:7 storage:7 .0.s:d .1.s:d .2.s:d .3.s:d .4.s:d");
+ */
}
}
@Test
- public void testSetNodeState() throws Exception {
+ void testSetNodeState() throws Exception {
startingTest("RpcServerTest::testSetNodeState");
Set<Integer> nodeIndexes = new TreeSet<>(List.of(4, 6, 9, 10, 14, 16, 21, 22, 23, 25));
Set<ConfiguredNode> configuredNodes = nodeIndexes.stream().map(i -> new ConfiguredNode(i, false)).collect(Collectors.toSet());
@@ -489,8 +487,8 @@ public class RpcServerTest extends FleetControllerTest {
req.parameters().add(new StringValue("storage/cluster.mycluster/storage/14"));
req.parameters().add(new StringValue("s:r"));
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
- assertTrue(req.toString(), req.checkReturnTypes("s"));
+ assertEquals(ErrorCode.NONE, req.errorCode(), req.toString());
+ assertTrue(req.checkReturnTypes("s"), req.toString());
waitForState("version:\\d+ distributor:26 .* storage:26 .* .14.s:r .*");
@@ -498,8 +496,8 @@ public class RpcServerTest extends FleetControllerTest {
req.parameters().add(new StringValue("storage/cluster.mycluster/storage/16"));
req.parameters().add(new StringValue("s:m"));
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
- assertTrue(req.toString(), req.checkReturnTypes("s"));
+ assertEquals(ErrorCode.NONE, req.errorCode(), req.toString());
+ assertTrue(req.checkReturnTypes("s"), req.toString());
waitForState("version:\\d+ distributor:26 .* storage:26 .* .14.s:r.* .16.s:m .*");
nodes.get(5 * 2 + 1).disconnect();
@@ -517,7 +515,7 @@ public class RpcServerTest extends FleetControllerTest {
}
@Test
- public void testSetNodeStateOutOfRange() throws Exception {
+ void testSetNodeStateOutOfRange() throws Exception {
startingTest("RpcServerTest::testSetNodeStateOutOfRange");
FleetControllerOptions options = defaultOptions("mycluster");
options.setStorageDistribution(new Distribution(Distribution.getDefaultDistributionConfig(2, 10)));
@@ -534,27 +532,27 @@ public class RpcServerTest extends FleetControllerTest {
req.parameters().add(new StringValue("storage/cluster.mycluster/storage/10"));
req.parameters().add(new StringValue("s:m"));
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), ErrorCode.METHOD_FAILED, req.errorCode());
- assertEquals(req.toString(), "Cannot set wanted state of node storage.10. Index does not correspond to a configured node.", req.errorMessage());
+ assertEquals(ErrorCode.METHOD_FAILED, req.errorCode(), req.toString());
+ assertEquals("Cannot set wanted state of node storage.10. Index does not correspond to a configured node.", req.errorMessage(), req.toString());
req = new Request("setNodeState");
req.parameters().add(new StringValue("storage/cluster.mycluster/distributor/10"));
req.parameters().add(new StringValue("s:m"));
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), ErrorCode.METHOD_FAILED, req.errorCode());
- assertEquals(req.toString(), "Cannot set wanted state of node distributor.10. Index does not correspond to a configured node.", req.errorMessage());
+ assertEquals(ErrorCode.METHOD_FAILED, req.errorCode(), req.toString());
+ assertEquals("Cannot set wanted state of node distributor.10. Index does not correspond to a configured node.", req.errorMessage(), req.toString());
req = new Request("setNodeState");
req.parameters().add(new StringValue("storage/cluster.mycluster/storage/9"));
req.parameters().add(new StringValue("s:m"));
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), ErrorCode.NONE, req.errorCode());
+ assertEquals(ErrorCode.NONE, req.errorCode(), req.toString());
waitForState("version:\\d+ distributor:10 storage:10 .9.s:m");
}
@Test
- public void testGetMaster() throws Exception {
+ void testGetMaster() throws Exception {
startingTest("RpcServerTest::testGetMaster");
FleetControllerOptions options = defaultOptions("mycluster");
options.setStorageDistribution(new Distribution(Distribution.getDefaultDistributionConfig(2, 10)));
@@ -569,14 +567,14 @@ public class RpcServerTest extends FleetControllerTest {
Request req = new Request("getMaster");
connection.invokeSync(req, timeoutS);
- assertEquals(req.toString(), 0, req.returnValues().get(0).asInt32());
- assertEquals(req.toString(), "All 1 nodes agree that 0 is current master.", req.returnValues().get(1).asString());
+ assertEquals(0, req.returnValues().get(0).asInt32(), req.toString());
+ assertEquals("All 1 nodes agree that 0 is current master.", req.returnValues().get(1).asString(), req.toString());
// Note that this feature is tested better in MasterElectionTest.testGetMaster as it has multiple fleetcontrollers
}
@Test
- public void testGetNodeList() throws Exception {
+ void testGetNodeList() throws Exception {
startingTest("RpcServerTest::testGetNodeList");
setUpFleetController(true, defaultOptions("mycluster", 5));
final int nodeCount = 5;
@@ -596,8 +594,8 @@ public class RpcServerTest extends FleetControllerTest {
for (int j = 0; j <= nodeCount; ++j) {
Request req = new Request("getNodeList");
connection.invokeSync(req, timeoutS);
- assertEquals(req.errorMessage(), ErrorCode.NONE, req.errorCode());
- assertTrue(req.toString(), req.checkReturnTypes("SS"));
+ assertEquals(ErrorCode.NONE, req.errorCode(), req.errorMessage());
+ assertTrue(req.checkReturnTypes("SS"), req.toString());
String[] slobrok = req.returnValues().get(0).asStringArray().clone();
String[] rpc = req.returnValues().get(1).asStringArray().clone();
@@ -610,7 +608,7 @@ public class RpcServerTest extends FleetControllerTest {
if (i < nodeCount && !"".equals(rpc[i])) {
continue;
}
- assertEquals(slobrok[i], "", rpc[i]);
+ assertEquals("", rpc[i], slobrok[i]);
continue;
}
assertNotEquals("", rpc[i]);
@@ -618,7 +616,7 @@ public class RpcServerTest extends FleetControllerTest {
req2.parameters().add(new StringValue("unknown"));
Target connection2 = supervisor.connect(new Spec(rpc[i]));
connection2.invokeSync(req2, timeoutS);
- assertEquals(req2.toString(), ErrorCode.NONE, req.errorCode());
+ assertEquals(ErrorCode.NONE, req.errorCode(), req2.toString());
}
break;
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/RpcVersionAutoDowngradeTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/RpcVersionAutoDowngradeTest.java
index d61cd1271b6..df0b873e25b 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/RpcVersionAutoDowngradeTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/RpcVersionAutoDowngradeTest.java
@@ -4,7 +4,7 @@ package com.yahoo.vespa.clustercontroller.core;
import com.yahoo.vdslib.distribution.ConfiguredNode;
import com.yahoo.vdslib.state.NodeState;
import com.yahoo.vdslib.state.State;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
@@ -28,13 +28,13 @@ public class RpcVersionAutoDowngradeTest extends FleetControllerTest {
}
@Test
- public void cluster_state_rpc_version_is_auto_downgraded_and_retried_for_older_nodes() throws Exception {
+ void cluster_state_rpc_version_is_auto_downgraded_and_retried_for_older_nodes() throws Exception {
setUpFakeCluster(2); // HEAD is at v4
waitForState("version:\\d+ distributor:10 storage:10");
}
@Test
- public void implicit_activation_for_nodes_that_return_not_found_for_version_activation_rpc() throws Exception {
+ void implicit_activation_for_nodes_that_return_not_found_for_version_activation_rpc() throws Exception {
setUpFakeCluster(3); // HEAD is at v4
waitForState("version:\\d+ distributor:10 storage:10");
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/SlobrokTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/SlobrokTest.java
index 47ba7e1cb77..b59c90f4955 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/SlobrokTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/SlobrokTest.java
@@ -3,9 +3,10 @@ package com.yahoo.vespa.clustercontroller.core;
import com.yahoo.jrt.slobrok.server.Slobrok;
import java.util.logging.Level;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.logging.Logger;
@@ -14,7 +15,7 @@ public class SlobrokTest extends FleetControllerTest {
private static final Logger log = Logger.getLogger(SlobrokTest.class.getName());
@Test
- public void testSingleSlobrokRestart() throws Exception {
+ void testSingleSlobrokRestart() throws Exception {
startingTest("SlobrokTest::testSingleSlobrokRestart");
FleetControllerOptions options = defaultOptions("mycluster");
options.nodeStateRequestTimeoutMS = 60 * 60 * 1000;
@@ -26,13 +27,13 @@ public class SlobrokTest extends FleetControllerTest {
int version = fleetController.getSystemState().getVersion();
int slobrokPort = slobrok.port();
- // Test that we survive some slobrok instability without changing system state.
- for (int j=0; j<4; ++j) {
+ // Test that we survive some slobrok instability without changing system state.
+ for (int j = 0; j < 4; ++j) {
log.log(Level.INFO, "Mirror updateForDistributor count is " + fleetController.getSlobrokMirrorUpdates());
- log.log(Level.INFO, "STOPPING SLOBROK SERVER (" + (j+1) + "/4)");
+ log.log(Level.INFO, "STOPPING SLOBROK SERVER (" + (j + 1) + "/4)");
slobrok.stop();
- for (int i=0; i<10; ++i) {
- // Force one node to at least notice that the slobrok server is gone
+ for (int i = 0; i < 10; ++i) {
+ // Force one node to at least notice that the slobrok server is gone
if (i == 5) {
log.log(Level.INFO, "Forcing one node to initate a resend: " + nodes.get(3));
nodes.get(3).replyToPendingNodeStateRequests();
@@ -40,9 +41,9 @@ public class SlobrokTest extends FleetControllerTest {
waitForCompleteCycle();
timer.advanceTime(100);
}
- log.log(Level.INFO, "STARTING SLOBROK SERVER AGAIN (" + (j+1) + "/4)");
+ log.log(Level.INFO, "STARTING SLOBROK SERVER AGAIN (" + (j + 1) + "/4)");
slobrok = new Slobrok(slobrokPort);
- // May take up to 30 seconds for slobrok clients to re-register. Trigger retry.
+ // May take up to 30 seconds for slobrok clients to re-register. Trigger retry.
for (DummyVdsNode node : nodes) {
node.disconnectSlobrok();
node.registerSlobrok();
@@ -56,19 +57,19 @@ public class SlobrokTest extends FleetControllerTest {
if (clusterAvailable()) break;
timer.advanceTime(1000);
waitForCompleteCycle();
- try{
+ try {
Thread.sleep(10);
- } catch (InterruptedException e) { /* ignore */ }
+ } catch (InterruptedException e) { /* ignore */
+ }
}
assertClusterAvailable();
}
- assertEquals("Cluster state was affected, although it should not have been.",
- version, fleetController.getSystemState().getVersion());
+ assertEquals(version, fleetController.getSystemState().getVersion(), "Cluster state was affected, although it should not have been.");
}
@Test
- public void testNodeTooLongOutOfSlobrok() throws Exception {
+ void testNodeTooLongOutOfSlobrok() throws Exception {
startingTest("SlobrokTest::testNodeTooLongOutOfSlobrok");
FleetControllerOptions options = defaultOptions("mycluster");
options.maxSlobrokDisconnectGracePeriod = 60 * 1000;
@@ -81,13 +82,16 @@ public class SlobrokTest extends FleetControllerTest {
nodes.get(0).disconnectSlobrok();
log.log(Level.INFO, "DISCONNECTED NODE FROM SLOBROK. SHOULD BE IN COOLDOWN PERIOD");
fleetController.waitForNodesInSlobrok(9, 10, timeoutMS);
- synchronized (timer) {
+ synchronized(timer) {
nodes.get(0).sendGetNodeStateReply(0);
}
// Give system a little time to possible faultily removing node not in slobrok
timer.advanceTime(1000);
- try{ Thread.sleep(10); } catch (InterruptedException e) { /* ignore */ }
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e) { /* ignore */
+ }
assertEquals(version, fleetController.getSystemState().getVersion());
log.log(Level.INFO, "JUMPING TIME. NODE SHOULD BE MARKED DOWN");
// At this point the fleetcontroller might not have noticed that the node is out of slobrok yet.
@@ -108,8 +112,8 @@ public class SlobrokTest extends FleetControllerTest {
private void assertClusterAvailable() {
ContentCluster cluster = fleetController.getCluster();
for (NodeInfo info : cluster.getNodeInfos()) {
- assertEquals("Node " + info + " connection attempts.", 0, info.getConnectionAttemptCount());
- assertTrue("Node " + info + " has no last request time.", info.getLatestNodeStateRequestTime() != 0);
+ assertEquals(0, info.getConnectionAttemptCount(), "Node " + info + " connection attempts.");
+ assertTrue(info.getLatestNodeStateRequestTime() != 0, "Node " + info + " has no last request time.");
}
}
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeHandlerTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeHandlerTest.java
index 699a35a190c..2bea95ab8c5 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeHandlerTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeHandlerTest.java
@@ -12,8 +12,8 @@ import com.yahoo.vespa.clustercontroller.core.hostinfo.HostInfo;
import com.yahoo.vespa.clustercontroller.core.listeners.NodeListener;
import com.yahoo.vespa.clustercontroller.core.mocks.TestEventLog;
import com.yahoo.vespa.clustercontroller.core.testutils.LogFormatter;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import java.util.LinkedList;
@@ -21,8 +21,8 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.logging.Logger;
-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.assertTrue;
public class StateChangeHandlerTest {
@@ -76,7 +76,7 @@ public class StateChangeHandlerTest {
private TestNodeListener nodeStateUpdateListener;
private final ClusterStateGenerator.Params params = new ClusterStateGenerator.Params();
- @Before
+ @BeforeEach
public void setUp() {
LogFormatter.initializeLogging();
}
@@ -125,7 +125,7 @@ public class StateChangeHandlerTest {
log.info("Marking " + node + " out of slobrok");
cluster.getNodeInfo(node).markRpcAddressOutdated(clock);
nodeStateChangeHandler.handleMissingNode(stateBefore, cluster.getNodeInfo(node), nodeStateUpdateListener);
- assertTrue(eventLog.toString(), eventLog.toString().contains("Node is no longer in slobrok"));
+ assertTrue(eventLog.toString().contains("Node is no longer in slobrok"), eventLog.toString());
eventLog.clear();
}
@@ -159,16 +159,16 @@ public class StateChangeHandlerTest {
}
@Test
- public void testUnstableNodeInSlobrok() {
+ void testUnstableNodeInSlobrok() {
initialize(new Config());
startWithStableStateClusterWithNodesUp();
Node node = new Node(NodeType.STORAGE, 0);
- for (int j=0; j<3; ++j) {
+ for (int j = 0; j < 3; ++j) {
log.info("Iteration " + j);
assertEquals(0, cluster.getNodeInfo(node).getPrematureCrashCount());
assertEquals(State.UP, cluster.getNodeInfo(node).getWantedState().getState());
assertEquals(State.UP, currentClusterState().getNodeState(node).getState());
- for (int k=0; k<config.maxPrematureCrashes; ++k) {
+ for (int k = 0; k < config.maxPrematureCrashes; ++k) {
log.info("Premature iteration " + k);
markNodeOutOfSlobrok(node);
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java
index 5a33414c955..7c61423ac2b 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java
@@ -13,8 +13,8 @@ import com.yahoo.vespa.clustercontroller.core.database.DatabaseHandler;
import com.yahoo.vespa.clustercontroller.core.database.ZooKeeperDatabaseFactory;
import com.yahoo.vespa.clustercontroller.core.testutils.StateWaiter;
import com.yahoo.vespa.clustercontroller.utils.util.NoMetricReporter;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import java.time.Duration;
import java.util.ArrayList;
@@ -25,9 +25,7 @@ import java.util.logging.Logger;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
-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.*;
public class StateChangeTest extends FleetControllerTest {
@@ -37,7 +35,7 @@ public class StateChangeTest extends FleetControllerTest {
private DummyCommunicator communicator;
private EventLog eventLog;
- @Before
+ @BeforeEach
public void setUp() {
supervisor = new Supervisor(new Transport());
}
@@ -101,7 +99,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void testNormalStartup() throws Exception {
+ void testNormalStartup() throws Exception {
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
options.maxInitProgressTime = 50000;
@@ -115,7 +113,7 @@ public class StateChangeTest extends FleetControllerTest {
communicator.setNodeState(new Node(NodeType.DISTRIBUTOR, j), new NodeState(NodeType.DISTRIBUTOR, State.INITIALIZING).setInitProgress(0.0f), "");
}
- for (int i=0; i<100; i += 10) {
+ for (int i = 0; i < 100; i += 10) {
timer.advanceTime(options.maxInitProgressTime / 20);
ctrl.tick();
for (int j = 0; j < 10; ++j) {
@@ -129,9 +127,9 @@ public class StateChangeTest extends FleetControllerTest {
// Regular init progress does not update the cluster state until the node is done initializing (or goes down,
// whichever comes first).
assertEquals("version:6 distributor:10 .0.s:i .0.i:0.0 .1.s:i .1.i:0.0 .2.s:i .2.i:0.0 .3.s:i .3.i:0.0 " +
- ".4.s:i .4.i:0.0 .5.s:i .5.i:0.0 .6.s:i .6.i:0.0 .7.s:i .7.i:0.0 .8.s:i .8.i:0.0 " +
- ".9.s:i .9.i:0.0 storage:10 .0.s:i .0.i:0.1 .1.s:i .1.i:0.1 .2.s:i .2.i:0.1 .3.s:i .3.i:0.1 " +
- ".4.s:i .4.i:0.1 .5.s:i .5.i:0.1 .6.s:i .6.i:0.1 .7.s:i .7.i:0.1 .8.s:i .8.i:0.1 .9.s:i .9.i:0.1",
+ ".4.s:i .4.i:0.0 .5.s:i .5.i:0.0 .6.s:i .6.i:0.0 .7.s:i .7.i:0.0 .8.s:i .8.i:0.0 " +
+ ".9.s:i .9.i:0.0 storage:10 .0.s:i .0.i:0.1 .1.s:i .1.i:0.1 .2.s:i .2.i:0.1 .3.s:i .3.i:0.1 " +
+ ".4.s:i .4.i:0.1 .5.s:i .5.i:0.1 .6.s:i .6.i:0.1 .7.s:i .7.i:0.1 .8.s:i .8.i:0.1 .9.s:i .9.i:0.1",
ctrl.consolidatedClusterState().toString());
timer.advanceTime(options.maxInitProgressTime / 20);
@@ -155,25 +153,25 @@ public class StateChangeTest extends FleetControllerTest {
verifyNodeEvents(new Node(NodeType.DISTRIBUTOR, 0),
"Event: distributor.0: Now reporting state U\n" +
- "Event: distributor.0: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
- "Event: distributor.0: Now reporting state I, i 0.00\n" +
- "Event: distributor.0: Altered node state in cluster state from 'U' to 'I, i 0.00'\n" +
- "Event: distributor.0: Now reporting state U\n" +
- "Event: distributor.0: Altered node state in cluster state from 'I, i 0.00' to 'U'\n");
+ "Event: distributor.0: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
+ "Event: distributor.0: Now reporting state I, i 0.00\n" +
+ "Event: distributor.0: Altered node state in cluster state from 'U' to 'I, i 0.00'\n" +
+ "Event: distributor.0: Now reporting state U\n" +
+ "Event: distributor.0: Altered node state in cluster state from 'I, i 0.00' to 'U'\n");
verifyNodeEvents(new Node(NodeType.STORAGE, 0),
"Event: storage.0: Now reporting state U\n" +
- "Event: storage.0: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
- "Event: storage.0: Now reporting state I, i 0.00 (ls)\n" +
- "Event: storage.0: Altered node state in cluster state from 'U' to 'D'\n" +
- "Event: storage.0: Now reporting state I, i 0.100 (read)\n" +
- "Event: storage.0: Altered node state in cluster state from 'D' to 'I, i 0.100 (read)'\n" +
- "Event: storage.0: Now reporting state U\n" +
- "Event: storage.0: Altered node state in cluster state from 'I, i 0.100 (read)' to 'U'\n");
+ "Event: storage.0: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
+ "Event: storage.0: Now reporting state I, i 0.00 (ls)\n" +
+ "Event: storage.0: Altered node state in cluster state from 'U' to 'D'\n" +
+ "Event: storage.0: Now reporting state I, i 0.100 (read)\n" +
+ "Event: storage.0: Altered node state in cluster state from 'D' to 'I, i 0.100 (read)'\n" +
+ "Event: storage.0: Now reporting state U\n" +
+ "Event: storage.0: Altered node state in cluster state from 'I, i 0.100 (read)' to 'U'\n");
}
@Test
- public void testNodeGoingDownAndUp() throws Exception {
+ void testNodeGoingDownAndUp() throws Exception {
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
options.nodeStateRequestTimeoutMS = 60 * 60 * 1000;
options.minTimeBetweenNewSystemStates = 0;
@@ -191,7 +189,7 @@ public class StateChangeTest extends FleetControllerTest {
ctrl.tick();
String desc = ctrl.getReportedNodeState(new Node(NodeType.DISTRIBUTOR, 0)).getDescription();
- assertTrue(desc, desc.contains("Closed at other end"));
+ assertTrue(desc.contains("Closed at other end"), desc);
assertEquals("version:4 distributor:10 .0.s:d storage:10", ctrl.getSystemState().toString());
@@ -208,7 +206,7 @@ public class StateChangeTest extends FleetControllerTest {
assert(!ctrl.getReportedNodeState(new Node(NodeType.DISTRIBUTOR, 0)).hasDescription());
desc = ctrl.getReportedNodeState(new Node(NodeType.STORAGE, 0)).getDescription();
- assertTrue(desc, desc.contains("Closed at other end"));
+ assertTrue(desc.contains("Closed at other end"), desc);
timer.advanceTime(options.maxTransitionTime.get(NodeType.STORAGE) + 1);
@@ -217,7 +215,7 @@ public class StateChangeTest extends FleetControllerTest {
assertEquals("version:6 distributor:10 .0.t:12345678 storage:10 .0.s:d", ctrl.getSystemState().toString());
desc = ctrl.getReportedNodeState(new Node(NodeType.STORAGE, 0)).getDescription();
- assertTrue(desc, desc.contains("Closed at other end"));
+ assertTrue(desc.contains("Closed at other end"), desc);
timer.advanceTime(1000);
@@ -233,24 +231,24 @@ public class StateChangeTest extends FleetControllerTest {
verifyNodeEvents(new Node(NodeType.DISTRIBUTOR, 0),
"Event: distributor.0: Now reporting state U\n" +
- "Event: distributor.0: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
- "Event: distributor.0: Failed to get node state: D: Closed at other end\n" +
- "Event: distributor.0: Stopped or possibly crashed after 0 ms, which is before stable state time period. Premature crash count is now 1.\n" +
- "Event: distributor.0: Altered node state in cluster state from 'U' to 'D: Closed at other end'\n" +
- "Event: distributor.0: Now reporting state U, t 12345678\n" +
- "Event: distributor.0: Altered node state in cluster state from 'D: Closed at other end' to 'U, t 12345678'\n" +
- "Event: distributor.0: Altered node state in cluster state from 'U, t 12345678' to 'U'\n");
+ "Event: distributor.0: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
+ "Event: distributor.0: Failed to get node state: D: Closed at other end\n" +
+ "Event: distributor.0: Stopped or possibly crashed after 0 ms, which is before stable state time period. Premature crash count is now 1.\n" +
+ "Event: distributor.0: Altered node state in cluster state from 'U' to 'D: Closed at other end'\n" +
+ "Event: distributor.0: Now reporting state U, t 12345678\n" +
+ "Event: distributor.0: Altered node state in cluster state from 'D: Closed at other end' to 'U, t 12345678'\n" +
+ "Event: distributor.0: Altered node state in cluster state from 'U, t 12345678' to 'U'\n");
verifyNodeEvents(new Node(NodeType.STORAGE, 0),
"Event: storage.0: Now reporting state U\n" +
- "Event: storage.0: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
- "Event: storage.0: Failed to get node state: D: Closed at other end\n" +
- "Event: storage.0: Stopped or possibly crashed after 1000 ms, which is before stable state time period. Premature crash count is now 1.\n" +
- "Event: storage.0: Altered node state in cluster state from 'U' to 'M: Closed at other end'\n" +
- "Event: storage.0: Exceeded implicit maintenance mode grace period of 5000 milliseconds. Marking node down.\n" +
- "Event: storage.0: Altered node state in cluster state from 'M: Closed at other end' to 'D: Closed at other end'\n" +
- "Event: storage.0: Now reporting state U, t 12345679\n" +
- "Event: storage.0: Altered node state in cluster state from 'D: Closed at other end' to 'U, t 12345679'\n");
+ "Event: storage.0: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
+ "Event: storage.0: Failed to get node state: D: Closed at other end\n" +
+ "Event: storage.0: Stopped or possibly crashed after 1000 ms, which is before stable state time period. Premature crash count is now 1.\n" +
+ "Event: storage.0: Altered node state in cluster state from 'U' to 'M: Closed at other end'\n" +
+ "Event: storage.0: Exceeded implicit maintenance mode grace period of 5000 milliseconds. Marking node down.\n" +
+ "Event: storage.0: Altered node state in cluster state from 'M: Closed at other end' to 'D: Closed at other end'\n" +
+ "Event: storage.0: Now reporting state U, t 12345679\n" +
+ "Event: storage.0: Altered node state in cluster state from 'D: Closed at other end' to 'U, t 12345679'\n");
assertEquals(1, ctrl.getCluster().getNodeInfo(new Node(NodeType.DISTRIBUTOR, 0)).getPrematureCrashCount());
assertEquals(1, ctrl.getCluster().getNodeInfo(new Node(NodeType.STORAGE, 0)).getPrematureCrashCount());
@@ -262,7 +260,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void testNodeGoingDownAndUpNotifying() throws Exception {
+ void testNodeGoingDownAndUpNotifying() throws Exception {
// Same test as above, but node manages to notify why it is going down first.
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
options.nodeStateRequestTimeoutMS = 60 * 60 * 1000;
@@ -272,15 +270,15 @@ public class StateChangeTest extends FleetControllerTest {
ctrl.tick();
- tick((int)options.stableStateTimePeriod + 1);
+ tick((int) options.stableStateTimePeriod + 1);
communicator.setNodeState(new Node(NodeType.DISTRIBUTOR, 0), State.DOWN, "controlled shutdown");
ctrl.tick();
String desc = ctrl.getReportedNodeState(new Node(NodeType.DISTRIBUTOR, 0)).getDescription();
- assertTrue(desc, desc.contains("Received signal 15 (SIGTERM - Termination signal)")
- || desc.contains("controlled shutdown"));
+ assertTrue(desc.contains("Received signal 15 (SIGTERM - Termination signal)")
+ || desc.contains("controlled shutdown"), desc);
tick(1000);
@@ -293,15 +291,15 @@ public class StateChangeTest extends FleetControllerTest {
assert(!ctrl.getReportedNodeState(new Node(NodeType.DISTRIBUTOR, 0)).hasDescription());
desc = ctrl.getReportedNodeState(new Node(NodeType.STORAGE, 0)).getDescription();
- assertTrue(desc, desc.contains("Received signal 15 (SIGTERM - Termination signal)")
- || desc.contains("controlled shutdown"));
+ assertTrue(desc.contains("Received signal 15 (SIGTERM - Termination signal)")
+ || desc.contains("controlled shutdown"), desc);
tick(options.maxTransitionTime.get(NodeType.STORAGE) + 1);
assertEquals("version:6 distributor:10 storage:10 .0.s:d", ctrl.getSystemState().toString());
desc = ctrl.getReportedNodeState(new Node(NodeType.STORAGE, 0)).getDescription();
- assertTrue(desc, desc.contains("Received signal 15 (SIGTERM - Termination signal)")
- || desc.contains("controlled shutdown"));
+ assertTrue(desc.contains("Received signal 15 (SIGTERM - Termination signal)")
+ || desc.contains("controlled shutdown"), desc);
communicator.setNodeState(new Node(NodeType.STORAGE, 0), State.UP, "");
@@ -315,26 +313,26 @@ public class StateChangeTest extends FleetControllerTest {
verifyNodeEvents(new Node(NodeType.DISTRIBUTOR, 0),
"Event: distributor.0: Now reporting state U\n" +
- "Event: distributor.0: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
- "Event: distributor.0: Failed to get node state: D: controlled shutdown\n" +
- "Event: distributor.0: Altered node state in cluster state from 'U' to 'D: controlled shutdown'\n" +
- "Event: distributor.0: Now reporting state U\n" +
- "Event: distributor.0: Altered node state in cluster state from 'D: controlled shutdown' to 'U'\n");
+ "Event: distributor.0: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
+ "Event: distributor.0: Failed to get node state: D: controlled shutdown\n" +
+ "Event: distributor.0: Altered node state in cluster state from 'U' to 'D: controlled shutdown'\n" +
+ "Event: distributor.0: Now reporting state U\n" +
+ "Event: distributor.0: Altered node state in cluster state from 'D: controlled shutdown' to 'U'\n");
verifyNodeEvents(new Node(NodeType.STORAGE, 0),
"Event: storage.0: Now reporting state U\n" +
- "Event: storage.0: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
- "Event: storage.0: Failed to get node state: D: controlled shutdown\n" +
- "Event: storage.0: Altered node state in cluster state from 'U' to 'M: controlled shutdown'\n" +
- "Event: storage.0: Exceeded implicit maintenance mode grace period of 5000 milliseconds. Marking node down.\n" +
- "Event: storage.0: Altered node state in cluster state from 'M: controlled shutdown' to 'D: controlled shutdown'\n" +
- "Event: storage.0: Now reporting state U\n" +
- "Event: storage.0: Altered node state in cluster state from 'D: controlled shutdown' to 'U'\n");
+ "Event: storage.0: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
+ "Event: storage.0: Failed to get node state: D: controlled shutdown\n" +
+ "Event: storage.0: Altered node state in cluster state from 'U' to 'M: controlled shutdown'\n" +
+ "Event: storage.0: Exceeded implicit maintenance mode grace period of 5000 milliseconds. Marking node down.\n" +
+ "Event: storage.0: Altered node state in cluster state from 'M: controlled shutdown' to 'D: controlled shutdown'\n" +
+ "Event: storage.0: Now reporting state U\n" +
+ "Event: storage.0: Altered node state in cluster state from 'D: controlled shutdown' to 'U'\n");
}
@Test
- public void testNodeGoingDownAndUpFast() throws Exception {
+ void testNodeGoingDownAndUpFast() throws Exception {
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
options.maxSlobrokDisconnectGracePeriod = 60 * 1000;
@@ -370,12 +368,12 @@ public class StateChangeTest extends FleetControllerTest {
verifyNodeEvents(new Node(NodeType.STORAGE, 0),
"Event: storage.0: Now reporting state U\n" +
- "Event: storage.0: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
- "Event: storage.0: Node is no longer in slobrok, but we still have a pending state request.\n");
+ "Event: storage.0: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
+ "Event: storage.0: Node is no longer in slobrok, but we still have a pending state request.\n");
}
@Test
- public void testMaintenanceWhileNormalStorageNodeRestart() throws Exception {
+ void testMaintenanceWhileNormalStorageNodeRestart() throws Exception {
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
options.maxSlobrokDisconnectGracePeriod = 60 * 1000;
@@ -388,7 +386,7 @@ public class StateChangeTest extends FleetControllerTest {
assertEquals("version:4 distributor:10 storage:10 .6.s:m", ctrl.getSystemState().toString());
NodeState ns = ctrl.getReportedNodeState(new Node(NodeType.STORAGE, 6));
- assertTrue(ns.toString(), ns.getDescription().contains("Connection error: Closed at other end"));
+ assertTrue(ns.getDescription().contains("Connection error: Closed at other end"), ns.toString());
tick(1000);
@@ -417,19 +415,19 @@ public class StateChangeTest extends FleetControllerTest {
verifyNodeEvents(new Node(NodeType.STORAGE, 6),
"Event: storage.6: Now reporting state U\n" +
- "Event: storage.6: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
- "Event: storage.6: Failed to get node state: D: Connection error: Closed at other end\n" +
- "Event: storage.6: Stopped or possibly crashed after 0 ms, which is before stable state time period. Premature crash count is now 1.\n" +
- "Event: storage.6: Altered node state in cluster state from 'U' to 'M: Connection error: Closed at other end'\n" +
- "Event: storage.6: Now reporting state I, i 0.00 (ls)\n" +
- "Event: storage.6: Now reporting state I, i 0.600 (read)\n" +
- "Event: storage.6: Altered node state in cluster state from 'M: Connection error: Closed at other end' to 'I, i 0.600 (read)'\n" +
- "Event: storage.6: Now reporting state U\n" +
- "Event: storage.6: Altered node state in cluster state from 'I, i 0.600 (read)' to 'U'\n");
+ "Event: storage.6: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
+ "Event: storage.6: Failed to get node state: D: Connection error: Closed at other end\n" +
+ "Event: storage.6: Stopped or possibly crashed after 0 ms, which is before stable state time period. Premature crash count is now 1.\n" +
+ "Event: storage.6: Altered node state in cluster state from 'U' to 'M: Connection error: Closed at other end'\n" +
+ "Event: storage.6: Now reporting state I, i 0.00 (ls)\n" +
+ "Event: storage.6: Now reporting state I, i 0.600 (read)\n" +
+ "Event: storage.6: Altered node state in cluster state from 'M: Connection error: Closed at other end' to 'I, i 0.600 (read)'\n" +
+ "Event: storage.6: Now reporting state U\n" +
+ "Event: storage.6: Altered node state in cluster state from 'I, i 0.600 (read)' to 'U'\n");
}
@Test
- public void testMaintenanceWithoutInitIfRetired() throws Exception {
+ void testMaintenanceWithoutInitIfRetired() throws Exception {
List<ConfiguredNode> nodes = new ArrayList<>();
for (int i = 0; i < 10; i++) {
boolean retired = (i == 6);
@@ -448,7 +446,7 @@ public class StateChangeTest extends FleetControllerTest {
assertEquals("version:4 distributor:10 storage:10 .6.s:m", ctrl.getSystemState().toString());
NodeState ns = ctrl.getReportedNodeState(new Node(NodeType.STORAGE, 6));
- assertTrue(ns.toString(), ns.getDescription().contains("Connection error: Closed at other end"));
+ assertTrue(ns.getDescription().contains("Connection error: Closed at other end"), ns.toString());
tick(1000);
@@ -477,18 +475,18 @@ public class StateChangeTest extends FleetControllerTest {
verifyNodeEvents(new Node(NodeType.STORAGE, 6),
"Event: storage.6: Now reporting state U\n" +
- "Event: storage.6: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'R'\n" +
- "Event: storage.6: Failed to get node state: D: Connection error: Closed at other end\n" +
- "Event: storage.6: Stopped or possibly crashed after 0 ms, which is before stable state time period. Premature crash count is now 1.\n" +
- "Event: storage.6: Altered node state in cluster state from 'R' to 'M: Connection error: Closed at other end'\n" +
- "Event: storage.6: Now reporting state I, i 0.00 (ls)\n" +
- "Event: storage.6: Now reporting state I, i 0.600 (read)\n" +
- "Event: storage.6: Now reporting state U\n" +
- "Event: storage.6: Altered node state in cluster state from 'M: Connection error: Closed at other end' to 'R'\n");
+ "Event: storage.6: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'R'\n" +
+ "Event: storage.6: Failed to get node state: D: Connection error: Closed at other end\n" +
+ "Event: storage.6: Stopped or possibly crashed after 0 ms, which is before stable state time period. Premature crash count is now 1.\n" +
+ "Event: storage.6: Altered node state in cluster state from 'R' to 'M: Connection error: Closed at other end'\n" +
+ "Event: storage.6: Now reporting state I, i 0.00 (ls)\n" +
+ "Event: storage.6: Now reporting state I, i 0.600 (read)\n" +
+ "Event: storage.6: Now reporting state U\n" +
+ "Event: storage.6: Altered node state in cluster state from 'M: Connection error: Closed at other end' to 'R'\n");
}
@Test
- public void testMaintenanceToDownIfPastTransitionTimeAndRetired() throws Exception {
+ void testMaintenanceToDownIfPastTransitionTimeAndRetired() throws Exception {
List<ConfiguredNode> nodes = new ArrayList<>();
for (int i = 0; i < 10; i++) {
boolean retired = (i == 6);
@@ -516,7 +514,7 @@ public class StateChangeTest extends FleetControllerTest {
// Test that a node that has been down for a long time (above steady state period), actually alters cluster state to
// tell that it is initializing, rather than being ignored as a just restarted/unstable node should be.
@Test
- public void testDownNodeInitializing() throws Exception {
+ void testDownNodeInitializing() throws Exception {
// Actually report initializing state if node has been down steadily for a while
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
options.maxTransitionTime.put(NodeType.STORAGE, 5000);
@@ -566,20 +564,20 @@ public class StateChangeTest extends FleetControllerTest {
verifyNodeEvents(new Node(NodeType.STORAGE, 6),
"Event: storage.6: Now reporting state U\n" +
- "Event: storage.6: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
- "Event: storage.6: Failed to get node state: D: Connection error: Closed at other end\n" +
- "Event: storage.6: Altered node state in cluster state from 'U' to 'M: Connection error: Closed at other end'\n" +
- "Event: storage.6: Exceeded implicit maintenance mode grace period of 5000 milliseconds. Marking node down.\n" +
- "Event: storage.6: Altered node state in cluster state from 'M: Connection error: Closed at other end' to 'D: Connection error: Closed at other end'\n" +
- "Event: storage.6: Now reporting state I, i 0.00100 (ls)\n" +
- "Event: storage.6: Now reporting state I, i 0.100 (read)\n" +
- "Event: storage.6: Altered node state in cluster state from 'D: Connection error: Closed at other end' to 'I, i 0.100 (read)'\n" +
- "Event: storage.6: Now reporting state U\n" +
- "Event: storage.6: Altered node state in cluster state from 'I, i 0.100 (read)' to 'U'\n");
+ "Event: storage.6: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
+ "Event: storage.6: Failed to get node state: D: Connection error: Closed at other end\n" +
+ "Event: storage.6: Altered node state in cluster state from 'U' to 'M: Connection error: Closed at other end'\n" +
+ "Event: storage.6: Exceeded implicit maintenance mode grace period of 5000 milliseconds. Marking node down.\n" +
+ "Event: storage.6: Altered node state in cluster state from 'M: Connection error: Closed at other end' to 'D: Connection error: Closed at other end'\n" +
+ "Event: storage.6: Now reporting state I, i 0.00100 (ls)\n" +
+ "Event: storage.6: Now reporting state I, i 0.100 (read)\n" +
+ "Event: storage.6: Altered node state in cluster state from 'D: Connection error: Closed at other end' to 'I, i 0.100 (read)'\n" +
+ "Event: storage.6: Now reporting state U\n" +
+ "Event: storage.6: Altered node state in cluster state from 'I, i 0.100 (read)' to 'U'\n");
}
@Test
- public void testNodeInitializationStalled() throws Exception {
+ void testNodeInitializationStalled() throws Exception {
// Node should eventually be marked down, and not become initializing next time, but stay down until up
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
options.maxTransitionTime.put(NodeType.STORAGE, 5000);
@@ -647,31 +645,31 @@ public class StateChangeTest extends FleetControllerTest {
verifyNodeEvents(new Node(NodeType.STORAGE, 6),
"Event: storage.6: Now reporting state U\n" +
- "Event: storage.6: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
- "Event: storage.6: Failed to get node state: D: Connection error: Closed at other end\n" +
- "Event: storage.6: Altered node state in cluster state from 'U' to 'M: Connection error: Closed at other end'\n" +
- "Event: storage.6: Exceeded implicit maintenance mode grace period of 5000 milliseconds. Marking node down.\n" +
- "Event: storage.6: Altered node state in cluster state from 'M: Connection error: Closed at other end' to 'D: Connection error: Closed at other end'\n" +
- "Event: storage.6: Now reporting state I, i 0.100 (read)\n" +
- "Event: storage.6: Altered node state in cluster state from 'D: Connection error: Closed at other end' to 'I, i 0.100 (read)'\n" +
- "Event: storage.6: 5001 milliseconds without initialize progress. Marking node down. Premature crash count is now 1.\n" +
- "Event: storage.6: Altered node state in cluster state from 'I, i 0.100 (read)' to 'D'\n" +
- "Event: storage.6: Failed to get node state: D: Connection error: Closed at other end\n" +
- "Event: storage.6: Now reporting state I, i 0.00 (ls)\n" +
- "Event: storage.6: Now reporting state I, i 0.100 (read)\n" +
- "Event: storage.6: Now reporting state U\n" +
- "Event: storage.6: Altered node state in cluster state from 'D' to 'U'\n");
+ "Event: storage.6: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
+ "Event: storage.6: Failed to get node state: D: Connection error: Closed at other end\n" +
+ "Event: storage.6: Altered node state in cluster state from 'U' to 'M: Connection error: Closed at other end'\n" +
+ "Event: storage.6: Exceeded implicit maintenance mode grace period of 5000 milliseconds. Marking node down.\n" +
+ "Event: storage.6: Altered node state in cluster state from 'M: Connection error: Closed at other end' to 'D: Connection error: Closed at other end'\n" +
+ "Event: storage.6: Now reporting state I, i 0.100 (read)\n" +
+ "Event: storage.6: Altered node state in cluster state from 'D: Connection error: Closed at other end' to 'I, i 0.100 (read)'\n" +
+ "Event: storage.6: 5001 milliseconds without initialize progress. Marking node down. Premature crash count is now 1.\n" +
+ "Event: storage.6: Altered node state in cluster state from 'I, i 0.100 (read)' to 'D'\n" +
+ "Event: storage.6: Failed to get node state: D: Connection error: Closed at other end\n" +
+ "Event: storage.6: Now reporting state I, i 0.00 (ls)\n" +
+ "Event: storage.6: Now reporting state I, i 0.100 (read)\n" +
+ "Event: storage.6: Now reporting state U\n" +
+ "Event: storage.6: Altered node state in cluster state from 'D' to 'U'\n");
}
@Test
- public void testBackwardsInitializationProgress() throws Exception {
+ void testBackwardsInitializationProgress() throws Exception {
// Same as stalled. Mark down, keep down until up
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
options.maxTransitionTime.put(NodeType.STORAGE, 5000);
options.maxInitProgressTime = 5000;
options.stableStateTimePeriod = 1000000;
- // Set long so we dont time out RPC requests and mark nodes down due to advancing time to get in steady state
+ // Set long so we dont time out RPC requests and mark nodes down due to advancing time to get in steady state
options.nodeStateRequestTimeoutMS = (int) options.stableStateTimePeriod * 2;
initialize(options);
@@ -708,7 +706,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void testNodeGoingDownWhileInitializing() throws Exception {
+ void testNodeGoingDownWhileInitializing() throws Exception {
// Same as stalled. Mark down, keep down until up
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
options.maxTransitionTime.put(NodeType.STORAGE, 5000);
@@ -766,7 +764,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void testContinuousCrashRightAfterInit() throws Exception {
+ void testContinuousCrashRightAfterInit() throws Exception {
startingTest("StateChangeTest::testContinuousCrashRightAfterInit");
// If node does this too many times, take it out of service
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
@@ -820,7 +818,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void testClusterStateMinNodes() throws Exception {
+ void testClusterStateMinNodes() throws Exception {
startingTest("StateChangeTest::testClusterStateMinNodes");
// If node does this too many times, take it out of service
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
@@ -875,7 +873,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void testClusterStateMinFactor() throws Exception {
+ void testClusterStateMinFactor() throws Exception {
startingTest("StateChangeTest::testClusterStateMinFactor");
// If node does this too many times, take it out of service
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
@@ -942,21 +940,21 @@ public class StateChangeTest extends FleetControllerTest {
for (ClusterState state : states) {
debugString.append(state.toString()).append("\n");
}
- assertEquals(debugString.toString(), expectedMessageCount(node), states.size());
+ assertEquals(expectedMessageCount(node), states.size(), debugString.toString());
}
}
abstract int expectedMessageCount(final DummyVdsNode node);
}
@Test
- public void testNoSystemStateBeforeInitialTimePeriod() throws Exception {
+ void testNoSystemStateBeforeInitialTimePeriod() throws Exception {
startingTest("StateChangeTest::testNoSystemStateBeforeInitialTimePeriod()");
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
options.minTimeBeforeFirstSystemStateBroadcast = 3 * 60 * 1000;
setUpSystem(true, options);
setUpVdsNodes(true, new DummyVdsNodeOptions(), true);
// Leave one node down to avoid sending cluster state due to having seen all node states.
- for (int i=0; i<nodes.size(); ++i) {
+ for (int i = 0; i < nodes.size(); ++i) {
if (i != 3) {
nodes.get(i).connect();
}
@@ -971,7 +969,10 @@ public class StateChangeTest extends FleetControllerTest {
waiter.waitForState("^distributor:10 (\\.\\d+\\.t:\\d+ )*storage:10 (\\.\\d+\\.t:\\d+ )*.1.s:d( \\.\\d+\\.t:\\d+)*", timeoutMS);
waitForCompleteCycle();
new StateMessageChecker(nodes) {
- @Override int expectedMessageCount(final DummyVdsNode node) { return 0; }
+ @Override
+ int expectedMessageCount(final DummyVdsNode node) {
+ return 0;
+ }
};
// Pass time and see that the nodes get state
@@ -982,7 +983,8 @@ public class StateChangeTest extends FleetControllerTest {
fleetController.waitForNodesHavingSystemStateVersionEqualToOrAbove(version, 19, timeoutMS);
new StateMessageChecker(nodes) {
- @Override int expectedMessageCount(final DummyVdsNode node) {
+ @Override
+ int expectedMessageCount(final DummyVdsNode node) {
return node.getNode().equals(new Node(NodeType.STORAGE, 1)) ? 0 : 2;
}
};
@@ -990,7 +992,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void testSystemStateSentWhenNodesReplied() throws Exception {
+ void testSystemStateSentWhenNodesReplied() throws Exception {
startingTest("StateChangeTest::testSystemStateSentWhenNodesReplied()");
final FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
options.minTimeBeforeFirstSystemStateBroadcast = 300 * 60 * 1000;
@@ -1019,12 +1021,15 @@ public class StateChangeTest extends FleetControllerTest {
// The last two versions of the cluster state should be seen (all nodes up,
// zero out timestate)
new StateMessageChecker(nodes) {
- @Override int expectedMessageCount(final DummyVdsNode node) { return 2; }
+ @Override
+ int expectedMessageCount(final DummyVdsNode node) {
+ return 2;
+ }
};
}
@Test
- public void testDontTagFailingSetSystemStateOk() throws Exception {
+ void testDontTagFailingSetSystemStateOk() throws Exception {
startingTest("StateChangeTest::testDontTagFailingSetSystemStateOk()");
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
setUpFleetController(true, options);
@@ -1055,7 +1060,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void testAlteringDistributionSplitCount() throws Exception {
+ void testAlteringDistributionSplitCount() throws Exception {
startingTest("StateChangeTest::testAlteringDistributionSplitCount");
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
options.distributionBits = 17;
@@ -1102,7 +1107,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void testSetAllTimestampsAfterDowntime() throws Exception {
+ void testSetAllTimestampsAfterDowntime() throws Exception {
startingTest("StateChangeTest::testSetAllTimestampsAfterDowntime");
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
setUpFleetController(true, options);
@@ -1135,24 +1140,24 @@ public class StateChangeTest extends FleetControllerTest {
for (ConfiguredNode i : options.nodes) {
Node nodeId = new Node(NodeType.STORAGE, i.index());
long ts = lastState.getNodeState(nodeId).getStartTimestamp();
- assertTrue(nodeId + "\n" + stateHistory + "\nWas " + ts + " should be " + fleetController.getCluster().getNodeInfo(nodeId).getStartTimestamp(), ts > 0);
+ assertTrue(ts > 0, nodeId + "\n" + stateHistory + "\nWas " + ts + " should be " + fleetController.getCluster().getNodeInfo(nodeId).getStartTimestamp());
}
} else {
for (ConfiguredNode i : options.nodes) {
Node nodeId = new Node(NodeType.STORAGE, i.index());
- assertEquals(nodeId.toString(), 0, lastState.getNodeState(nodeId).getStartTimestamp());
+ assertEquals(0, lastState.getNodeState(nodeId).getStartTimestamp(), nodeId.toString());
}
}
for (ConfiguredNode i : options.nodes) {
Node nodeId = new Node(NodeType.DISTRIBUTOR, i.index());
- assertEquals(nodeId.toString(), 0, lastState.getNodeState(nodeId).getStartTimestamp());
+ assertEquals(0, lastState.getNodeState(nodeId).getStartTimestamp(), nodeId.toString());
}
}
}
@Test
- public void consolidated_cluster_state_reflects_node_changes_when_cluster_is_down() throws Exception {
+ void consolidated_cluster_state_reflects_node_changes_when_cluster_is_down() throws Exception {
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
options.maxTransitionTime.put(NodeType.STORAGE, 0);
options.minStorageNodesUp = 10;
@@ -1166,7 +1171,7 @@ public class StateChangeTest extends FleetControllerTest {
ctrl.tick();
assertThat(ctrl.consolidatedClusterState().toString(),
- equalTo("version:4 cluster:d distributor:10 storage:10 .2.s:d"));
+ equalTo("version:4 cluster:d distributor:10 storage:10 .2.s:d"));
// After this point, any further node changes while the cluster is still down won't be published.
// This is because cluster state similarity checks are short-circuited if both are Down, as no other parts
@@ -1179,14 +1184,14 @@ public class StateChangeTest extends FleetControllerTest {
// NOTE: _same_ version, different node state content. Overall cluster down-state is still the same.
assertThat(ctrl.consolidatedClusterState().toString(),
- equalTo("version:4 cluster:d distributor:10 storage:10 .2.s:d .5.s:d"));
+ equalTo("version:4 cluster:d distributor:10 storage:10 .2.s:d .5.s:d"));
}
// Related to the above test, watchTimer invocations must receive the _current_ state and not the
// published state. Failure to ensure this would cause events to be fired non-stop, as the effect
// of previous timer invocations (with subsequent state generation) would not be visible.
@Test
- public void timer_events_during_cluster_down_observe_most_recent_node_changes() throws Exception {
+ void timer_events_during_cluster_down_observe_most_recent_node_changes() throws Exception {
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
options.maxTransitionTime.put(NodeType.STORAGE, 1000);
options.minStorageNodesUp = 10;
@@ -1210,10 +1215,10 @@ public class StateChangeTest extends FleetControllerTest {
verifyNodeEvents(new Node(NodeType.STORAGE, 2),
"Event: storage.2: Now reporting state U\n" +
- "Event: storage.2: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
- "Event: storage.2: Failed to get node state: D: foo\n" +
- "Event: storage.2: Stopped or possibly crashed after 500 ms, which is before stable state time period. Premature crash count is now 1.\n" +
- "Event: storage.2: Altered node state in cluster state from 'U' to 'M: foo'\n");
+ "Event: storage.2: Altered node state in cluster state from 'D: Node not seen in slobrok.' to 'U'\n" +
+ "Event: storage.2: Failed to get node state: D: foo\n" +
+ "Event: storage.2: Stopped or possibly crashed after 500 ms, which is before stable state time period. Premature crash count is now 1.\n" +
+ "Event: storage.2: Altered node state in cluster state from 'U' to 'M: foo'\n");
// Note: even though max transition time has passed, events are now emitted only on cluster state
// publish edges. These are currently suppressed when the cluster state is down, as all cluster down
// states are considered similar to other cluster down states. This is not necessarily optimal, but
@@ -1221,7 +1226,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void do_not_emit_multiple_events_when_node_state_does_not_match_versioned_state() throws Exception {
+ void do_not_emit_multiple_events_when_node_state_does_not_match_versioned_state() throws Exception {
FleetControllerOptions options = defaultOptions("mycluster", createNodes(10));
initialize(options);
@@ -1418,7 +1423,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void synchronous_remote_task_is_completed_when_state_is_acked_by_cluster() throws Exception {
+ void synchronous_remote_task_is_completed_when_state_is_acked_by_cluster() throws Exception {
RemoteTaskFixture fixture = createDefaultFixture();
MockTask task = fixture.scheduleVersionDependentTaskWithSideEffects();
@@ -1437,7 +1442,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void failing_task_is_immediately_completed() throws Exception {
+ void failing_task_is_immediately_completed() throws Exception {
RemoteTaskFixture fixture = createDefaultFixture();
MockTask task = fixture.scheduleFailingVersionDependentTaskWithSideEffects();
@@ -1446,7 +1451,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void no_op_synchronous_remote_task_can_complete_immediately_if_current_state_already_acked() throws Exception {
+ void no_op_synchronous_remote_task_can_complete_immediately_if_current_state_already_acked() throws Exception {
RemoteTaskFixture fixture = createFixtureWith(optionsWithZeroTransitionTime());
fixture.markStorageNodeDown(0);
MockTask task = fixture.scheduleNoOpVersionDependentTask(); // Tries to set node 0 into Down; already in that state
@@ -1459,7 +1464,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void no_op_synchronous_remote_task_waits_until_current_state_is_acked() throws Exception {
+ void no_op_synchronous_remote_task_waits_until_current_state_is_acked() throws Exception {
RemoteTaskFixture fixture = createFixtureWith(optionsWithZeroTransitionTime());
communicator.setShouldDeferDistributorClusterStateAcks(true);
@@ -1483,7 +1488,7 @@ public class StateChangeTest extends FleetControllerTest {
// tasks running in such a context as if they were no-ops. I.e. we only require
// the cluster down-state to have been published.
@Test
- public void immediately_complete_sync_remote_task_when_cluster_is_down() throws Exception {
+ void immediately_complete_sync_remote_task_when_cluster_is_down() throws Exception {
RemoteTaskFixture fixture = createFixtureWith(optionsAllowingZeroNodesDown());
// Controller options require 10/10 nodes up, so take one down to trigger a cluster Down edge.
fixture.markStorageNodeDown(1);
@@ -1497,7 +1502,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void multiple_tasks_may_be_scheduled_and_answered_at_the_same_time() throws Exception {
+ void multiple_tasks_may_be_scheduled_and_answered_at_the_same_time() throws Exception {
RemoteTaskFixture fixture = createDefaultFixture();
communicator.setShouldDeferDistributorClusterStateAcks(true);
@@ -1515,7 +1520,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void synchronous_task_immediately_failed_when_leadership_lost() throws Exception {
+ void synchronous_task_immediately_failed_when_leadership_lost() throws Exception {
FleetControllerOptions options = optionsWithZeroTransitionTime();
options.fleetControllerCount = 3;
RemoteTaskFixture fixture = createFixtureWith(options);
@@ -1540,7 +1545,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void cluster_state_ack_is_not_dependent_on_state_send_grace_period() throws Exception {
+ void cluster_state_ack_is_not_dependent_on_state_send_grace_period() throws Exception {
FleetControllerOptions options = defaultOptions();
options.minTimeBetweenNewSystemStates = 10_000;
RemoteTaskFixture fixture = createFixtureWith(options);
@@ -1560,7 +1565,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void synchronous_task_immediately_answered_when_not_leader() throws Exception {
+ void synchronous_task_immediately_answered_when_not_leader() throws Exception {
FleetControllerOptions options = optionsWithZeroTransitionTime();
options.fleetControllerCount = 3;
RemoteTaskFixture fixture = createFixtureWith(options);
@@ -1575,7 +1580,7 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void task_not_completed_within_deadline_is_failed_with_deadline_exceeded_error() throws Exception {
+ void task_not_completed_within_deadline_is_failed_with_deadline_exceeded_error() throws Exception {
FleetControllerOptions options = defaultOptions();
options.setMaxDeferredTaskVersionWaitTime(Duration.ofSeconds(60));
RemoteTaskFixture fixture = createFixtureWith(options);
@@ -1624,14 +1629,14 @@ public class StateChangeTest extends FleetControllerTest {
}
@Test
- public void task_not_completed_within_deadline_lists_nodes_not_converged_in_error_message() throws Exception {
+ void task_not_completed_within_deadline_lists_nodes_not_converged_in_error_message() throws Exception {
doTestTaskDeadlineExceeded(false, "the following nodes have not converged to " +
"at least version 4: distributor.0, distributor.1, distributor.2, distributor.3, " +
"distributor.4, distributor.5, distributor.6, distributor.7, distributor.8, distributor.9");
}
@Test
- public void task_not_completed_within_deadline_with_deferred_activation_checks_activation_version() throws Exception {
+ void task_not_completed_within_deadline_with_deferred_activation_checks_activation_version() throws Exception {
doTestTaskDeadlineExceeded(true, "the following nodes have not converged to " +
"at least version 4: distributor.0, distributor.1, distributor.2, distributor.3, " +
"distributor.4, distributor.5, distributor.6, distributor.7, distributor.8, distributor.9 " +
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateGatherTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateGatherTest.java
index 041f4e4052d..892aefbb865 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateGatherTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateGatherTest.java
@@ -2,12 +2,12 @@
package com.yahoo.vespa.clustercontroller.core;
import java.util.logging.Level;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.concurrent.TimeoutException;
import java.util.logging.Logger;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class StateGatherTest extends FleetControllerTest {
@@ -24,7 +24,7 @@ public class StateGatherTest extends FleetControllerTest {
}
@Test
- public void testAlwaysHavePendingGetNodeStateRequestTowardsNodes() throws Exception {
+ void testAlwaysHavePendingGetNodeStateRequestTowardsNodes() throws Exception {
Logger.getLogger(NodeStateGatherer.class.getName()).setLevel(Level.FINEST);
startingTest("StateGatherTest::testOverlappingGetNodeStateRequests");
FleetControllerOptions options = defaultOptions("mycluster");
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateVersionTrackerTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateVersionTrackerTest.java
index 2361a5cefd8..0e3c3c6d4b3 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateVersionTrackerTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateVersionTrackerTest.java
@@ -7,13 +7,11 @@ import com.yahoo.vdslib.state.NodeState;
import com.yahoo.vdslib.state.NodeType;
import com.yahoo.vdslib.state.State;
import com.yahoo.vespa.clustercontroller.core.hostinfo.HostInfo;
-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.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -40,7 +38,7 @@ public class StateVersionTrackerTest {
}
@Test
- public void version_is_incremented_when_new_state_is_applied() {
+ void version_is_incremented_when_new_state_is_applied() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
versionTracker.setVersionRetrievedFromZooKeeper(100);
updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:2 storage:2"), 123);
@@ -49,33 +47,33 @@ public class StateVersionTrackerTest {
}
@Test
- public void version_is_1_upon_construction() {
+ void version_is_1_upon_construction() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
assertEquals(1, versionTracker.getCurrentVersion());
}
@Test
- public void set_current_version_caps_lowest_version_to_1() {
+ void set_current_version_caps_lowest_version_to_1() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
versionTracker.setVersionRetrievedFromZooKeeper(0);
assertEquals(1, versionTracker.getCurrentVersion());
}
@Test
- public void new_version_from_zk_predicate_initially_false() {
+ void new_version_from_zk_predicate_initially_false() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
assertFalse(versionTracker.hasReceivedNewVersionFromZooKeeper());
}
@Test
- public void new_version_from_zk_predicate_true_after_setting_zk_version() {
+ void new_version_from_zk_predicate_true_after_setting_zk_version() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
versionTracker.setVersionRetrievedFromZooKeeper(5);
assertTrue(versionTracker.hasReceivedNewVersionFromZooKeeper());
}
@Test
- public void new_version_from_zk_predicate_false_after_applying_higher_version() {
+ void new_version_from_zk_predicate_false_after_applying_higher_version() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
versionTracker.setVersionRetrievedFromZooKeeper(5);
updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:2 storage:2"), 123);
@@ -83,14 +81,14 @@ public class StateVersionTrackerTest {
}
@Test
- public void exposed_states_are_empty_upon_construction() {
+ void exposed_states_are_empty_upon_construction() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
assertTrue(versionTracker.getVersionedClusterState().toString().isEmpty());
assertTrue(versionTracker.getAnnotatedVersionedClusterState().getClusterState().toString().isEmpty());
}
@Test
- public void diff_from_initial_state_implies_changed_state() {
+ void diff_from_initial_state_implies_changed_state() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
versionTracker.updateLatestCandidateStateBundle(stateBundleWithoutAnnotations("cluster:d"));
assertTrue(versionTracker.candidateChangedEnoughFromCurrentToWarrantPublish());
@@ -104,48 +102,48 @@ public class StateVersionTrackerTest {
}
@Test
- public void version_mismatch_not_counted_as_changed_state() {
+ void version_mismatch_not_counted_as_changed_state() {
assertFalse(stateChangedBetween("distributor:2 storage:2", "distributor:2 storage:2"));
}
@Test
- public void different_distributor_node_count_implies_changed_state() {
+ void different_distributor_node_count_implies_changed_state() {
assertTrue(stateChangedBetween("distributor:2 storage:2", "distributor:3 storage:2"));
assertTrue(stateChangedBetween("distributor:3 storage:2", "distributor:2 storage:2"));
}
@Test
- public void different_storage_node_count_implies_changed_state() {
+ void different_storage_node_count_implies_changed_state() {
assertTrue(stateChangedBetween("distributor:2 storage:2", "distributor:2 storage:3"));
assertTrue(stateChangedBetween("distributor:2 storage:3", "distributor:2 storage:2"));
}
@Test
- public void different_distributor_node_state_implies_changed_state() {
+ void different_distributor_node_state_implies_changed_state() {
assertTrue(stateChangedBetween("distributor:2 storage:2", "distributor:2 .0.s:d storage:2"));
assertTrue(stateChangedBetween("distributor:2 .0.s:d storage:2", "distributor:2 storage:2"));
}
@Test
- public void different_storage_node_state_implies_changed_state() {
+ void different_storage_node_state_implies_changed_state() {
assertTrue(stateChangedBetween("distributor:2 storage:2", "distributor:2 storage:2 .0.s:d"));
assertTrue(stateChangedBetween("distributor:2 storage:2 .0.s:d", "distributor:2 storage:2"));
}
@Test
- public void init_progress_change_not_counted_as_changed_state() {
+ void init_progress_change_not_counted_as_changed_state() {
assertFalse(stateChangedBetween("distributor:2 storage:2 .0.s:i .0.i:0.5",
- "distributor:2 storage:2 .0.s:i .0.i:0.6"));
+ "distributor:2 storage:2 .0.s:i .0.i:0.6"));
}
@Test
- public void lowest_observed_distribution_bit_is_initially_16() {
+ void lowest_observed_distribution_bit_is_initially_16() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
assertEquals(16, versionTracker.getLowestObservedDistributionBits());
}
@Test
- public void lowest_observed_distribution_bit_is_tracked_across_states() {
+ void lowest_observed_distribution_bit_is_tracked_across_states() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
updateAndPromote(versionTracker, stateWithoutAnnotations("bits:15 distributor:2 storage:2"), 100);
assertEquals(15, versionTracker.getLowestObservedDistributionBits());
@@ -161,7 +159,7 @@ public class StateVersionTrackerTest {
// min used bits. The former is derived from the latter, but the latter is not visible in the
// published state (but _is_ visible in the internal ClusterState structures).
@Test
- public void per_node_min_bits_changes_are_not_considered_different() {
+ void per_node_min_bits_changes_are_not_considered_different() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
final AnnotatedClusterState stateWithMinBits = stateWithoutAnnotations("distributor:2 storage:2");
stateWithMinBits.getClusterState().setNodeState(
@@ -173,7 +171,7 @@ public class StateVersionTrackerTest {
}
@Test
- public void state_history_is_initially_empty() {
+ void state_history_is_initially_empty() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
assertTrue(versionTracker.getClusterStateHistory().isEmpty());
}
@@ -188,9 +186,9 @@ public class StateVersionTrackerTest {
}
@Test
- public void applying_state_adds_to_cluster_state_history() {
+ void applying_state_adds_to_cluster_state_history() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
- updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:2 storage:2") ,100);
+ updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:2 storage:2"), 100);
updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:3 storage:3"), 200);
updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:4 storage:4"), 300);
@@ -204,11 +202,11 @@ public class StateVersionTrackerTest {
}
@Test
- public void old_states_pruned_when_state_history_limit_reached() {
+ void old_states_pruned_when_state_history_limit_reached() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
versionTracker.setMaxHistoryEntryCount(2);
- updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:2 storage:2") ,100);
+ updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:2 storage:2"), 100);
updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:3 storage:3"), 200);
updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:4 storage:4"), 300);
@@ -227,7 +225,7 @@ public class StateVersionTrackerTest {
}
@Test
- public void can_get_latest_non_published_candidate_state() {
+ void can_get_latest_non_published_candidate_state() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
AnnotatedClusterState candidate = stateWithoutAnnotations("distributor:2 storage:2");
@@ -258,7 +256,7 @@ public class StateVersionTrackerTest {
}
@Test
- public void version_change_check_takes_derived_states_into_account() {
+ void version_change_check_takes_derived_states_into_account() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
versionTracker.updateLatestCandidateStateBundle(baselineBundle(false));
versionTracker.promoteCandidateToVersionedState(1234);
@@ -273,7 +271,7 @@ public class StateVersionTrackerTest {
}
@Test
- public void buckets_pending_state_is_tracked_between_cluster_states() {
+ void buckets_pending_state_is_tracked_between_cluster_states() {
final StateVersionTracker tracker = createWithMockedMetrics();
final NodeInfo distributorNode = mock(DistributorNodeInfo.class);
when(distributorNode.isDistributor()).thenReturn(true);
@@ -307,7 +305,7 @@ public class StateVersionTrackerTest {
}
@Test
- public void setting_zookeeper_retrieved_bundle_sets_current_versioned_state_and_resets_candidate_state() {
+ void setting_zookeeper_retrieved_bundle_sets_current_versioned_state_and_resets_candidate_state() {
final StateVersionTracker versionTracker = createWithMockedMetrics();
versionTracker.setVersionRetrievedFromZooKeeper(100);
versionTracker.updateLatestCandidateStateBundle(
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/SystemStateBroadcasterTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/SystemStateBroadcasterTest.java
index 1832f1132ac..0a193766df3 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/SystemStateBroadcasterTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/SystemStateBroadcasterTest.java
@@ -8,13 +8,13 @@ import com.yahoo.vdslib.state.State;
import com.yahoo.vespa.clustercontroller.core.database.DatabaseHandler;
import com.yahoo.vespa.clustercontroller.core.listeners.SlobrokListener;
import com.yahoo.vespa.clustercontroller.core.listeners.NodeListener;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import java.util.stream.Stream;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
@@ -85,7 +85,7 @@ public class SystemStateBroadcasterTest {
}
@Test
- public void always_publish_baseline_cluster_state() {
+ void always_publish_baseline_cluster_state() {
Fixture f = new Fixture();
ClusterStateBundle stateBundle = ClusterStateBundleUtil.makeBundle("version:3 distributor:2 storage:2");
ClusterFixture cf = ClusterFixture.forFlatCluster(2).bringEntireClusterUp().assignDummyRpcAddresses();
@@ -95,7 +95,7 @@ public class SystemStateBroadcasterTest {
}
@Test
- public void non_observed_startup_timestamps_are_published_per_node_for_baseline_state() {
+ void non_observed_startup_timestamps_are_published_per_node_for_baseline_state() {
Fixture f = new Fixture();
ClusterStateBundle stateBundle = ClusterStateBundleUtil.makeBundle("version:3 distributor:2 storage:2");
ClusterFixture cf = ClusterFixture.forFlatCluster(2).bringEntireClusterUp().assignDummyRpcAddresses();
@@ -112,7 +112,7 @@ public class SystemStateBroadcasterTest {
}
@Test
- public void bucket_space_states_are_published_verbatim_when_no_additional_timestamps_needed() {
+ void bucket_space_states_are_published_verbatim_when_no_additional_timestamps_needed() {
Fixture f = new Fixture();
ClusterStateBundle stateBundle = ClusterStateBundleUtil.makeBundle("version:3 distributor:2 storage:2",
StateMapping.of("default", "version:3 distributor:2 storage:2 .0.s:d"),
@@ -125,7 +125,7 @@ public class SystemStateBroadcasterTest {
}
@Test
- public void non_observed_startup_timestamps_are_published_per_bucket_space_state() {
+ void non_observed_startup_timestamps_are_published_per_bucket_space_state() {
Fixture f = new Fixture();
ClusterStateBundle stateBundle = ClusterStateBundleUtil.makeBundle("version:3 distributor:2 storage:2",
StateMapping.of("default", "version:3 distributor:2 storage:2 .0.s:d"),
@@ -146,7 +146,7 @@ public class SystemStateBroadcasterTest {
}
@Test
- public void state_not_broadcast_if_version_not_tagged_as_written_to_zookeeper() {
+ void state_not_broadcast_if_version_not_tagged_as_written_to_zookeeper() {
Fixture f = new Fixture();
ClusterStateBundle stateBundle = ClusterStateBundleUtil.makeBundle("version:100 distributor:2 storage:2");
ClusterFixture cf = ClusterFixture.forFlatCluster(2).bringEntireClusterUp().assignDummyRpcAddresses();
@@ -159,7 +159,7 @@ public class SystemStateBroadcasterTest {
}
@Test
- public void state_is_broadcast_if_version_is_tagged_as_written_to_zookeeper() {
+ void state_is_broadcast_if_version_is_tagged_as_written_to_zookeeper() {
Fixture f = new Fixture();
ClusterStateBundle stateBundle = ClusterStateBundleUtil.makeBundle("version:100 distributor:2 storage:2");
ClusterFixture cf = ClusterFixture.forFlatCluster(2).bringEntireClusterUp().assignDummyRpcAddresses();
@@ -262,9 +262,10 @@ public class SystemStateBroadcasterTest {
}
}
+ // Type erasure of Waiter in mocked argument capture
@Test
- @SuppressWarnings("unchecked") // Type erasure of Waiter in mocked argument capture
- public void activation_not_sent_before_all_distributors_have_acked_state_bundle() {
+ @SuppressWarnings("unchecked")
+ void activation_not_sent_before_all_distributors_have_acked_state_bundle() {
var f = StateActivationFixture.withTwoPhaseEnabled();
var cf = f.cf;
@@ -292,9 +293,10 @@ public class SystemStateBroadcasterTest {
assertNull(f.broadcaster.getLastClusterStateBundleConverged());
}
+ // Type erasure of Waiter in mocked argument capture
@Test
- @SuppressWarnings("unchecked") // Type erasure of Waiter in mocked argument capture
- public void state_bundle_not_considered_converged_until_activation_acked_by_all_distributors() {
+ @SuppressWarnings("unchecked")
+ void state_bundle_not_considered_converged_until_activation_acked_by_all_distributors() {
var f = StateActivationFixture.withTwoPhaseEnabled();
var cf = f.cf;
@@ -309,22 +311,23 @@ public class SystemStateBroadcasterTest {
});
respondToActivateClusterStateVersion(cf.cluster.getNodeInfo(Node.ofDistributor(0)),
- f.stateBundle, d0ActivateWaiter.getValue());
+ f.stateBundle, d0ActivateWaiter.getValue());
f.simulateBroadcastTick(cf, 123);
assertNull(f.broadcaster.getLastClusterStateBundleConverged()); // Not yet converged
respondToActivateClusterStateVersion(cf.cluster.getNodeInfo(Node.ofDistributor(1)),
- f.stateBundle, d1ActivateWaiter.getValue());
+ f.stateBundle, d1ActivateWaiter.getValue());
f.simulateBroadcastTick(cf, 123);
// Finally, all distributors have ACKed the version! State is marked as converged.
assertEquals(f.stateBundle, f.broadcaster.getLastClusterStateBundleConverged());
}
+ // Type erasure of Waiter in mocked argument capture
@Test
- @SuppressWarnings("unchecked") // Type erasure of Waiter in mocked argument capture
- public void activation_not_sent_if_deferred_activation_is_disabled_in_state_bundle() {
+ @SuppressWarnings("unchecked")
+ void activation_not_sent_if_deferred_activation_is_disabled_in_state_bundle() {
var f = StateActivationFixture.withTwoPhaseDisabled();
var cf = f.cf;
@@ -339,9 +342,10 @@ public class SystemStateBroadcasterTest {
});
}
+ // Type erasure of Waiter in mocked argument capture
@Test
- @SuppressWarnings("unchecked") // Type erasure of Waiter in mocked argument capture
- public void activation_convergence_considers_actual_version_returned_from_node() {
+ @SuppressWarnings("unchecked")
+ void activation_convergence_considers_actual_version_returned_from_node() {
var f = StateActivationFixture.withTwoPhaseEnabled();
var cf = f.cf;
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/UpEdgeMaintenanceTransitionConstraintTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/UpEdgeMaintenanceTransitionConstraintTest.java
index 6257a10064a..5471a6ff4be 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/UpEdgeMaintenanceTransitionConstraintTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/UpEdgeMaintenanceTransitionConstraintTest.java
@@ -2,10 +2,10 @@
package com.yahoo.vespa.clustercontroller.core;
import com.yahoo.vdslib.state.ClusterState;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class UpEdgeMaintenanceTransitionConstraintTest {
@@ -19,27 +19,27 @@ public class UpEdgeMaintenanceTransitionConstraintTest {
}
@Test
- public void transition_allowed_when_previous_state_is_down() {
+ void transition_allowed_when_previous_state_is_down() {
assertTrue(nodeMayTransitionToMaintenanceInState(1, "distributor:5 storage:5 .1.s:d"));
}
@Test
- public void transition_allowed_when_previous_state_is_maintenance() {
+ void transition_allowed_when_previous_state_is_maintenance() {
assertTrue(nodeMayTransitionToMaintenanceInState(1, "distributor:5 storage:5 .1.s:m"));
}
@Test
- public void transition_not_allowed_when_previous_state_is_up() {
+ void transition_not_allowed_when_previous_state_is_up() {
assertFalse(nodeMayTransitionToMaintenanceInState(0, "distributor:5 storage:5"));
}
@Test
- public void transition_not_allowed_when_previous_state_is_initializing() {
+ void transition_not_allowed_when_previous_state_is_initializing() {
assertFalse(nodeMayTransitionToMaintenanceInState(0, "distributor:5 storage:5 .0.s:i"));
}
@Test
- public void transition_not_allowed_when_previous_state_is_retired() {
+ void transition_not_allowed_when_previous_state_is_retired() {
assertFalse(nodeMayTransitionToMaintenanceInState(0, "distributor:5 storage:5 .0.s:r"));
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/WantedStateTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/WantedStateTest.java
index a58f75dba02..7bbae78dbab 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/WantedStateTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/WantedStateTest.java
@@ -2,13 +2,14 @@
package com.yahoo.vespa.clustercontroller.core;
import com.yahoo.vdslib.state.State;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class WantedStateTest extends FleetControllerTest {
@Test
- public void testSettingStorageNodeMaintenanceAndBack() throws Exception {
+ void testSettingStorageNodeMaintenanceAndBack() throws Exception {
startingTest("WantedStateTest::testSettingStorageNodeMaintenanceAndBack()");
setUpFleetController(true, defaultOptions("mycluster"));
setUpVdsNodes(true, new DummyVdsNodeOptions());
@@ -22,7 +23,7 @@ public class WantedStateTest extends FleetControllerTest {
}
@Test
- public void testOverridingWantedStateOtherReason() throws Exception {
+ void testOverridingWantedStateOtherReason() throws Exception {
startingTest("WantedStateTest::testOverridingWantedStateOtherReason()");
setUpFleetController(true, defaultOptions("mycluster"));
setUpVdsNodes(true, new DummyVdsNodeOptions());
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ZooKeeperDatabaseTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ZooKeeperDatabaseTest.java
index 1ce7586adea..79c03a67698 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ZooKeeperDatabaseTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ZooKeeperDatabaseTest.java
@@ -4,22 +4,16 @@ package com.yahoo.vespa.clustercontroller.core;
import com.yahoo.vespa.clustercontroller.core.database.CasWriteFailed;
import com.yahoo.vespa.clustercontroller.core.database.Database;
import com.yahoo.vespa.clustercontroller.core.database.ZooKeeperDatabase;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.time.Duration;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.mock;
public class ZooKeeperDatabaseTest {
- @SuppressWarnings("deprecation")
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
private static class Fixture implements AutoCloseable {
final ZooKeeperTestServer zkServer;
ClusterFixture clusterFixture;
@@ -58,7 +52,7 @@ public class ZooKeeperDatabaseTest {
}
@Test
- public void can_store_and_load_cluster_state_bundle_from_database() throws Exception {
+ void can_store_and_load_cluster_state_bundle_from_database() throws Exception {
try (Fixture f = new Fixture()) {
f.createDatabase();
f.db().retrieveLastPublishedStateBundle(); // Must be called once prior to prime last known znode version
@@ -77,27 +71,29 @@ public class ZooKeeperDatabaseTest {
}
@Test
- public void storing_cluster_state_bundle_with_mismatching_expected_znode_version_throws_exception() throws Exception {
- expectedException.expect(CasWriteFailed.class);
- expectedException.expectMessage("version mismatch in cluster state bundle znode (expected -2)");
- try (Fixture f = new Fixture()) {
- f.createDatabase();
- f.db().storeLastPublishedStateBundle(dummyBundle());
- }
+ void storing_cluster_state_bundle_with_mismatching_expected_znode_version_throws_exception() throws Exception {
+ Throwable exception = assertThrows(CasWriteFailed.class, () -> {
+ try (Fixture f = new Fixture()) {
+ f.createDatabase();
+ f.db().storeLastPublishedStateBundle(dummyBundle());
+ }
+ });
+ assertTrue(exception.getMessage().contains("version mismatch in cluster state bundle znode (expected -2)"));
}
@Test
- public void storing_cluster_state_version_with_mismatching_expected_znode_version_throws_exception() throws Exception {
- expectedException.expect(CasWriteFailed.class);
- expectedException.expectMessage("version mismatch in cluster state version znode (expected -2)");
- try (Fixture f = new Fixture()) {
- f.createDatabase();
- f.db().storeLatestSystemStateVersion(12345);
- }
+ void storing_cluster_state_version_with_mismatching_expected_znode_version_throws_exception() throws Exception {
+ Throwable exception = assertThrows(CasWriteFailed.class, () -> {
+ try (Fixture f = new Fixture()) {
+ f.createDatabase();
+ f.db().storeLatestSystemStateVersion(12345);
+ }
+ });
+ assertTrue(exception.getMessage().contains("version mismatch in cluster state version znode (expected -2)"));
}
@Test
- public void empty_state_bundle_is_returned_if_no_bundle_already_stored_in_database() throws Exception {
+ void empty_state_bundle_is_returned_if_no_bundle_already_stored_in_database() throws Exception {
try (Fixture f = new Fixture()) {
f.createDatabase();
ClusterStateBundle bundleReceived = f.db().retrieveLastPublishedStateBundle();
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/HostInfoTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/HostInfoTest.java
index b5ad82b6b0c..3c9fd069e14 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/HostInfoTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/HostInfoTest.java
@@ -1,7 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.core.hostinfo;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@@ -13,10 +13,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.TreeMap;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
public class HostInfoTest {
@@ -29,7 +26,7 @@ public class HostInfoTest {
}
@Test
- public void testEmptyJson() {
+ void testEmptyJson() {
HostInfo hostInfo = HostInfo.createHostInfo("{}");
assertNull(hostInfo.getVtag().getVersionOrNull());
assertTrue(hostInfo.getDistributor().getStorageNodes().isEmpty());
@@ -39,13 +36,13 @@ public class HostInfoTest {
}
@Test
- public void testExtendedJson() throws IOException {
+ void testExtendedJson() throws IOException {
HostInfo hostInfo = HostInfo.createHostInfo(readDataFile("host_info.json"));
assertEquals("5.32.76", hostInfo.getVtag().getVersionOrNull());
}
@Test
- public void testFullSet() throws IOException {
+ void testFullSet() throws IOException {
HostInfo hostInfo = HostInfo.createHostInfo(readDataFile("host_info.json"));
List<StorageNode> storageNodeList = hostInfo.getDistributor().getStorageNodes();
assertEquals(2, storageNodeList.size());
@@ -59,8 +56,8 @@ public class HostInfoTest {
assertEquals(123, hostInfo.getClusterStateVersionOrNull().intValue());
assertEquals(Optional.of(129L), hostInfo.getMetrics()
- .getValueAt("vds.datastored.bucket_space.buckets_total", Map.of("bucketSpace", "default"))
- .map(Metrics.Value::getLast));
+ .getValueAt("vds.datastored.bucket_space.buckets_total", Map.of("bucketSpace", "default"))
+ .map(Metrics.Value::getLast));
assertEquals(Optional.of(0L),
hostInfo.getMetrics()
.getValueAt("vds.datastored.bucket_space.buckets_total", Map.of("bucketSpace", "global"))
@@ -75,7 +72,7 @@ public class HostInfoTest {
}
@Test
- public void testSpeed() throws Exception {
+ void testSpeed() throws Exception {
String json = readDataFile("slow_host_info.json");
long start = 0;
@@ -92,7 +89,7 @@ public class HostInfoTest {
}
@Test
- public void testSharedFile() throws Exception {
+ void testSharedFile() throws Exception {
String json = readDataFile("distributor.json");
HostInfo hostInfo = HostInfo.createHostInfo(json);
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java
index cb99dfe38e3..0eb25ab5cd4 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java
@@ -3,7 +3,7 @@ package com.yahoo.vespa.clustercontroller.core.hostinfo;
import com.yahoo.vespa.clustercontroller.core.ContentNodeStats;
import com.yahoo.vespa.clustercontroller.core.ContentClusterStats;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@@ -14,7 +14,7 @@ import java.util.Iterator;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertFalse;
/**
* @author hakonhall
@@ -29,7 +29,7 @@ public class StorageNodeStatsBridgeTest {
}
@Test
- public void testContentNodeStats() throws IOException {
+ void testContentNodeStats() throws IOException {
String data = getJsonString();
HostInfo hostInfo = HostInfo.createHostInfo(data);
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/ClusterListTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/ClusterListTest.java
index 84116674afa..8e49703c94b 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/ClusterListTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/ClusterListTest.java
@@ -2,67 +2,68 @@
package com.yahoo.vespa.clustercontroller.core.restapiv2;
import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class ClusterListTest extends StateRestApiTest {
@Test
- public void testClusterList() throws Exception {
+ void testClusterList() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("", 0));
String expected =
"{\"cluster\": {\n" +
- " \"books\": {\"link\": \"\\/cluster\\/v2\\/books\"},\n" +
- " \"music\": {\"link\": \"\\/cluster\\/v2\\/music\"}\n" +
- "}}";
+ " \"books\": {\"link\": \"\\/cluster\\/v2\\/books\"},\n" +
+ " \"music\": {\"link\": \"\\/cluster\\/v2\\/music\"}\n" +
+ "}}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
@Test
- public void testRecursiveClusterList() throws Exception {
+ void testRecursiveClusterList() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("", 1));
String expected =
"{\"cluster\": {\n" +
- " \"books\": {\n" +
- " \"state\": {\"generated\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " }},\n" +
- " \"service\": {\n" +
- " \"storage\": {\"link\": \"\\/cluster\\/v2\\/books\\/storage\"},\n" +
- " \"distributor\": {\"link\": \"\\/cluster\\/v2\\/books\\/distributor\"}\n" +
- " },\n" +
- " \"distribution-states\": {\"published\": {\n" +
- " \"baseline\": \"distributor:4 storage:4\",\n" +
- " \"bucket-spaces\": [\n" +
- " {\n" +
- " \"name\": \"default\",\n" +
- " \"state\": \"distributor:4 storage:4 .3.s:m\"\n" +
- " },\n" +
- " {\n" +
- " \"name\": \"global\",\n" +
- " \"state\": \"distributor:4 storage:4\"\n" +
- " }\n" +
- " ]\n" +
- " }}\n" +
- " },\n" +
- " \"music\": {\n" +
- " \"state\": {\"generated\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " }},\n" +
- " \"service\": {\n" +
- " \"storage\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\"},\n" +
- " \"distributor\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\"}\n" +
- " },\n" +
- " \"distribution-states\": {\"published\": {\n" +
- " \"baseline\": \"distributor:8 .0.s:d .2.s:d .4.s:d .6.s:d storage:8 .0.s:d .2.s:d .4.s:d .6.s:d\",\n" +
- " \"bucket-spaces\": []\n" +
- " }}\n" +
- " }\n" +
- "}}";
+ " \"books\": {\n" +
+ " \"state\": {\"generated\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " }},\n" +
+ " \"service\": {\n" +
+ " \"storage\": {\"link\": \"\\/cluster\\/v2\\/books\\/storage\"},\n" +
+ " \"distributor\": {\"link\": \"\\/cluster\\/v2\\/books\\/distributor\"}\n" +
+ " },\n" +
+ " \"distribution-states\": {\"published\": {\n" +
+ " \"baseline\": \"distributor:4 storage:4\",\n" +
+ " \"bucket-spaces\": [\n" +
+ " {\n" +
+ " \"name\": \"default\",\n" +
+ " \"state\": \"distributor:4 storage:4 .3.s:m\"\n" +
+ " },\n" +
+ " {\n" +
+ " \"name\": \"global\",\n" +
+ " \"state\": \"distributor:4 storage:4\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }}\n" +
+ " },\n" +
+ " \"music\": {\n" +
+ " \"state\": {\"generated\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " }},\n" +
+ " \"service\": {\n" +
+ " \"storage\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\"},\n" +
+ " \"distributor\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\"}\n" +
+ " },\n" +
+ " \"distribution-states\": {\"published\": {\n" +
+ " \"baseline\": \"distributor:8 .0.s:d .2.s:d .4.s:d .6.s:d storage:8 .0.s:d .2.s:d .4.s:d .6.s:d\",\n" +
+ " \"bucket-spaces\": []\n" +
+ " }}\n" +
+ " }\n" +
+ "}}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/ClusterTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/ClusterTest.java
index 2efb731c88c..ab9c92a6d9e 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/ClusterTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/ClusterTest.java
@@ -2,74 +2,74 @@
package com.yahoo.vespa.clustercontroller.core.restapiv2;
import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class ClusterTest extends StateRestApiTest {
@Test
- public void testCluster() throws Exception {
+ void testCluster() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("books", 0));
String expected =
"{\n" +
- " \"state\": {\"generated\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " }},\n" +
- " \"service\": {\n" +
- " \"storage\": {\"link\": \"\\/cluster\\/v2\\/books\\/storage\"},\n" +
- " \"distributor\": {\"link\": \"\\/cluster\\/v2\\/books\\/distributor\"}\n" +
- " },\n" +
- " \"distribution-states\": {\"published\": {\n" +
- " \"baseline\": \"distributor:4 storage:4\",\n" +
- " \"bucket-spaces\": [\n" +
- " {\n" +
- " \"name\": \"default\",\n" +
- " \"state\": \"distributor:4 storage:4 .3.s:m\"\n" +
- " },\n" +
- " {\n" +
- " \"name\": \"global\",\n" +
- " \"state\": \"distributor:4 storage:4\"\n" +
- " }\n" +
- " ]\n" +
- " }}\n" +
- "}";
+ " \"state\": {\"generated\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " }},\n" +
+ " \"service\": {\n" +
+ " \"storage\": {\"link\": \"\\/cluster\\/v2\\/books\\/storage\"},\n" +
+ " \"distributor\": {\"link\": \"\\/cluster\\/v2\\/books\\/distributor\"}\n" +
+ " },\n" +
+ " \"distribution-states\": {\"published\": {\n" +
+ " \"baseline\": \"distributor:4 storage:4\",\n" +
+ " \"bucket-spaces\": [\n" +
+ " {\n" +
+ " \"name\": \"default\",\n" +
+ " \"state\": \"distributor:4 storage:4 .3.s:m\"\n" +
+ " },\n" +
+ " {\n" +
+ " \"name\": \"global\",\n" +
+ " \"state\": \"distributor:4 storage:4\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }}\n" +
+ "}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
@Test
- public void testRecursiveCluster() throws Exception {
+ void testRecursiveCluster() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("music", 1));
String expected =
"{\n" +
- " \"state\": {\"generated\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " }},\n" +
- " \"service\": {\n" +
- " \"storage\": {\"node\": {\n" +
- " \"1\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/1\"},\n" +
- " \"2\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/2\"},\n" +
- " \"3\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/3\"},\n" +
- " \"5\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/5\"},\n" +
- " \"7\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/7\"}\n" +
- " }},\n" +
- " \"distributor\": {\"node\": {\n" +
- " \"1\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/1\"},\n" +
- " \"2\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/2\"},\n" +
- " \"3\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/3\"},\n" +
- " \"5\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/5\"},\n" +
- " \"7\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/7\"}\n" +
- " }}\n" +
- " },\n" +
- " \"distribution-states\": {\"published\": {\n" +
- " \"baseline\": \"distributor:8 .0.s:d .2.s:d .4.s:d .6.s:d storage:8 .0.s:d .2.s:d .4.s:d .6.s:d\",\n" +
- " \"bucket-spaces\": []\n" +
- " }}\n" +
- "}";
+ " \"state\": {\"generated\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " }},\n" +
+ " \"service\": {\n" +
+ " \"storage\": {\"node\": {\n" +
+ " \"1\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/1\"},\n" +
+ " \"2\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/2\"},\n" +
+ " \"3\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/3\"},\n" +
+ " \"5\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/5\"},\n" +
+ " \"7\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/7\"}\n" +
+ " }},\n" +
+ " \"distributor\": {\"node\": {\n" +
+ " \"1\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/1\"},\n" +
+ " \"2\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/2\"},\n" +
+ " \"3\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/3\"},\n" +
+ " \"5\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/5\"},\n" +
+ " \"7\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/7\"}\n" +
+ " }}\n" +
+ " },\n" +
+ " \"distribution-states\": {\"published\": {\n" +
+ " \"baseline\": \"distributor:8 .0.s:d .2.s:d .4.s:d .6.s:d storage:8 .0.s:d .2.s:d .4.s:d .6.s:d\",\n" +
+ " \"bucket-spaces\": []\n" +
+ " }}\n" +
+ "}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/NodeTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/NodeTest.java
index 38fab2f5c54..52c46215e50 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/NodeTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/NodeTest.java
@@ -8,99 +8,99 @@ import com.yahoo.vdslib.state.State;
import com.yahoo.vespa.clustercontroller.core.ContentCluster;
import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse;
import org.codehaus.jettison.json.JSONObject;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class NodeTest extends StateRestApiTest {
@Test
- public void testDistributor() throws Exception {
+ void testDistributor() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("music/distributor/1", 0));
String expected =
"{\n" +
- " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" +
- " \"state\": {\n" +
- " \"generated\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " },\n" +
- " \"unit\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " },\n" +
- " \"user\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " }\n" +
- " }\n" +
- "}";
+ " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" +
+ " \"state\": {\n" +
+ " \"generated\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " },\n" +
+ " \"unit\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " },\n" +
+ " \"user\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " }\n" +
+ " }\n" +
+ "}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
@Test
- public void testStorage() throws Exception {
+ void testStorage() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("music/storage/1", 0));
String expected =
"{\n" +
- " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" +
- " \"state\": {\n" +
- " \"generated\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " },\n" +
- " \"unit\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " },\n" +
- " \"user\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " }\n" +
- " },\n" +
- " \"metrics\": {\n" +
- " \"bucket-count\": 1,\n" +
- " \"unique-document-count\": 2,\n" +
- " \"unique-document-total-size\": 3\n" +
- " }\n" +
- "}";
+ " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" +
+ " \"state\": {\n" +
+ " \"generated\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " },\n" +
+ " \"unit\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " },\n" +
+ " \"user\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " }\n" +
+ " },\n" +
+ " \"metrics\": {\n" +
+ " \"bucket-count\": 1,\n" +
+ " \"unique-document-count\": 2,\n" +
+ " \"unique-document-total-size\": 3\n" +
+ " }\n" +
+ "}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
@Test
- public void testRecursiveNode() throws Exception {
+ void testRecursiveNode() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("music/storage/1", 1));
String expected =
"{\n" +
- " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" +
- " \"state\": {\n" +
- " \"generated\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " },\n" +
- " \"unit\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " },\n" +
- " \"user\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " }\n" +
- " },\n" +
- " \"metrics\": {\n" +
- " \"bucket-count\": 1,\n" +
- " \"unique-document-count\": 2,\n" +
- " \"unique-document-total-size\": 3\n" +
- " }\n" +
- "}";
+ " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" +
+ " \"state\": {\n" +
+ " \"generated\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " },\n" +
+ " \"unit\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " },\n" +
+ " \"user\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " }\n" +
+ " },\n" +
+ " \"metrics\": {\n" +
+ " \"bucket-count\": 1,\n" +
+ " \"unique-document-count\": 2,\n" +
+ " \"unique-document-total-size\": 3\n" +
+ " }\n" +
+ "}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
@Test
- public void testNodeNotSeenInSlobrok() throws Exception {
+ void testNodeNotSeenInSlobrok() throws Exception {
setUp(true);
ContentCluster old = music.context.cluster;
music.context.cluster = new ContentCluster(old.getName(), old.getConfiguredNodes().values(), old.getDistribution());
@@ -110,22 +110,22 @@ public class NodeTest extends StateRestApiTest {
UnitResponse response = restAPI.getState(new StateRequest("music/storage/1", 0));
String expected =
"{\n" +
- " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" +
- " \"state\": {\n" +
- " \"generated\": {\n" +
- " \"state\": \"down\",\n" +
- " \"reason\": \"Not seen\"\n" +
- " },\n" +
- " \"unit\": {\n" +
- " \"state\": \"down\",\n" +
- " \"reason\": \"Node not seen in slobrok.\"\n" +
- " },\n" +
- " \"user\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " }\n" +
- " }\n" +
- "}";
+ " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" +
+ " \"state\": {\n" +
+ " \"generated\": {\n" +
+ " \"state\": \"down\",\n" +
+ " \"reason\": \"Not seen\"\n" +
+ " },\n" +
+ " \"unit\": {\n" +
+ " \"state\": \"down\",\n" +
+ " \"reason\": \"Node not seen in slobrok.\"\n" +
+ " },\n" +
+ " \"user\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " }\n" +
+ " }\n" +
+ "}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/NotMasterTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/NotMasterTest.java
index d85cf95defc..15aeded2d37 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/NotMasterTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/NotMasterTest.java
@@ -5,19 +5,17 @@ import com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.OtherMasterEx
import com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.UnknownMasterException;
import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse;
import static com.yahoo.vespa.defaults.Defaults.getDefaults;
-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.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
public class NotMasterTest extends StateRestApiTest {
@Test
- public void testUnknownMaster() throws Exception {
+ void testUnknownMaster() throws Exception {
setUp(true);
music.fleetControllerMaster = null;
- // Non-recursive cluster list works, as it doesn't touches into fleetcontrollers
+ // Non-recursive cluster list works, as it doesn't touches into fleetcontrollers
{
UnitResponse response = restAPI.getState(new StateRequest("", 0));
String expected =
@@ -27,49 +25,49 @@ public class NotMasterTest extends StateRestApiTest {
"}}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
- // Recursive cluster list does not work
- try{
+ // Recursive cluster list does not work
+ try {
restAPI.getState(new StateRequest("", 1));
fail();
} catch (UnknownMasterException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("No known master cluster controller"));
+ assertTrue(e.getMessage().contains("No known master cluster controller"), e.getMessage());
}
- // Other requests does not work either
- try{
+ // Other requests does not work either
+ try {
restAPI.getState(new StateRequest("music", 0));
fail();
} catch (UnknownMasterException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("No known master cluster controller"));
+ assertTrue(e.getMessage().contains("No known master cluster controller"), e.getMessage());
}
- try{
+ try {
restAPI.getState(new StateRequest("music/storage", 0));
fail();
} catch (UnknownMasterException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("No known master cluster controller"));
+ assertTrue(e.getMessage().contains("No known master cluster controller"), e.getMessage());
}
- try{
+ try {
restAPI.getState(new StateRequest("music/storage/1", 0));
fail();
} catch (UnknownMasterException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("No known master cluster controller"));
+ assertTrue(e.getMessage().contains("No known master cluster controller"), e.getMessage());
}
- try{
+ try {
restAPI.getState(new StateRequest("music/storage/1/0", 0));
fail();
} catch (UnknownMasterException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("No known master cluster controller"));
+ assertTrue(e.getMessage().contains("No known master cluster controller"), e.getMessage());
}
- try{
+ try {
restAPI.setUnitState(new SetNodeStateTest.SetUnitStateRequestImpl("music/storage/1")
- .setNewState("user", "down", "test"));
+ .setNewState("user", "down", "test"));
fail();
} catch (UnknownMasterException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("No known master cluster controller"));
+ assertTrue(e.getMessage().contains("No known master cluster controller"), e.getMessage());
}
}
@Test
- public void testKnownOtherMaster() throws Exception {
+ void testKnownOtherMaster() throws Exception {
setUp(true);
ccSockets.put(1, new ClusterControllerStateRestAPI.Socket("otherhost", getDefaults().vespaWebServicePort()));
music.fleetControllerMaster = 1;
@@ -78,59 +76,59 @@ public class NotMasterTest extends StateRestApiTest {
UnitResponse response = restAPI.getState(new StateRequest("", 0));
String expected =
"{\"cluster\": {\n" +
- " \"books\": {\"link\": \"\\/cluster\\/v2\\/books\"},\n" +
- " \"music\": {\"link\": \"\\/cluster\\/v2\\/music\"}\n" +
- "}}";
+ " \"books\": {\"link\": \"\\/cluster\\/v2\\/books\"},\n" +
+ " \"music\": {\"link\": \"\\/cluster\\/v2\\/music\"}\n" +
+ "}}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
// Recursive cluster list does not work
- try{
+ try {
restAPI.getState(new StateRequest("", 1));
fail();
} catch (OtherMasterException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("Cluster controller not master. Use master at otherhost:" + getDefaults().vespaWebServicePort() + "."));
+ assertTrue(e.getMessage().contains("Cluster controller not master. Use master at otherhost:" + getDefaults().vespaWebServicePort() + "."), e.getMessage());
assertEquals("otherhost", e.getHost());
assertEquals(e.getPort(), getDefaults().vespaWebServicePort());
}
// Other requests does not work either
- try{
+ try {
restAPI.getState(new StateRequest("music", 0));
fail();
} catch (OtherMasterException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("Cluster controller not master. Use master at otherhost:" + getDefaults().vespaWebServicePort() + "."));
+ assertTrue(e.getMessage().contains("Cluster controller not master. Use master at otherhost:" + getDefaults().vespaWebServicePort() + "."), e.getMessage());
assertEquals("otherhost", e.getHost());
assertEquals(e.getPort(), getDefaults().vespaWebServicePort());
}
- try{
+ try {
restAPI.getState(new StateRequest("music/storage", 0));
fail();
} catch (OtherMasterException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("Cluster controller not master. Use master at otherhost:" + getDefaults().vespaWebServicePort() + "."));
+ assertTrue(e.getMessage().contains("Cluster controller not master. Use master at otherhost:" + getDefaults().vespaWebServicePort() + "."), e.getMessage());
assertEquals("otherhost", e.getHost());
assertEquals(e.getPort(), getDefaults().vespaWebServicePort());
}
- try{
+ try {
restAPI.getState(new StateRequest("music/storage/1", 0));
fail();
} catch (OtherMasterException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("Cluster controller not master. Use master at otherhost:" + getDefaults().vespaWebServicePort() + "."));
+ assertTrue(e.getMessage().contains("Cluster controller not master. Use master at otherhost:" + getDefaults().vespaWebServicePort() + "."), e.getMessage());
assertEquals("otherhost", e.getHost());
assertEquals(e.getPort(), getDefaults().vespaWebServicePort());
}
- try{
+ try {
restAPI.getState(new StateRequest("music/storage/1/0", 0));
fail();
} catch (OtherMasterException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("Cluster controller not master. Use master at otherhost:" + getDefaults().vespaWebServicePort() + "."));
+ assertTrue(e.getMessage().contains("Cluster controller not master. Use master at otherhost:" + getDefaults().vespaWebServicePort() + "."), e.getMessage());
assertEquals("otherhost", e.getHost());
assertEquals(e.getPort(), getDefaults().vespaWebServicePort());
}
- try{
+ try {
restAPI.setUnitState(new SetNodeStateTest.SetUnitStateRequestImpl("music/storage/1")
.setNewState("user", "down", "test"));
fail();
} catch (OtherMasterException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("Cluster controller not master. Use master at otherhost:" + getDefaults().vespaWebServicePort() + "."));
+ assertTrue(e.getMessage().contains("Cluster controller not master. Use master at otherhost:" + getDefaults().vespaWebServicePort() + "."), e.getMessage());
assertEquals("otherhost", e.getHost());
assertEquals(e.getPort(), getDefaults().vespaWebServicePort());
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/PartitionTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/PartitionTest.java
index ec60adf16d3..65acea02d34 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/PartitionTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/PartitionTest.java
@@ -3,47 +3,47 @@ package com.yahoo.vespa.clustercontroller.core.restapiv2;
import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse;
import org.codehaus.jettison.json.JSONObject;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class PartitionTest extends StateRestApiTest {
@Test
- public void testPartition() throws Exception {
+ void testPartition() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("music/storage/1/0", 0));
String expected =
"{\n" +
- " \"state\": {\"generated\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " }},\n" +
- " \"metrics\": {\n" +
- " \"bucket-count\": 1,\n" +
- " \"unique-document-count\": 2,\n" +
- " \"unique-document-total-size\": 3\n" +
- " }\n" +
- "}";
+ " \"state\": {\"generated\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " }},\n" +
+ " \"metrics\": {\n" +
+ " \"bucket-count\": 1,\n" +
+ " \"unique-document-count\": 2,\n" +
+ " \"unique-document-total-size\": 3\n" +
+ " }\n" +
+ "}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
@Test
- public void testRecursiveCluster() throws Exception {
+ void testRecursiveCluster() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("music/storage/1/0", 1));
String expected =
"{\n" +
- " \"state\": {\"generated\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " }},\n" +
- " \"metrics\": {\n" +
- " \"bucket-count\": 1,\n" +
- " \"unique-document-count\": 2,\n" +
- " \"unique-document-total-size\": 3\n" +
- " }\n" +
- "}";
+ " \"state\": {\"generated\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " }},\n" +
+ " \"metrics\": {\n" +
+ " \"bucket-count\": 1,\n" +
+ " \"unique-document-count\": 2,\n" +
+ " \"unique-document-total-size\": 3\n" +
+ " }\n" +
+ "}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/RequestTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/RequestTest.java
index ec8e7855db6..adbf24bc4d1 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/RequestTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/RequestTest.java
@@ -2,22 +2,21 @@
package com.yahoo.vespa.clustercontroller.core.restapiv2;
import com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.InternalFailure;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
public class RequestTest {
@Test
- public void testGetResultBeforeCompletion() {
+ void testGetResultBeforeCompletion() {
Request<String> r = new Request<>(Request.MasterState.MUST_BE_MASTER) {
@Override
public String calculateResult(Context context) {
return "foo";
}
};
- try{
+ try {
r.getResult();
fail();
} catch (InternalFailure e) {
@@ -25,7 +24,7 @@ public class RequestTest {
fail();
}
r.notifyCompleted();
- try{
+ try {
r.getResult();
fail();
} catch (InternalFailure e) {
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/ServiceTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/ServiceTest.java
index f2aa00ea13e..2e5b610a039 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/ServiceTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/ServiceTest.java
@@ -2,119 +2,119 @@
package com.yahoo.vespa.clustercontroller.core.restapiv2;
import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class ServiceTest extends StateRestApiTest {
@Test
- public void testService() throws Exception {
+ void testService() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("music/distributor", 0));
String expected =
"{\"node\": {\n" +
- " \"1\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/1\"},\n" +
- " \"2\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/2\"},\n" +
- " \"3\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/3\"},\n" +
- " \"5\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/5\"},\n" +
- " \"7\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/7\"}\n" +
- "}}";
+ " \"1\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/1\"},\n" +
+ " \"2\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/2\"},\n" +
+ " \"3\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/3\"},\n" +
+ " \"5\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/5\"},\n" +
+ " \"7\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/7\"}\n" +
+ "}}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
@Test
- public void testRecursiveCluster() throws Exception {
+ void testRecursiveCluster() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("music/distributor", 1));
String expected =
"{\"node\": {\n" +
- " \"1\": {\n" +
- " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" +
- " \"state\": {\n" +
- " \"generated\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " },\n" +
- " \"unit\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " },\n" +
- " \"user\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " }\n" +
- " }\n" +
- " },\n" +
- " \"2\": {\n" +
- " \"attributes\": {\"hierarchical-group\": \"east.g1\"},\n" +
- " \"state\": {\n" +
- " \"generated\": {\n" +
- " \"state\": \"down\",\n" +
- " \"reason\": \"\"\n" +
- " },\n" +
- " \"unit\": {\n" +
- " \"state\": \"down\",\n" +
- " \"reason\": \"Node not seen in slobrok.\"\n" +
- " },\n" +
- " \"user\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " }\n" +
- " }\n" +
- " },\n" +
- " \"3\": {\n" +
- " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" +
- " \"state\": {\n" +
- " \"generated\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " },\n" +
- " \"unit\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " },\n" +
- " \"user\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " }\n" +
- " }\n" +
- " },\n" +
- " \"5\": {\n" +
- " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" +
- " \"state\": {\n" +
- " \"generated\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " },\n" +
- " \"unit\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " },\n" +
- " \"user\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " }\n" +
- " }\n" +
- " },\n" +
- " \"7\": {\n" +
- " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" +
- " \"state\": {\n" +
- " \"generated\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " },\n" +
- " \"unit\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " },\n" +
- " \"user\": {\n" +
- " \"state\": \"up\",\n" +
- " \"reason\": \"\"\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}}";
+ " \"1\": {\n" +
+ " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" +
+ " \"state\": {\n" +
+ " \"generated\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " },\n" +
+ " \"unit\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " },\n" +
+ " \"user\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " }\n" +
+ " }\n" +
+ " },\n" +
+ " \"2\": {\n" +
+ " \"attributes\": {\"hierarchical-group\": \"east.g1\"},\n" +
+ " \"state\": {\n" +
+ " \"generated\": {\n" +
+ " \"state\": \"down\",\n" +
+ " \"reason\": \"\"\n" +
+ " },\n" +
+ " \"unit\": {\n" +
+ " \"state\": \"down\",\n" +
+ " \"reason\": \"Node not seen in slobrok.\"\n" +
+ " },\n" +
+ " \"user\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " }\n" +
+ " }\n" +
+ " },\n" +
+ " \"3\": {\n" +
+ " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" +
+ " \"state\": {\n" +
+ " \"generated\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " },\n" +
+ " \"unit\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " },\n" +
+ " \"user\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " }\n" +
+ " }\n" +
+ " },\n" +
+ " \"5\": {\n" +
+ " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" +
+ " \"state\": {\n" +
+ " \"generated\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " },\n" +
+ " \"unit\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " },\n" +
+ " \"user\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " }\n" +
+ " }\n" +
+ " },\n" +
+ " \"7\": {\n" +
+ " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" +
+ " \"state\": {\n" +
+ " \"generated\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " },\n" +
+ " \"unit\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " },\n" +
+ " \"user\": {\n" +
+ " \"state\": \"up\",\n" +
+ " \"reason\": \"\"\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
+ "}}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/SetNodeStateTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/SetNodeStateTest.java
index 685ad3f0b43..1b52194b270 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/SetNodeStateTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/SetNodeStateTest.java
@@ -18,9 +18,7 @@ import com.yahoo.vespa.clustercontroller.utils.staterestapi.requests.SetUnitStat
import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.SetResponse;
import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse;
import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitState;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
import java.time.Clock;
import java.time.Duration;
@@ -32,11 +30,7 @@ import java.util.regex.Pattern;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.StringContains.containsString;
-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.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.Mockito.mock;
@@ -44,10 +38,6 @@ import static org.mockito.Mockito.when;
public class SetNodeStateTest extends StateRestApiTest {
- @SuppressWarnings("deprecation")
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
public static class SetUnitStateRequestImpl extends StateRequest implements SetUnitStateRequest {
private final Map<String, UnitState> newStates = new LinkedHashMap<>();
private Condition condition = Condition.FORCE;
@@ -176,7 +166,7 @@ public class SetNodeStateTest extends StateRestApiTest {
}
@Test
- public void testSimple() throws Exception {
+ void testSimple() throws Exception {
setUp(true);
verifyStateSet("down", "testing");
verifyStateSet("up", "foo");
@@ -186,14 +176,14 @@ public class SetNodeStateTest extends StateRestApiTest {
}
@Test
- public void testSetNodesForCluster() throws Exception {
+ void testSetNodesForCluster() throws Exception {
setUp(true);
verifyClusterSet("maintenance", "prepare for maintenance");
verifyClusterSet("up", "and we're back online");
}
@Test
- public void testShouldNotModifyDistributorSafe() throws Exception {
+ void testShouldNotModifyDistributorSafe() throws Exception {
setUp(false);
SetResponse setResponse = restAPI.setUnitState(new SetUnitStateRequestImpl("music/distributor/1")
.setNewState("user", "up", "whatever reason.")
@@ -204,7 +194,7 @@ public class SetNodeStateTest extends StateRestApiTest {
}
@Test
- public void testShouldModifyStorageSafeOk() throws Exception {
+ void testShouldModifyStorageSafeOk() throws Exception {
setUp(false);
SetResponse setResponse = restAPI.setUnitState(new SetUnitStateRequestImpl("music/storage/2")
.setNewState("user", "maintenance", "whatever reason.")
@@ -214,7 +204,7 @@ public class SetNodeStateTest extends StateRestApiTest {
}
@Test
- public void testShouldModifyStorageSafeBlocked() throws Exception {
+ void testShouldModifyStorageSafeBlocked() throws Exception {
// Sets up 2 groups: [0, 2, 4] and [1, 3, 5]
setUpMusicGroup(6, "");
@@ -254,7 +244,7 @@ public class SetNodeStateTest extends StateRestApiTest {
}
@Test
- public void settingSafeMaintenanceWhenNodeDown() throws Exception {
+ void settingSafeMaintenanceWhenNodeDown() throws Exception {
// Sets up 2 groups: [0, 2, 4] and [1, 3, 5], with 1 being down
setUpMusicGroup(6, " .1.s:d");
assertUnitState(1, "generated", State.DOWN, "");
@@ -289,7 +279,7 @@ public class SetNodeStateTest extends StateRestApiTest {
UnitResponse response = restAPI.getState(new StateRequest(path, 0));
Response.NodeResponse nodeResponse = (Response.NodeResponse) response;
UnitState unitState = nodeResponse.getStatePerType().get(type);
- assertNotNull("No such type " + type + " at path " + path, unitState);
+ assertNotNull(unitState, "No such type " + type + " at path " + path);
assertEquals(state.toString().toLowerCase(), unitState.getId());
assertEquals(reason, unitState.getReason());
}
@@ -326,19 +316,18 @@ public class SetNodeStateTest extends StateRestApiTest {
Matcher matcher = Pattern.compile(reasonRegex).matcher(setResponse.getReason());
String errorMessage = "Expected reason to match '" + reasonRegex + "', but got: " + setResponse.getReason() + "'";
- assertTrue(errorMessage, matcher.find());
+ assertTrue(matcher.find(), errorMessage);
int alreadyMaintainedIndex = Integer.parseInt(matcher.group(1));
// Example: Say index 1 is in maintenance, and we try to set 2 in maintenance. This should
// NOT be allowed, since 2 is in a different group than 1.
- assertEquals("Tried to set " + index + " in maintenance, but got: " + setResponse.getReason(),
- index % 2, (alreadyMaintainedIndex + 1) % 2);
+ assertEquals(index % 2, (alreadyMaintainedIndex + 1) % 2, "Tried to set " + index + " in maintenance, but got: " + setResponse.getReason());
assertThat(setResponse.getWasModified(), is(false));
}
@Test
- public void testSetWantedStateOnNodeNotInSlobrok() throws Exception {
+ void testSetWantedStateOnNodeNotInSlobrok() throws Exception {
// Node 2 in cluster music does not have a valid NodeInfo due to passing true to setUp
setUp(true);
restAPI.setUnitState(new SetUnitStateRequestImpl("music/distributor/2").setNewState("user", "down", "borked node"));
@@ -348,73 +337,73 @@ public class SetNodeStateTest extends StateRestApiTest {
}
@Test
- public void testWrongUnit() throws Exception {
+ void testWrongUnit() throws Exception {
setUp(true);
String wrongUnitMessage = "State can only be set at cluster or node level";
- try{
+ try {
restAPI.setUnitState(new SetUnitStateRequestImpl(
"").setNewState("user", "down", "testing"));
fail();
} catch (OperationNotSupportedForUnitException e) {
- assertTrue(e.getMessage(), e.getMessage().contains(wrongUnitMessage));
+ assertTrue(e.getMessage().contains(wrongUnitMessage), e.getMessage());
}
// ... setting at cluster-level is allowed
- try{
+ try {
restAPI.setUnitState(new SetUnitStateRequestImpl(
"music/distributor").setNewState("user", "down", "testing"));
fail();
} catch (OperationNotSupportedForUnitException e) {
- assertTrue(e.getMessage(), e.getMessage().contains(wrongUnitMessage));
+ assertTrue(e.getMessage().contains(wrongUnitMessage), e.getMessage());
}
// ... setting at node-level is allowed
- try{
+ try {
restAPI.setUnitState(new SetUnitStateRequestImpl(
"music/storage/1/0").setNewState("user", "down", "testing"));
fail();
} catch (OperationNotSupportedForUnitException e) {
- assertTrue(e.getMessage(), e.getMessage().contains(wrongUnitMessage));
+ assertTrue(e.getMessage().contains(wrongUnitMessage), e.getMessage());
}
}
@Test
- public void testInvalidUnit() throws Exception {
+ void testInvalidUnit() throws Exception {
setUp(true);
- try{
+ try {
restAPI.setUnitState(new SetUnitStateRequestImpl(
"foo").setNewState("user", "down", "testing"));
fail();
} catch (MissingUnitException e) {
}
- try{
+ try {
restAPI.setUnitState(new SetUnitStateRequestImpl(
"music/content").setNewState("user", "down", "testing"));
fail();
} catch (MissingUnitException e) {
}
- try{
+ try {
restAPI.setUnitState(new SetUnitStateRequestImpl(
"music/storage/bah").setNewState("user", "down", "testing"));
fail();
} catch (MissingUnitException e) {
}
- try{
+ try {
restAPI.setUnitState(new SetUnitStateRequestImpl(
"music/storage/10").setNewState("user", "down", "testing"));
fail();
} catch (MissingUnitException e) {
}
- try{
+ try {
restAPI.setUnitState(new SetUnitStateRequestImpl(
"music/storage/1/0/1").setNewState("user", "down", "testing"));
fail();
} catch (MissingUnitException e) {
}
- try{
+ try {
restAPI.setUnitState(new SetUnitStateRequestImpl(
"music/storage/1/bar").setNewState("user", "down", "testing"));
fail();
@@ -423,71 +412,71 @@ public class SetNodeStateTest extends StateRestApiTest {
}
@Test
- public void testSettingInvalidStateType() throws Exception {
+ void testSettingInvalidStateType() throws Exception {
setUp(true);
- try{
+ try {
restAPI.setUnitState(new SetUnitStateRequestImpl(
"music/distributor/1").setNewState("foo", "down", "testing"));
} catch (InvalidContentException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("No new user state given"));
+ assertTrue(e.getMessage().contains("No new user state given"), e.getMessage());
}
}
@Test
- public void testSafeIsInvalidForSetNodesStatesForCluster() throws Exception {
+ void testSafeIsInvalidForSetNodesStatesForCluster() throws Exception {
setUp(true);
- try{
+ try {
restAPI.setUnitState(new SetUnitStateRequestImpl("music")
.setNewState("user", "maintenance", "example reason")
.setCondition(SetUnitStateRequest.Condition.SAFE));
} catch (InvalidContentException e) {
- assertTrue(e.getMessage(), e.getMessage().contains(
- "Setting all nodes in a cluster to a state is only supported with FORCE"));
+ assertTrue(e.getMessage().contains(
+ "Setting all nodes in a cluster to a state is only supported with FORCE"), e.getMessage());
}
}
@Test
- public void testSettingWrongStateType() throws Exception {
+ void testSettingWrongStateType() throws Exception {
setUp(true);
- try{
+ try {
restAPI.setUnitState(new SetUnitStateRequestImpl(
"music/distributor/1").setNewState("generated", "down", "testing"));
} catch (InvalidContentException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("No new user state given"));
+ assertTrue(e.getMessage().contains("No new user state given"), e.getMessage());
}
- try{
+ try {
restAPI.setUnitState(new SetUnitStateRequestImpl(
"music/distributor/1").setNewState("unit", "down", "testing"));
} catch (InvalidContentException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("No new user state given"));
+ assertTrue(e.getMessage().contains("No new user state given"), e.getMessage());
}
}
@Test
- public void testInvalidState() throws Exception {
+ void testInvalidState() throws Exception {
setUp(true);
- try{
+ try {
restAPI.setUnitState(new SetUnitStateRequestImpl(
"music/distributor/1").setNewState("user", "initializing", "testing"));
} catch (InvalidContentException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("Invalid user state"));
+ assertTrue(e.getMessage().contains("Invalid user state"), e.getMessage());
}
- try{
+ try {
restAPI.setUnitState(new SetUnitStateRequestImpl(
"music/distributor/1").setNewState("user", "stopping", "testing"));
} catch (InvalidContentException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("Invalid user state"));
+ assertTrue(e.getMessage().contains("Invalid user state"), e.getMessage());
}
- try{
+ try {
restAPI.setUnitState(new SetUnitStateRequestImpl(
"music/distributor/1").setNewState("user", "foo", "testing"));
} catch (InvalidContentException e) {
- assertTrue(e.getMessage(), e.getMessage().contains("Invalid user state"));
+ assertTrue(e.getMessage().contains("Invalid user state"), e.getMessage());
}
}
@Test
- public void testOverwriteReason() throws Exception {
+ void testOverwriteReason() throws Exception {
setUp(true);
restAPI.setUnitState(new SetUnitStateRequestImpl(
"music/distributor/1").setNewState("user", "down", "testing"));
@@ -508,19 +497,19 @@ public class SetNodeStateTest extends StateRestApiTest {
}
@Test
- public void set_node_state_requests_are_by_default_tagged_as_having_version_ack_dependency() {
+ void set_node_state_requests_are_by_default_tagged_as_having_version_ack_dependency() {
SetNodeStateRequest request = createDummySetNodeStateRequest();
assertTrue(request.hasVersionAckDependency());
}
@Test
- public void set_node_state_requests_not_initially_marked_as_failed() {
+ void set_node_state_requests_not_initially_marked_as_failed() {
SetNodeStateRequest request = createDummySetNodeStateRequest();
assertFalse(request.isFailed());
}
@Test
- public void set_node_state_requests_may_override_version_ack_dependency() {
+ void set_node_state_requests_may_override_version_ack_dependency() {
SetNodeStateRequest request = new SetNodeStateRequest(createDummyId(), new SetUnitStateRequestImpl("music/storage/1")
.setNewState("user", "maintenance", "whatever reason.")
.setResponseWait(SetUnitStateRequest.ResponseWait.NO_WAIT));
@@ -531,40 +520,42 @@ public class SetNodeStateTest extends StateRestApiTest {
// important to test (and expected to happen) for requests that have dependencies on cluster
// state version publishing.
@Test
- public void leadership_loss_fails_set_node_state_request() throws Exception {
- expectedException.expectMessage("Leadership lost before request could complete");
- expectedException.expect(UnknownMasterException.class);
+ void leadership_loss_fails_set_node_state_request() throws Exception {
+ Throwable exception = assertThrows(UnknownMasterException.class, () -> {
- SetNodeStateRequest request = createDummySetNodeStateRequest();
- request.handleFailure(RemoteClusterControllerTask.Failure.of(RemoteClusterControllerTask.FailureCondition.LEADERSHIP_LOST));
- request.getResult();
+ SetNodeStateRequest request = createDummySetNodeStateRequest();
+ request.handleFailure(RemoteClusterControllerTask.Failure.of(RemoteClusterControllerTask.FailureCondition.LEADERSHIP_LOST));
+ request.getResult();
+ });
+ assertTrue(exception.getMessage().contains("Leadership lost before request could complete"));
}
@Test
- public void leadership_loss_marks_request_as_failed_for_early_out_response() {
+ void leadership_loss_marks_request_as_failed_for_early_out_response() {
SetNodeStateRequest request = createDummySetNodeStateRequest();
request.handleFailure(RemoteClusterControllerTask.Failure.of(RemoteClusterControllerTask.FailureCondition.LEADERSHIP_LOST));
assertTrue(request.isFailed());
}
@Test
- public void deadline_exceeded_fails_set_node_state_request() throws Exception {
- expectedException.expectMessage("Task exceeded its version wait deadline: gremlins in the computer");
- expectedException.expect(DeadlineExceededException.class);
+ void deadline_exceeded_fails_set_node_state_request() throws Exception {
+ Throwable exception = assertThrows(DeadlineExceededException.class, () -> {
- SetNodeStateRequest request = createDummySetNodeStateRequest();
- request.handleFailure(RemoteClusterControllerTask.Failure.of(
- RemoteClusterControllerTask.FailureCondition.DEADLINE_EXCEEDED, "gremlins in the computer"));
- request.getResult();
+ SetNodeStateRequest request = createDummySetNodeStateRequest();
+ request.handleFailure(RemoteClusterControllerTask.Failure.of(
+ RemoteClusterControllerTask.FailureCondition.DEADLINE_EXCEEDED, "gremlins in the computer"));
+ request.getResult();
+ });
+ assertTrue(exception.getMessage().contains("Task exceeded its version wait deadline: gremlins in the computer"));
}
@Test
- public void no_fail_if_modified() throws StateRestApiException {
+ void no_fail_if_modified() throws StateRestApiException {
assertFalse(isFailed(true));
}
@Test
- public void fail_if_not_modified() throws StateRestApiException {
+ void fail_if_not_modified() throws StateRestApiException {
assertTrue(isFailed(false));
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/SetNodeStateRequestTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/SetNodeStateRequestTest.java
index 9f14b2e71d2..1bd17b11755 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/SetNodeStateRequestTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/SetNodeStateRequestTest.java
@@ -15,8 +15,8 @@ import com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.StateRestApiE
import com.yahoo.vespa.clustercontroller.utils.staterestapi.requests.SetUnitStateRequest;
import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.SetResponse;
import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitState;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.Map;
@@ -43,13 +43,13 @@ public class SetNodeStateRequestTest {
private boolean inMasterMoratorium = false;
private boolean probe = false;
- @Before
+ @BeforeEach
public void setUp() {
newStates.put("user", unitState);
}
@Test
- public void testUpToMaintenance() throws StateRestApiException {
+ void testUpToMaintenance() throws StateRestApiException {
testSetStateRequest(
"maintenance",
State.UP, State.UP,
@@ -58,7 +58,7 @@ public class SetNodeStateRequestTest {
}
@Test
- public void testProbingDoesntChangeState() throws StateRestApiException {
+ void testProbingDoesntChangeState() throws StateRestApiException {
probe = true;
testSetStateRequest(
"maintenance",
@@ -68,7 +68,7 @@ public class SetNodeStateRequestTest {
}
@Test
- public void testUpToDown() throws StateRestApiException {
+ void testUpToDown() throws StateRestApiException {
testSetStateRequest(
"down",
State.UP, State.UP,
@@ -77,7 +77,7 @@ public class SetNodeStateRequestTest {
}
@Test
- public void testMaintenanceToUp() throws StateRestApiException {
+ void testMaintenanceToUp() throws StateRestApiException {
testSetStateRequest(
"up",
State.MAINTENANCE, State.DOWN,
@@ -86,7 +86,7 @@ public class SetNodeStateRequestTest {
}
@Test
- public void testDownToUp() throws StateRestApiException {
+ void testDownToUp() throws StateRestApiException {
testSetStateRequest(
"up",
State.DOWN, State.DOWN,
@@ -95,7 +95,7 @@ public class SetNodeStateRequestTest {
}
@Test
- public void testOnlyStorageInMaintenaceToMaintenance() throws StateRestApiException {
+ void testOnlyStorageInMaintenaceToMaintenance() throws StateRestApiException {
testSetStateRequest(
"maintenance",
State.MAINTENANCE, State.UP,
@@ -104,7 +104,7 @@ public class SetNodeStateRequestTest {
}
@Test
- public void testNoOpMaintenaceToMaintenance() throws StateRestApiException {
+ void testNoOpMaintenaceToMaintenance() throws StateRestApiException {
testSetStateRequest(
"maintenance",
State.MAINTENANCE, State.DOWN,
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/rpc/RPCCommunicatorTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/rpc/RPCCommunicatorTest.java
index ca9e81b6bc4..809979620c2 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/rpc/RPCCommunicatorTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/rpc/RPCCommunicatorTest.java
@@ -21,7 +21,7 @@ import com.yahoo.vespa.clustercontroller.core.FleetControllerOptions;
import com.yahoo.vespa.clustercontroller.core.NodeInfo;
import com.yahoo.vespa.clustercontroller.core.SetClusterStateRequest;
import com.yahoo.vespa.clustercontroller.core.Timer;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import java.util.HashSet;
@@ -33,7 +33,7 @@ import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyDouble;
import static org.mockito.ArgumentMatchers.eq;
@@ -51,7 +51,7 @@ public class RPCCommunicatorTest {
private static final int ROUNDTRIP_LATENCY_SECONDS = 2000;
@Test
- public void testGenerateNodeStateRequestTimeoutMs() {
+ void testGenerateNodeStateRequestTimeoutMs() {
final RPCCommunicator communicator = new RPCCommunicator(
RPCCommunicator.createRealSupervisor(),
null /* Timer */,
@@ -74,11 +74,11 @@ public class RPCCommunicatorTest {
assertThat(min, is(not(max)));
assertTrue(min >= NODE_STATE_REQUEST_TIMEOUT_INTERVAL_START_PERCENTAGE *
NODE_STATE_REQUEST_TIMEOUT_INTERVAL_MAX_MS / 100);
- assertTrue(uniqueTimeoutValues.size()> TEST_ITERATIONS/2);
+ assertTrue(uniqueTimeoutValues.size() > TEST_ITERATIONS / 2);
}
@Test
- public void testGenerateNodeStateRequestTimeoutMsWithUpdates() {
+ void testGenerateNodeStateRequestTimeoutMsWithUpdates() {
final RPCCommunicator communicator = new RPCCommunicator(RPCCommunicator.createRealSupervisor(), null /* Timer */, INDEX, 1, 1, 100, 0);
FleetControllerOptions fleetControllerOptions = new FleetControllerOptions(null /*clustername*/, Set.of(new ConfiguredNode(0, false)));
fleetControllerOptions.nodeStateRequestTimeoutEarliestPercentage = 100;
@@ -90,7 +90,7 @@ public class RPCCommunicatorTest {
}
@Test
- public void testRoundtripLatency() {
+ void testRoundtripLatency() {
final Timer timer = new FakeTimer();
final RPCCommunicator communicator = new RPCCommunicator(
RPCCommunicator.createRealSupervisor(),
@@ -111,7 +111,7 @@ public class RPCCommunicatorTest {
communicator.getNodeState(nodeInfo, null);
Mockito.verify(target).invokeAsync(
any(),
- eq(ROUNDTRIP_LATENCY_SECONDS + NODE_STATE_REQUEST_TIMEOUT_INTERVAL_MAX_MS/1000.0),
+ eq(ROUNDTRIP_LATENCY_SECONDS + NODE_STATE_REQUEST_TIMEOUT_INTERVAL_MAX_MS / 1000.0),
any());
}
@@ -146,7 +146,7 @@ public class RPCCommunicatorTest {
}
@Test
- public void setSystemState_v3_sends_distribution_states_rpc() {
+ void setSystemState_v3_sends_distribution_states_rpc() {
var f = new Fixture<SetClusterStateRequest>();
var cf = ClusterFixture.forFlatCluster(3).bringEntireClusterUp().assignDummyRpcAddresses();
var sentBundle = ClusterStateBundleUtil.makeBundle("distributor:3 storage:3");
@@ -162,7 +162,7 @@ public class RPCCommunicatorTest {
}
@Test
- public void set_distribution_states_v3_rpc_auto_downgrades_to_v2_on_unknown_method_error() {
+ void set_distribution_states_v3_rpc_auto_downgrades_to_v2_on_unknown_method_error() {
var f = new Fixture<SetClusterStateRequest>();
var cf = ClusterFixture.forFlatCluster(3).bringEntireClusterUp().assignDummyRpcAddresses();
var sentBundle = ClusterStateBundleUtil.makeBundle("version:123 distributor:3 storage:3");
@@ -188,7 +188,7 @@ public class RPCCommunicatorTest {
}
@Test
- public void activateClusterStateVersion_sends_version_activation_rpc() {
+ void activateClusterStateVersion_sends_version_activation_rpc() {
var f = new Fixture<ActivateClusterStateVersionRequest>();
var cf = ClusterFixture.forFlatCluster(3).bringEntireClusterUp().assignDummyRpcAddresses();
f.communicator.activateClusterStateVersion(12345, cf.cluster().getNodeInfo(Node.ofDistributor(1)), f.mockWaiter);
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/rpc/SlimeClusterStateBundleCodecTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/rpc/SlimeClusterStateBundleCodecTest.java
index 3d3347acb2d..7564fb40d46 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/rpc/SlimeClusterStateBundleCodecTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/rpc/SlimeClusterStateBundleCodecTest.java
@@ -4,7 +4,7 @@ package com.yahoo.vespa.clustercontroller.core.rpc;
import com.yahoo.vespa.clustercontroller.core.ClusterStateBundle;
import com.yahoo.vespa.clustercontroller.core.ClusterStateBundleUtil;
import com.yahoo.vespa.clustercontroller.core.StateMapping;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.lessThan;
@@ -25,13 +25,13 @@ public class SlimeClusterStateBundleCodecTest {
}
@Test
- public void baseline_only_bundle_can_be_round_trip_encoded() {
+ void baseline_only_bundle_can_be_round_trip_encoded() {
ClusterStateBundle stateBundle = ClusterStateBundleUtil.makeBundle("distributor:2 storage:2");
assertThat(roundtripEncode(stateBundle), equalTo(stateBundle));
}
@Test
- public void multi_space_state_bundle_can_be_round_trip_encoded() {
+ void multi_space_state_bundle_can_be_round_trip_encoded() {
ClusterStateBundle stateBundle = ClusterStateBundleUtil.makeBundle("distributor:2 storage:2",
StateMapping.of("default", "distributor:2 storage:2 .0.s:d"),
StateMapping.of("upsidedown", "distributor:2 .0.s:d storage:2"));
@@ -49,7 +49,7 @@ public class SlimeClusterStateBundleCodecTest {
}
@Test
- public void encoded_cluster_states_can_be_compressed() {
+ void encoded_cluster_states_can_be_compressed() {
ClusterStateBundle stateBundle = makeCompressableBundle();
SlimeClusterStateBundleCodec codec = new SlimeClusterStateBundleCodec();
@@ -60,20 +60,20 @@ public class SlimeClusterStateBundleCodecTest {
}
@Test
- public void uncompressed_enveloped_bundle_can_be_roundtrip_encoded() {
+ void uncompressed_enveloped_bundle_can_be_roundtrip_encoded() {
// Insufficient length and too much entropy to be compressed
ClusterStateBundle stateBundle = ClusterStateBundleUtil.makeBundle("distributor:2 storage:3");
assertThat(roundtripEncodeWithEnvelope(stateBundle), equalTo(stateBundle));
}
@Test
- public void compressable_enveloped_bundle_can_be_roundtrip_encoded() {
+ void compressable_enveloped_bundle_can_be_roundtrip_encoded() {
ClusterStateBundle stateBundle = makeCompressableBundle();
assertThat(roundtripEncodeWithEnvelope(stateBundle), equalTo(stateBundle));
}
@Test
- public void can_roundtrip_encode_bundle_with_deferred_activation_enabled() {
+ void can_roundtrip_encode_bundle_with_deferred_activation_enabled() {
var stateBundle = ClusterStateBundleUtil.makeBundleBuilder("distributor:2 storage:2")
.deferredActivation(true)
.deriveAndBuild();
@@ -81,7 +81,7 @@ public class SlimeClusterStateBundleCodecTest {
}
@Test
- public void can_roundtrip_encode_bundle_with_deferred_activation_disabled() {
+ void can_roundtrip_encode_bundle_with_deferred_activation_disabled() {
var stateBundle = ClusterStateBundleUtil.makeBundleBuilder("distributor:2 storage:2")
.deferredActivation(false)
.deriveAndBuild();
@@ -89,7 +89,7 @@ public class SlimeClusterStateBundleCodecTest {
}
@Test
- public void can_roundtrip_encode_bundle_with_feed_block_state() {
+ void can_roundtrip_encode_bundle_with_feed_block_state() {
var stateBundle = ClusterStateBundleUtil.makeBundleBuilder("distributor:2 storage:2")
.feedBlock(ClusterStateBundle.FeedBlock.blockedWithDescription("more cake needed"))
.deriveAndBuild();