diff options
author | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2021-03-12 16:35:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-12 16:35:18 +0100 |
commit | d4dacaaa3a7fa0dc79c467f25bb68de99c023771 (patch) | |
tree | c2bfacfdec47ab72e3c1a3467cd435240d1861b7 /clustercontroller-core/src/test | |
parent | 79ce87f9297b978e7c1720b1fd1caf58307c8626 (diff) | |
parent | a7ed8446ffbb642c1fb6855f6d0271f4aef66a9c (diff) |
Merge pull request #16926 from vespa-engine/vekterli/dont-store-full-bundle-objects-in-state-history
Don't store full bundle objects in state history
Diffstat (limited to 'clustercontroller-core/src/test')
-rw-r--r-- | clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateVersionTrackerTest.java | 32 |
1 files changed, 23 insertions, 9 deletions
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 83bdbfa0213..496d2a3b29a 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 @@ -180,8 +180,13 @@ public class StateVersionTrackerTest { assertTrue(versionTracker.getClusterStateHistory().isEmpty()); } - private static ClusterStateHistoryEntry historyEntry(final String state, final long time) { - return new ClusterStateHistoryEntry(stateBundleWithoutAnnotations(state), time); + private static ClusterStateHistoryEntry historyEntry(String state, long time) { + return ClusterStateHistoryEntry.makeFirstEntry(stateBundleWithoutAnnotations(state), time); + } + + private static ClusterStateHistoryEntry historyEntry(String state, String prevState, long time) { + return ClusterStateHistoryEntry.makeSuccessor(stateBundleWithoutAnnotations(state), + stateBundleWithoutAnnotations(prevState), time); } @Test @@ -191,12 +196,16 @@ public class StateVersionTrackerTest { updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:3 storage:3"), 200); updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:4 storage:4"), 300); + String s4 = "version:4 distributor:4 storage:4"; + String s3 = "version:3 distributor:3 storage:3"; + String s2 = "version:2 distributor:2 storage:2"; + // Note: newest entry first assertThat(versionTracker.getClusterStateHistory(), equalTo(Arrays.asList( - historyEntry("version:4 distributor:4 storage:4", 300), - historyEntry("version:3 distributor:3 storage:3", 200), - historyEntry("version:2 distributor:2 storage:2", 100)))); + historyEntry(s4, s3, 300), + historyEntry(s3, s2, 200), + historyEntry(s2, 100)))); } @Test @@ -208,17 +217,22 @@ public class StateVersionTrackerTest { updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:3 storage:3"), 200); updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:4 storage:4"), 300); + String s5 = "version:5 distributor:5 storage:5"; + String s4 = "version:4 distributor:4 storage:4"; + String s3 = "version:3 distributor:3 storage:3"; + String s2 = "version:2 distributor:2 storage:2"; + assertThat(versionTracker.getClusterStateHistory(), equalTo(Arrays.asList( - historyEntry("version:4 distributor:4 storage:4", 300), - historyEntry("version:3 distributor:3 storage:3", 200)))); + historyEntry(s4, s3, 300), + historyEntry(s3, s2, 200)))); updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:5 storage:5"), 400); assertThat(versionTracker.getClusterStateHistory(), equalTo(Arrays.asList( - historyEntry("version:5 distributor:5 storage:5", 400), - historyEntry("version:4 distributor:4 storage:4", 300)))); + historyEntry(s5, s4, 400), + historyEntry(s4, s3, 300)))); } @Test |