aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ZoneRoutingPolicySerializerTest.java
blob: 7bbdbe33e6ca33e67349298e31482648c0d4cdb6 (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
28
29
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.persistence;

import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.vespa.hosted.controller.routing.RoutingStatus;
import com.yahoo.vespa.hosted.controller.routing.ZoneRoutingPolicy;
import org.junit.jupiter.api.Test;

import java.time.Instant;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
 * @author mpolden
 */
public class ZoneRoutingPolicySerializerTest {

    @Test
    void serialization() {
        var serializer = new ZoneRoutingPolicySerializer(new RoutingPolicySerializer());
        var zone = ZoneId.from("prod", "us-north-1");
        var policy = new ZoneRoutingPolicy(zone,
                RoutingStatus.create(RoutingStatus.Value.out, RoutingStatus.Agent.operator,
                        Instant.ofEpochMilli(123)));
        var serialized = serializer.fromSlime(zone, serializer.toSlime(policy));
        assertEquals(policy, serialized);
    }

}