summaryrefslogtreecommitdiffstats
path: root/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StorageNodeStatsTest.java
blob: 4defb015e76d8f49f10ff08880f831e1766a3c89 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright 2017 Yahoo Holdings. 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.assertEquals;

/**
 * @author hakonhall
 */
public class StorageNodeStatsTest {
    @Test
    public void testStorageNodeStats() {
        LatencyStats putLatency = new LatencyStats(1, 2);
        StorageNodeStats stats = new StorageNodeStats(putLatency);
        assertEquals(1, stats.getDistributorPutLatency().getLatencyMsSum());
        assertEquals(2, stats.getDistributorPutLatency().getCount());

        LatencyStats putLatencyToAdd = new LatencyStats(3, 4);
        StorageNodeStats statsToAdd = new StorageNodeStats(putLatencyToAdd);
        stats.add(statsToAdd);
        assertEquals(1 + 3, stats.getDistributorPutLatency().getLatencyMsSum());
        assertEquals(2 + 4, stats.getDistributorPutLatency().getCount());
    }
}