diff options
Diffstat (limited to 'controller-api')
5 files changed, 103 insertions, 30 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java index 35b1a238325..9bcb80f24ee 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java @@ -91,18 +91,22 @@ public enum JobType { productionAwsApNortheast1a ("production-aws-ap-northeast-1a", Map.of(Public, ZoneId.from("prod", "aws-ap-northeast-1a"))), + testAwsApNortheast1a ("test-aws-ap-northeast-1a", + Map.of(Public, ZoneId.from("prod", "aws-ap-northeast-1a")), true), + productionAwsEuWest1a ("production-aws-eu-west-1a", Map.of(Public, ZoneId.from("prod", "aws-eu-west-1a"))), - testAwsApNortheast1a ("test-aws-ap-northeast-1a", - Map.of(Public, ZoneId.from("prod", "aws-ap-northeast-1a")), true), + testAwsEuWest1a ("test-aws-eu-west-1a", + Map.of(Public, ZoneId.from("prod", "aws-eu-west-1a")), true), productionAwsUsWest2a ("production-aws-us-west-2a", Map.of(main, ZoneId.from("prod", "aws-us-west-2a"), Public, ZoneId.from("prod", "aws-us-west-2a"))), testAwsUsWest2a ("test-aws-us-west-2a", - Map.of(main, ZoneId.from("prod" , "aws-us-west-2a")), true), + Map.of(main, ZoneId.from("prod", "aws-us-west-2a"), + Public, ZoneId.from("prod", "aws-us-west-2a")), true), productionAwsUsEast1b ("production-aws-us-east-1b", Map.of(main, ZoneId.from("prod" , "aws-us-east-1b"))), @@ -132,6 +136,9 @@ public enum JobType { productionCdUsCentral2 ("production-cd-us-central-2", Map.of(cd , ZoneId.from("prod" , "cd-us-central-2"))), + testCdUsCentral2 ("test-cd-us-central-2", + Map.of(cd , ZoneId.from("prod" , "cd-us-central-2")), true), + productionCdUsWest1 ("production-cd-us-west-1", Map.of(cd , ZoneId.from("prod" , "cd-us-west-1"))), @@ -155,7 +162,7 @@ public enum JobType { Map.of(main, ZoneId.from("perf" , "us-east-3"))); private final String jobName; - private final Map<SystemName, ZoneId> zones; + final Map<SystemName, ZoneId> zones; private final boolean isProductionTest; JobType(String jobName, Map<SystemName, ZoneId> zones, boolean isProductionTest) { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/HorizonClient.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/HorizonClient.java index bd6c2607fc2..554d3e5b7fa 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/HorizonClient.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/HorizonClient.java @@ -1,26 +1,25 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.api.integration.horizon; -import com.yahoo.slime.Slime; -import java.io.InputStream; - /** * @author olaa */ public interface HorizonClient { - InputStream getMetrics(byte[] query); + HorizonResponse getMetrics(byte[] query); + + HorizonResponse getUser(); - InputStream getUser(); + HorizonResponse getDashboard(String dashboardId); - InputStream getDashboard(String dashboardId) ; + HorizonResponse getFavorite(String userId); - InputStream getFavorite(String userId); + HorizonResponse getTopFolders(); - InputStream getTopFolders(); + HorizonResponse getRecent(String userId); - InputStream getRecent(String userId); + HorizonResponse getClipboard(String dashboardId); - InputStream getClipboard(String dashboardId); + HorizonResponse getMetaData(byte[] query); } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/HorizonResponse.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/HorizonResponse.java new file mode 100644 index 00000000000..5447b8c3b0b --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/HorizonResponse.java @@ -0,0 +1,36 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.controller.api.integration.horizon; + +import java.io.IOException; +import java.io.InputStream; + +/** + * @author valerijf + */ +public class HorizonResponse implements AutoCloseable { + + private final int code; + private final InputStream inputStream; + + public HorizonResponse(int code, InputStream inputStream) { + this.code = code; + this.inputStream = inputStream; + } + + public int code() { + return code; + } + + public InputStream inputStream() { + return inputStream; + } + + public static HorizonResponse empty() { + return new HorizonResponse(200, InputStream.nullInputStream()); + } + + @Override + public void close() throws IOException { + inputStream.close(); + } +} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/MockHorizonClient.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/MockHorizonClient.java index 7d7af046810..13a8c2ec079 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/MockHorizonClient.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/horizon/MockHorizonClient.java @@ -1,45 +1,48 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.api.integration.horizon; -import java.io.InputStream; - /** * @author olaa */ public class MockHorizonClient implements HorizonClient { @Override - public InputStream getMetrics(byte[] query) { - return null; + public HorizonResponse getMetrics(byte[] query) { + return HorizonResponse.empty(); + } + + @Override + public HorizonResponse getUser() { + return HorizonResponse.empty(); } @Override - public InputStream getUser() { - return null; + public HorizonResponse getDashboard(String dashboardId) { + return HorizonResponse.empty(); } @Override - public InputStream getDashboard(String dashboardId) { - return null; + public HorizonResponse getFavorite(String userId) { + return HorizonResponse.empty(); } @Override - public InputStream getFavorite(String userId) { - return null; + public HorizonResponse getTopFolders() { + return HorizonResponse.empty(); } @Override - public InputStream getTopFolders() { - return null; + public HorizonResponse getRecent(String userId) { + return HorizonResponse.empty(); } @Override - public InputStream getRecent(String userId) { - return null; + public HorizonResponse getClipboard(String dashboardId) { + return HorizonResponse.empty(); } @Override - public InputStream getClipboard(String dashboardId) { - return null; + public HorizonResponse getMetaData(byte[] query) { + return HorizonResponse.empty(); } } diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobTypeTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobTypeTest.java new file mode 100644 index 00000000000..22486875a0b --- /dev/null +++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobTypeTest.java @@ -0,0 +1,28 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.controller.api.integration.deployment; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +/** + * @author jonmv + */ +public class JobTypeTest { + + @Test + public void test() { + for (JobType type : JobType.values()) { + if (type.isProduction()) { + boolean match = false; + for (JobType other : JobType.values()) + match |= type != other + && type.isTest() == other.isDeployment() + && type.zones.equals(other.zones); + + assertTrue(type + " should have matching job", match); + } + } + } + +} |