diff options
author | Geir Storli <geirst@oath.com> | 2018-02-19 16:40:24 +0100 |
---|---|---|
committer | Geir Storli <geirst@oath.com> | 2018-02-19 16:43:18 +0100 |
commit | 846a2821f32910d31ecbf51d93d5951521fc2ee9 (patch) | |
tree | 3e1c0e55814bfc0d2a733ac494b8bc52d22cb012 /clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java | |
parent | 077656a019587ea4951a0f4ec156b8bee04e7385 (diff) |
Add handling of bucket spaces stats to HostInfo and ClusterStatsAggregator.
Handling of outstanding merge ops has been removed as this information has never been provided by the distributors.
Diffstat (limited to 'clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java')
-rw-r--r-- | clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java | 33 |
1 files changed, 22 insertions, 11 deletions
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 c9ce54ae3be..5319d741503 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 @@ -12,11 +12,11 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Iterator; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.*; /** * @author hakonhall @@ -49,19 +49,30 @@ public class StorageNodeStatsBridgeTest { } @Test - public void testStorageMergeStats() throws IOException { + public void testContentNodeStats() throws IOException { String data = getJsonString(); HostInfo hostInfo = HostInfo.createHostInfo(data); ContentClusterStats clusterStats = StorageNodeStatsBridge.generate(hostInfo.getDistributor()); - int size = 0; - for (ContentNodeStats nodeStats : clusterStats) { - assertThat(nodeStats.getCopyingIn().getBuckets(), is(2L)); - assertThat(nodeStats.getCopyingOut().getBuckets(), is(4L)); - assertThat(nodeStats.getSyncing().getBuckets(), is(1L)); - assertThat(nodeStats.getMovingOut().getBuckets(), is(3L)); - size++; + Iterator<ContentNodeStats> itr = clusterStats.iterator(); + { // content node 0 + ContentNodeStats stats = itr.next(); + assertThat(stats.getNodeIndex(), is(0)); + assertThat(stats.getBucketSpaces().size(), is(2)); + assertBucketSpaceStats(11, 3, stats.getBucketSpaces().get("default")); + assertBucketSpaceStats(13, 5, stats.getBucketSpaces().get("global")); } - assertThat(size, is(2)); + { // content node 1 + ContentNodeStats stats = itr.next(); + assertThat(stats.getNodeIndex(), is(1)); + assertThat(stats.getBucketSpaces().size(), is(1)); + assertBucketSpaceStats(0, 0, stats.getBucketSpaces().get("default")); + } + assertFalse(itr.hasNext()); + } + + private static void assertBucketSpaceStats(long expBucketsTotal, long expBucketsPending, ContentNodeStats.BucketSpaceStats stats) { + assertThat(stats.getBucketsTotal(), is(expBucketsTotal)); + assertThat(stats.getBucketsPending(), is(expBucketsPending)); } } |