diff options
Diffstat (limited to 'tenant-cd-api/src/main')
15 files changed, 273 insertions, 0 deletions
diff --git a/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/Deployment.java b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/Deployment.java new file mode 100644 index 00000000000..7d7b2f74981 --- /dev/null +++ b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/Deployment.java @@ -0,0 +1,14 @@ +// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package ai.vespa.hosted.cd; + +/** + * A deployment of a Vespa application, which contains endpoints for document retrieval. + * + * @author jonmv + */ +public interface Deployment { + + /** Returns an Endpoint in the cluster with the given id. */ + Endpoint endpoint(String id); + +} diff --git a/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/Endpoint.java b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/Endpoint.java new file mode 100644 index 00000000000..afc6aa1b519 --- /dev/null +++ b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/Endpoint.java @@ -0,0 +1,37 @@ +// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package ai.vespa.hosted.cd; + +import java.net.URI; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.Collections; +import java.util.Map; + +/** + * An endpoint in a Vespa application {@link Deployment}, which allows document retrieval. + * + * @author jonmv + */ +public interface Endpoint { + + /** Returns the URI of the endpoint, with scheme, host and port. */ + URI uri(); + + /** Sends the given request with required authentication. */ + <T> HttpResponse<T> send(HttpRequest.Builder request, HttpResponse.BodyHandler<T> handler); + + /** Sends the given request with required authentication. */ + default HttpResponse<String> send(HttpRequest.Builder request) { + return send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8)); + } + + /** Creates a request against the endpoint, with the given path and properties. */ + HttpRequest.Builder request(String path, Map<String, String> properties); + + /** Creates a request against the endpoint, with the given path. */ + default HttpRequest.Builder request(String path) { + return request(path, Collections.emptyMap()); + } + +} diff --git a/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/IntegrationTest.java b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/IntegrationTest.java new file mode 100644 index 00000000000..f9dc15df32e --- /dev/null +++ b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/IntegrationTest.java @@ -0,0 +1,27 @@ +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package ai.vespa.hosted.cd; + +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Tests which run against a fully operational Vespa deployment to verify its behaviour. + * + * Examples of integration test types are {@link SystemTest}, {@link StagingSetup}, {@link StagingTest}, and {@link ProductionTest}. + * + * @author jonmv + */ +@Target({TYPE, ANNOTATION_TYPE}) +@Retention(RUNTIME) +@Tag("integration") +public @interface IntegrationTest { } + diff --git a/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/ProductionTest.java b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/ProductionTest.java new file mode 100644 index 00000000000..b9054689b00 --- /dev/null +++ b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/ProductionTest.java @@ -0,0 +1,25 @@ +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package ai.vespa.hosted.cd; + +import org.junit.jupiter.api.Tag; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Tests that verify the health of production deployments of Vespa applications. + * + * Test classes annotated with this annotation are run during declared production tests. + * See <a href="https://cloud.vespa.ai/automated-deployments.html">Vespa cloud documentation</a>. + * + * @author jonmv + */ +@Target({TYPE, ANNOTATION_TYPE}) +@Retention(RUNTIME) +@IntegrationTest +@Tag("production") +public @interface ProductionTest { } diff --git a/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/StagingSetup.java b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/StagingSetup.java new file mode 100644 index 00000000000..bef3eabcef6 --- /dev/null +++ b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/StagingSetup.java @@ -0,0 +1,26 @@ +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package ai.vespa.hosted.cd; + +import org.junit.jupiter.api.Tag; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Setup for tests that assert continuity of behaviour for Vespa application deployments, through upgrades. + * + * Test classes annotated with this annotation are run in the first phase of automated staging tests, + * to make the initial deployment similar to a production one. + * See <a href="https://cloud.vespa.ai/automated-deployments.html">Vespa cloud documentation</a>. + * + * @author jonmv + */ +@Target({TYPE, ANNOTATION_TYPE}) +@Retention(RUNTIME) +@IntegrationTest +@Tag("staging-setup") +public @interface StagingSetup { } diff --git a/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/StagingTest.java b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/StagingTest.java new file mode 100644 index 00000000000..59360b2753c --- /dev/null +++ b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/StagingTest.java @@ -0,0 +1,28 @@ +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package ai.vespa.hosted.cd; + +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Tests that assert continuity of behaviour for Vespa application deployments, through upgrades. + * + * Test classes annotated with this annotation are run in the second phase of automated staging tests, + * to verify the upgraded deployment. + * See <a href="https://cloud.vespa.ai/automated-deployments.html">Vespa cloud documentation</a>. + * + * @author jonmv + */ +@Target({TYPE, ANNOTATION_TYPE}) +@Retention(RUNTIME) +@IntegrationTest +@Tag("staging") +public @interface StagingTest { +} diff --git a/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/SystemTest.java b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/SystemTest.java new file mode 100644 index 00000000000..f01f2ca6c90 --- /dev/null +++ b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/SystemTest.java @@ -0,0 +1,28 @@ +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package ai.vespa.hosted.cd; + +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Tests that compare the behaviour of a Vespa application deployment against a fixed specification. + * + * Test classes annotated with this annotation are run against a fresh deployment during automated system tests. + * See <a href="https://cloud.vespa.ai/automated-deployments.html">Vespa cloud documentation</a>. + * + * @author jonmv + */ +@Target({TYPE, ANNOTATION_TYPE}) +@Retention(RUNTIME) +@IntegrationTest +@Tag("system") +public @interface SystemTest { } diff --git a/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/TestRuntime.java b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/TestRuntime.java new file mode 100644 index 00000000000..08cc0467b71 --- /dev/null +++ b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/TestRuntime.java @@ -0,0 +1,24 @@ +// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package ai.vespa.hosted.cd; + +import ai.vespa.cloud.Zone; + +import java.util.ServiceLoader; + +/** + * The place to obtain environment-dependent configuration for test of a Vespa deployment. + * + * @author jvenstad + * @author mortent + */ +public interface TestRuntime { + static TestRuntime get() { + ServiceLoader<TestRuntime> serviceLoader = ServiceLoader.load(TestRuntime.class); + return serviceLoader.findFirst().orElseThrow(() -> new RuntimeException("No TestRuntime implementation found")); + } + + Deployment deploymentToTest(); + + Zone zone(); + +} diff --git a/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/package-info.java b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/package-info.java new file mode 100644 index 00000000000..fc10fb82c5c --- /dev/null +++ b/tenant-cd-api/src/main/java/ai/vespa/hosted/cd/package-info.java @@ -0,0 +1,10 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +/** + * @author bjorncs + */ +@ExportPackage +@PublicApi +package ai.vespa.hosted.cd; + +import com.yahoo.api.annotations.PublicApi; +import com.yahoo.osgi.annotation.ExportPackage;
\ No newline at end of file diff --git a/tenant-cd-api/src/main/java/org/junit/jupiter/api/condition/package-info.java b/tenant-cd-api/src/main/java/org/junit/jupiter/api/condition/package-info.java new file mode 100644 index 00000000000..bc0684f0c76 --- /dev/null +++ b/tenant-cd-api/src/main/java/org/junit/jupiter/api/condition/package-info.java @@ -0,0 +1,9 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +/** + * @author bjorncs + */ +@ExportPackage(version = @Version(major = 5, minor = 4, micro = 2)) +package org.junit.jupiter.api.condition; + +import com.yahoo.osgi.annotation.ExportPackage; +import com.yahoo.osgi.annotation.Version;
\ No newline at end of file diff --git a/tenant-cd-api/src/main/java/org/junit/jupiter/api/extension/package-info.java b/tenant-cd-api/src/main/java/org/junit/jupiter/api/extension/package-info.java new file mode 100644 index 00000000000..bcb46dbe671 --- /dev/null +++ b/tenant-cd-api/src/main/java/org/junit/jupiter/api/extension/package-info.java @@ -0,0 +1,9 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +/** + * @author bjorncs + */ +@ExportPackage(version = @Version(major = 5, minor = 4, micro = 2)) +package org.junit.jupiter.api.extension; + +import com.yahoo.osgi.annotation.ExportPackage; +import com.yahoo.osgi.annotation.Version;
\ No newline at end of file diff --git a/tenant-cd-api/src/main/java/org/junit/jupiter/api/function/package-info.java b/tenant-cd-api/src/main/java/org/junit/jupiter/api/function/package-info.java new file mode 100644 index 00000000000..8d62bceeae7 --- /dev/null +++ b/tenant-cd-api/src/main/java/org/junit/jupiter/api/function/package-info.java @@ -0,0 +1,9 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +/** + * @author bjorncs + */ +@ExportPackage(version = @Version(major = 5, minor = 4, micro = 2)) +package org.junit.jupiter.api.function; + +import com.yahoo.osgi.annotation.ExportPackage; +import com.yahoo.osgi.annotation.Version;
\ No newline at end of file diff --git a/tenant-cd-api/src/main/java/org/junit/jupiter/api/io/package-info.java b/tenant-cd-api/src/main/java/org/junit/jupiter/api/io/package-info.java new file mode 100644 index 00000000000..7fc2e15c716 --- /dev/null +++ b/tenant-cd-api/src/main/java/org/junit/jupiter/api/io/package-info.java @@ -0,0 +1,9 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +/** + * @author bjorncs + */ +@ExportPackage(version = @Version(major = 5, minor = 4, micro = 2)) +package org.junit.jupiter.api.io; + +import com.yahoo.osgi.annotation.ExportPackage; +import com.yahoo.osgi.annotation.Version;
\ No newline at end of file diff --git a/tenant-cd-api/src/main/java/org/junit/jupiter/api/package-info.java b/tenant-cd-api/src/main/java/org/junit/jupiter/api/package-info.java new file mode 100644 index 00000000000..dd82f705bd3 --- /dev/null +++ b/tenant-cd-api/src/main/java/org/junit/jupiter/api/package-info.java @@ -0,0 +1,9 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +/** + * @author bjorncs + */ +@ExportPackage(version = @Version(major = 5, minor = 4, micro = 2)) +package org.junit.jupiter.api; + +import com.yahoo.osgi.annotation.ExportPackage; +import com.yahoo.osgi.annotation.Version;
\ No newline at end of file diff --git a/tenant-cd-api/src/main/java/org/junit/jupiter/api/parallel/package-info.java b/tenant-cd-api/src/main/java/org/junit/jupiter/api/parallel/package-info.java new file mode 100644 index 00000000000..dc88b0d33bf --- /dev/null +++ b/tenant-cd-api/src/main/java/org/junit/jupiter/api/parallel/package-info.java @@ -0,0 +1,9 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +/** + * @author bjorncs + */ +@ExportPackage(version = @Version(major = 5, minor = 4, micro = 2)) +package org.junit.jupiter.api.parallel; + +import com.yahoo.osgi.annotation.ExportPackage; +import com.yahoo.osgi.annotation.Version;
\ No newline at end of file |