aboutsummaryrefslogtreecommitdiffstats
path: root/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/report/BenchmarkReportTest.java
blob: ef642335db54369f1649e1efdd8e5996a61c5089 (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
26
27
package com.yahoo.vespa.hosted.node.verification.commons.report;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class BenchmarkReportTest {

    private BenchmarkReport benchmarkReport = new BenchmarkReport();

    @Test
    public void create_report_from_BenchmarkResults_should_create_correct_report() throws Exception {
        double expectedCpuCyclesPerSec = 4;
        double expectedDiskSpeedMbps = 120;
        double expectedMemoryReadSpeedGBs = 7.1;
        double expectedMemoryWriteSpeedGBs = 5.9;
        benchmarkReport.setCpuCyclesPerSec(expectedCpuCyclesPerSec);
        benchmarkReport.setDiskSpeedMbs(expectedDiskSpeedMbps);
        benchmarkReport.setMemoryReadSpeedGBs(expectedMemoryReadSpeedGBs);
        benchmarkReport.setMemoryWriteSpeedGBs(expectedMemoryWriteSpeedGBs);
        ObjectMapper om = new ObjectMapper();
        String expectedResultJson = "{\"cpuCyclesPerSec\":4.0,\"diskSpeedMbs\":120.0,\"memoryWriteSpeedGBs\":5.9,\"memoryReadSpeedGBs\":7.1}";
        assertEquals(expectedResultJson, om.writeValueAsString(benchmarkReport));
    }

}