Search in sources :

Example 1 with DeploymentStatistics

use of com.yahoo.vespa.hosted.controller.versions.DeploymentStatistics in project vespa by vespa-engine.

the class VersionStatusSerializerTest method testSerialization.

@Test
public void testSerialization() {
    List<VespaVersion> vespaVersions = new ArrayList<>();
    DeploymentStatistics statistics = new DeploymentStatistics(Version.fromString("5.0"), Arrays.asList(ApplicationId.from("tenant1", "failing1", "default")), Arrays.asList(ApplicationId.from("tenant2", "success1", "default"), ApplicationId.from("tenant2", "success2", "default")), Arrays.asList(ApplicationId.from("tenant1", "failing1", "default"), ApplicationId.from("tenant2", "success2", "default")));
    vespaVersions.add(new VespaVersion(statistics, "dead", Instant.now(), false, Arrays.asList("cfg1", "cfg2", "cfg3"), VespaVersion.Confidence.normal));
    vespaVersions.add(new VespaVersion(statistics, "cafe", Instant.now(), true, Arrays.asList("cfg1", "cfg2", "cfg3"), VespaVersion.Confidence.normal));
    VersionStatus status = new VersionStatus(vespaVersions);
    VersionStatusSerializer serializer = new VersionStatusSerializer();
    VersionStatus deserialized = serializer.fromSlime(serializer.toSlime(status));
    assertEquals(status.versions().size(), deserialized.versions().size());
    for (int i = 0; i < status.versions().size(); i++) {
        VespaVersion a = status.versions().get(i);
        VespaVersion b = deserialized.versions().get(i);
        assertEquals(a.releaseCommit(), b.releaseCommit());
        assertEquals(a.committedAt(), b.committedAt());
        assertEquals(a.isCurrentSystemVersion(), b.isCurrentSystemVersion());
        assertEquals(a.statistics(), b.statistics());
        assertEquals(a.configServerHostnames(), b.configServerHostnames());
        assertEquals(a.confidence(), b.confidence());
    }
}
Also used : DeploymentStatistics(com.yahoo.vespa.hosted.controller.versions.DeploymentStatistics) VespaVersion(com.yahoo.vespa.hosted.controller.versions.VespaVersion) ArrayList(java.util.ArrayList) VersionStatus(com.yahoo.vespa.hosted.controller.versions.VersionStatus) Test(org.junit.Test)

Aggregations

DeploymentStatistics (com.yahoo.vespa.hosted.controller.versions.DeploymentStatistics)1 VersionStatus (com.yahoo.vespa.hosted.controller.versions.VersionStatus)1 VespaVersion (com.yahoo.vespa.hosted.controller.versions.VespaVersion)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1