diff options
author | Valerij Fredriksen <valerijf@yahooinc.com> | 2022-10-04 14:21:30 +0200 |
---|---|---|
committer | Valerij Fredriksen <valerijf@yahooinc.com> | 2022-10-10 13:32:41 +0200 |
commit | 65ee25dafbad18fec8cda51f0f3fad0933fb6bc7 (patch) | |
tree | 8eb3c34f27f79b062f00fd80cca574c568582e98 /controller-api/src/test | |
parent | 362a8b6ffc957d8fc425e50ca18fcfe14d4aa974 (diff) |
Create DirectTarget
Diffstat (limited to 'controller-api/src/test')
-rw-r--r-- | controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/dns/DirectTargetTest.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/dns/DirectTargetTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/dns/DirectTargetTest.java new file mode 100644 index 00000000000..f262821a638 --- /dev/null +++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/dns/DirectTargetTest.java @@ -0,0 +1,36 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.controller.api.integration.dns; + +import com.yahoo.config.provision.zone.ZoneId; +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; + +/** + * @author freva + */ +class DirectTargetTest { + + @Test + void packing() { + List<DirectTarget> tests = List.of( + new LatencyDirectTarget(RecordData.from("foo.example.com"), ZoneId.from("prod.us-north-1")), + new WeightedDirectTarget(RecordData.from("bar.example.com"), ZoneId.from("prod.us-north-2"), 50)); + for (var target : tests) { + DirectTarget unpacked = DirectTarget.unpack(target.pack()); + assertEquals(target, unpacked); + } + + List<RecordData> invalidData = List.of(RecordData.from(""), RecordData.from("foobar")); + for (var data : invalidData) { + try { + DirectTarget.unpack(data); + fail("Expected exception"); + } catch (IllegalArgumentException ignored) { } + } + } + +}
\ No newline at end of file |