StateVersionTracker { public List<ClusterStateHistoryEntry> getClusterStateHistory() { return Collections.unmodifiableList(clusterStateHistory); } StateVersionTracker(double minMergeCompletionRatio); ClusterState getVersionedClusterState(); ClusterStatsAggregator getAggregatedClusterStats(); ClusterStateBundle getVersionedClusterStateBundle(); void updateLatestCandidateStateBundle(final ClusterStateBundle candidateBundle); AnnotatedClusterState getLatestCandidateState(); List<ClusterStateHistoryEntry> getClusterStateHistory();  }
@Test public void state_history_is_initially_empty() { final StateVersionTracker versionTracker = createWithMockedMetrics(); assertTrue(versionTracker.getClusterStateHistory().isEmpty()); }
@Test public void applying_state_adds_to_cluster_state_history() { final StateVersionTracker versionTracker = createWithMockedMetrics(); updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:2 storage:2") ,100); updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:3 storage:3"), 200); updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:4 storage:4"), 300); 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)))); }