From 85381f1ba40251e6a9c3773586867f7d2e4b20ec Mon Sep 17 00:00:00 2001 From: jonmv Date: Fri, 10 Jun 2022 13:48:38 +0200 Subject: Add additional data to test runtime --- .../hosted/cd/cloud/impl/VespaTestRuntime.java | 12 +++++++++- .../config/server/deploy/HostedDeployTest.java | 26 ++++++++++++++++++++++ .../controller/deployment/InternalStepRunner.java | 3 +++ .../deployment/TestConfigSerializer.java | 14 +++++++++++- .../restapi/application/ApplicationApiHandler.java | 12 ++++++++-- .../deployment/TestConfigSerializerTest.java | 6 +++++ .../application/responses/test-config-dev.json | 3 +++ .../restapi/application/responses/test-config.json | 3 +++ .../src/test/resources/testConfig.json | 3 +++ .../main/java/ai/vespa/hosted/api/TestConfig.java | 26 +++++++++++++++++++++- .../java/ai/vespa/hosted/api/TestConfigTest.java | 4 ++++ hosted-api/src/test/resources/test-config.json | 3 +++ tenant-cd-api/abi-spec.json | 8 +++++-- .../main/java/ai/vespa/hosted/cd/Deployment.java | 11 +++++++++ .../main/java/ai/vespa/hosted/cd/TestRuntime.java | 3 +++ .../ai/vespa/hosted/cd/commons/HttpDeployment.java | 25 ++++++++++++++++++++- .../vespa/test/samples/UsingTestRuntimeTest.java | 3 +++ .../yahoo/vespa/testrunner/JunitRunnerTest.java | 14 +++++++++++- 18 files changed, 170 insertions(+), 9 deletions(-) diff --git a/cloud-tenant-cd/src/main/java/ai/vespa/hosted/cd/cloud/impl/VespaTestRuntime.java b/cloud-tenant-cd/src/main/java/ai/vespa/hosted/cd/cloud/impl/VespaTestRuntime.java index f4c8974a835..3088b5df74f 100644 --- a/cloud-tenant-cd/src/main/java/ai/vespa/hosted/cd/cloud/impl/VespaTestRuntime.java +++ b/cloud-tenant-cd/src/main/java/ai/vespa/hosted/cd/cloud/impl/VespaTestRuntime.java @@ -22,6 +22,7 @@ import java.nio.file.Paths; * @author mortent */ public class VespaTestRuntime implements TestRuntime { + private final TestConfig config; private final Deployment deploymentToTest; @@ -42,7 +43,8 @@ public class VespaTestRuntime implements TestRuntime { private VespaTestRuntime(TestConfig config) { this.config = config; DefaultEndpointAuthenticator authenticator = new DefaultEndpointAuthenticator(config.system()); - this.deploymentToTest = new HttpDeployment(config.deployments().get(config.zone()), authenticator); + this.deploymentToTest = new HttpDeployment(config.platformVersion(), config.applicationVersion(), config.deployedAt(), + config.deployments().get(config.zone()), authenticator); FeedClientBuilder.setEndpointAuthenticator(authenticator); ai.vespa.feed.client.FeedClientBuilder.setFeedClientBuilderSupplier(FeedClientBuilder::new); } @@ -54,6 +56,13 @@ public class VespaTestRuntime implements TestRuntime { config.zone().region().value()); } + @Override + public ai.vespa.cloud.ApplicationId application() { + return new ai.vespa.cloud.ApplicationId(config.application().tenant().value(), + config.application().application().value(), + config.application().instance().value()); + } + /** Returns the deployment this is testing. */ @Override public Deployment deploymentToTest() { return deploymentToTest; } @@ -93,4 +102,5 @@ public class VespaTestRuntime implements TestRuntime { System.out.println("TestRuntime: Zone: " + zone.toString()); return controller.testConfig(id, zone); } + } diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java index 5dfc1bbd3ef..dbc7b5512be 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java @@ -271,6 +271,32 @@ public class HostedDeployTest { assertTrue("Newest model for latest major version is always included", factory720.creationCount() > 0); } + /** + * Tests that we create the minimal set of models and that version 7.x is created + * if creating version 8.x fails (to support upgrades to new major version for applications + * that are still using features that do not work on version 8.x) + */ + @Test + public void testFailingOnOldMajorButNotNewInUpgradeScenario() { + int oldMajor = 7; + int newMajor = 8; + Version wantedVersion = new Version(newMajor, 1, 2); + Version oldVersion = new Version(oldMajor, 2, 3); + List hosts = createHosts(9, oldVersion.toFullString(), wantedVersion.toFullString()); + + ModelFactory oldFactory = createFailingModelFactory(oldVersion); + ModelFactory newFactory = createHostedModelFactory(wantedVersion); + List modelFactories = List.of(oldFactory, newFactory); + + DeployTester tester = createTester(hosts, modelFactories, prodZone); + + tester.deployApp("src/test/apps/hosted/", wantedVersion.toFullString()); + + tester.deployApp("src/test/apps/hosted/", oldVersion.toFullString()); + + assertEquals(9, tester.getAllocatedHostsOf(tester.applicationId()).getHosts().size()); + } + /** * Tests that we create the minimal set of models and that version 7.x is created * if creating version 8.x fails (to support upgrades to new major version for applications diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java index 894b175961b..813e3454e80 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java @@ -608,6 +608,9 @@ public class InternalStepRunner implements StepRunner { byte[] config = testConfigSerializer.configJson(id.application(), id.type(), true, + deployment.get().version(), + deployment.get().revision(), + deployment.get().at(), endpoints, controller.applications().reachableContentClustersByZone(deployments)); controller.jobController().cloud().startTests(getTesterDeploymentId(id), suite, config); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializer.java index 1680e064234..2394f293170 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializer.java @@ -1,6 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.deployment; +import com.yahoo.component.Version; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.SystemName; import com.yahoo.config.provision.zone.ZoneId; @@ -8,10 +9,12 @@ import com.yahoo.slime.Cursor; import com.yahoo.slime.Slime; import com.yahoo.slime.SlimeUtils; import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; +import com.yahoo.vespa.hosted.controller.api.integration.deployment.RevisionId; import com.yahoo.vespa.hosted.controller.application.Endpoint; import java.io.IOException; import java.io.UncheckedIOException; +import java.time.Instant; import java.util.List; import java.util.Map; @@ -31,6 +34,9 @@ public class TestConfigSerializer { public Slime configSlime(ApplicationId id, JobType type, boolean isCI, + Version platform, + RevisionId revision, + Instant deployedAt, Map> deployments, Map> clusters) { Slime slime = new Slime(); @@ -40,6 +46,9 @@ public class TestConfigSerializer { root.setString("zone", type.zone().value()); root.setString("system", system.value()); root.setBool("isCI", isCI); + root.setString("platform", platform.toFullString()); + root.setLong("revision", revision.number()); + root.setLong("deployedAt", deployedAt.toEpochMilli()); // TODO jvenstad: remove when clients can be updated Cursor endpointsObject = root.setObject("endpoints"); @@ -72,10 +81,13 @@ public class TestConfigSerializer { public byte[] configJson(ApplicationId id, JobType type, boolean isCI, + Version platform, + RevisionId revision, + Instant deployedAt, Map> deployments, Map> clusters) { try { - return SlimeUtils.toJsonBytes(configSlime(id, type, isCI, deployments, clusters)); + return SlimeUtils.toJsonBytes(configSlime(id, type, isCI, platform, revision, deployedAt, deployments, clusters)); } catch (IOException e) { throw new UncheckedIOException(e); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java index ef7c7063355..63f33540721 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java @@ -2345,16 +2345,24 @@ public class ApplicationApiHandler extends AuditLoggingRequestHandler { .flatMap(instance -> instance.productionDeployments().keySet().stream()) .map(zone -> new DeploymentId(prodInstanceId, zone)) .collect(Collectors.toCollection(HashSet::new)); - ZoneId testedZone = type.zone(); + // If a production job is specified, the production deployment of the orchestrated instance is the relevant one, // as user instances should not exist in prod. + ApplicationId toTest = type.isProduction() ? prodInstanceId : id; if ( ! type.isProduction()) - deployments.add(new DeploymentId(id, testedZone)); + deployments.add(new DeploymentId(toTest, type.zone())); + + Deployment deployment = application.require(toTest.instance()).deployments().get(type.zone()); + if (deployment == null) + throw new NotExistsException(toTest + " is not deployed in " + type.zone()); return new SlimeJsonResponse(testConfigSerializer.configSlime(id, type, false, + deployment.version(), + deployment.revision(), + deployment.at(), controller.routing().readTestRunnerEndpointsOf(deployments), controller.applications().reachableContentClustersByZone(deployments))); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java index 59ee8cc6eae..67583891765 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java @@ -1,12 +1,14 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.deployment; +import com.yahoo.component.Version; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ClusterSpec; import com.yahoo.config.provision.SystemName; import com.yahoo.config.provision.zone.ZoneId; import com.yahoo.slime.SlimeUtils; import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; +import com.yahoo.vespa.hosted.controller.api.integration.deployment.RevisionId; import com.yahoo.vespa.hosted.controller.application.Endpoint; import com.yahoo.vespa.hosted.controller.application.EndpointId; import org.junit.Test; @@ -14,6 +16,7 @@ import org.junit.Test; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; +import java.time.Instant; import java.util.List; import java.util.Map; @@ -31,6 +34,9 @@ public class TestConfigSerializerTest { byte[] json = new TestConfigSerializer(SystemName.PublicCd).configJson(instanceId, DeploymentContext.systemTest, true, + Version.fromString("1.2.3"), + RevisionId.forProduction(321), + Instant.ofEpochMilli(222), Map.of(zone, List.of(Endpoint.of(ApplicationId.defaultId()) .target(EndpointId.of("ai"), ClusterSpec.Id.from("qrs"), List.of(new DeploymentId(ApplicationId.defaultId(), diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config-dev.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config-dev.json index 3a5e6dc5dc3..ac0f2b9f740 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config-dev.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config-dev.json @@ -3,6 +3,9 @@ "zone": "dev.us-east-1", "system": "main", "isCI": false, + "platform": "6.1.0", + "revision": 1, + "deployedAt": 1600000000000, "endpoints": { "dev.us-east-1": [ "https://my-user.application1.tenant1.us-east-1.dev.vespa.oath.cloud/" diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config.json index 0a9236655ba..671c34cb2c0 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config.json @@ -3,6 +3,9 @@ "zone": "prod.us-central-1", "system": "main", "isCI": false, + "platform": "6.1.0", + "revision": 1, + "deployedAt": 1600000000000, "endpoints": { "prod.us-central-1": [ "https://application1.tenant1.us-central-1.vespa.oath.cloud/" diff --git a/controller-server/src/test/resources/testConfig.json b/controller-server/src/test/resources/testConfig.json index 5c3d5942001..0ea4b163992 100644 --- a/controller-server/src/test/resources/testConfig.json +++ b/controller-server/src/test/resources/testConfig.json @@ -3,6 +3,9 @@ "zone": "test.us-east-1", "system": "publiccd", "isCI": true, + "platform": "1.2.3", + "revision": 321, + "deployedAt": 222, "endpoints": { "test.us-east-1": [ "https://ai.default.default.global.vespa.oath.cloud/" diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/TestConfig.java b/hosted-api/src/main/java/ai/vespa/hosted/api/TestConfig.java index 937e961c69b..d8bd08773ee 100644 --- a/hosted-api/src/main/java/ai/vespa/hosted/api/TestConfig.java +++ b/hosted-api/src/main/java/ai/vespa/hosted/api/TestConfig.java @@ -10,6 +10,7 @@ import com.yahoo.slime.ObjectTraverser; import com.yahoo.slime.SlimeUtils; import java.net.URI; +import java.time.Instant; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -29,10 +30,14 @@ public class TestConfig { private final ZoneId zone; private final SystemName system; private final boolean isCI; + private final String platform; + private final long revision; + private final Instant deployedAt; private final Map> deployments; private final Map> contentClusters; public TestConfig(ApplicationId application, ZoneId zone, SystemName system, boolean isCI, + String platform, long revision, Instant deployedAt, Map> deployments, Map> contentClusters) { if ( ! deployments.containsKey(zone)) throw new IllegalArgumentException("Config must contain a deployment for its zone, but only does for " + deployments.keySet()); @@ -40,6 +45,9 @@ public class TestConfig { this.zone = requireNonNull(zone); this.system = requireNonNull(system); this.isCI = isCI; + this.platform = platform; + this.revision = revision; + this.deployedAt = deployedAt; this.deployments = deployments.entrySet().stream() .collect(Collectors.toUnmodifiableMap(entry -> entry.getKey(), entry -> Map.copyOf(entry.getValue()))); @@ -59,10 +67,17 @@ public class TestConfig { if (config.field("localEndpoints").valid()) return TestConfig.fromEndpointsOnly(toClusterMap(config.field("localEndpoints"))); + if (config.field("deployments").valid()) { + + } + ApplicationId application = ApplicationId.fromSerializedForm(config.field("application").asString()); ZoneId zone = ZoneId.from(config.field("zone").asString()); SystemName system = SystemName.from(config.field("system").asString()); boolean isCI = config.field("isCI").asBool(); + String platform = config.field("platform").asString(); + long revision = config.field("revision").asLong(); + Instant deployedAt = Instant.ofEpochMilli(config.field("deployedAt").asLong()); Map> deployments = new HashMap<>(); config.field("zoneEndpoints").traverse((ObjectTraverser) (zoneId, clustersObject) -> { deployments.put(ZoneId.from(zoneId), toClusterMap(clustersObject)); @@ -73,7 +88,7 @@ public class TestConfig { clustersArray.traverse((ArrayTraverser) (__, cluster) -> clusters.add(cluster.asString())); contentClusters.put(ZoneId.from(zoneId), clusters); })); - return new TestConfig(application, zone, system, isCI, deployments, contentClusters); + return new TestConfig(application, zone, system, isCI, platform, revision, deployedAt, deployments, contentClusters); } static Map toClusterMap(Inspector clustersObject) { @@ -91,6 +106,9 @@ public class TestConfig { ZoneId.defaultId(), SystemName.defaultSystem(), false, + "", + 0, + Instant.EPOCH, Map.of(ZoneId.defaultId(), endpoints), Map.of()); } @@ -113,4 +131,10 @@ public class TestConfig { /** Returns an immutable view of content clusters, per zone, of the application to test. */ public Map> contentClusters() { return contentClusters; } + public String platformVersion() { return platform; } + + public long applicationVersion() { return revision; } + + public Instant deployedAt() { return deployedAt; } + } diff --git a/hosted-api/src/test/java/ai/vespa/hosted/api/TestConfigTest.java b/hosted-api/src/test/java/ai/vespa/hosted/api/TestConfigTest.java index 2cbc65c6b23..320bce678c3 100644 --- a/hosted-api/src/test/java/ai/vespa/hosted/api/TestConfigTest.java +++ b/hosted-api/src/test/java/ai/vespa/hosted/api/TestConfigTest.java @@ -10,6 +10,7 @@ import java.io.IOException; import java.net.URI; import java.nio.file.Files; import java.nio.file.Paths; +import java.time.Instant; import java.util.List; import java.util.Map; @@ -32,6 +33,9 @@ public class TestConfigTest { assertEquals(SystemName.PublicCd, config.system()); assertTrue(config.isCI()); + assertEquals("1.2.3", config.platformVersion()); + assertEquals(321, config.applicationVersion()); + assertEquals(Instant.ofEpochMilli(1600000000L), config.deployedAt()); assertEquals(Map.of(ZoneId.from("dev", "aws-us-east-1c"), Map.of("default", URI.create("https://dev.endpoint:443/")), ZoneId.from("prod", "aws-us-east-1a"), diff --git a/hosted-api/src/test/resources/test-config.json b/hosted-api/src/test/resources/test-config.json index 07454efdb66..b1a7e2c2563 100644 --- a/hosted-api/src/test/resources/test-config.json +++ b/hosted-api/src/test/resources/test-config.json @@ -3,6 +3,9 @@ "zone": "dev.aws-us-east-1c", "system": "publiccd", "isCI": true, + "platform": "1.2.3", + "revision": 321, + "deployedAt": 1600000000, "zoneEndpoints": { "dev.aws-us-east-1c": { "default": "https://dev.endpoint:443/" diff --git a/tenant-cd-api/abi-spec.json b/tenant-cd-api/abi-spec.json index 48222a63e28..8eee085de08 100644 --- a/tenant-cd-api/abi-spec.json +++ b/tenant-cd-api/abi-spec.json @@ -8,7 +8,10 @@ "abstract" ], "methods": [ - "public abstract ai.vespa.hosted.cd.Endpoint endpoint(java.lang.String)" + "public abstract ai.vespa.hosted.cd.Endpoint endpoint(java.lang.String)", + "public abstract java.lang.String platformVersion()", + "public abstract long applicationVersion()", + "public abstract java.time.Instant deployedAt()" ], "fields": [] }, @@ -138,7 +141,8 @@ "methods": [ "public static ai.vespa.hosted.cd.TestRuntime get()", "public abstract ai.vespa.hosted.cd.Deployment deploymentToTest()", - "public abstract ai.vespa.cloud.Zone zone()" + "public abstract ai.vespa.cloud.Zone zone()", + "public abstract ai.vespa.cloud.ApplicationId application()" ], "fields": [ "public static final java.util.logging.Logger logger" 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 index 9d42ba138bd..a04f07d5dae 100644 --- 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 @@ -1,6 +1,8 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package ai.vespa.hosted.cd; +import java.time.Instant; + /** * A deployment of a Vespa application, which contains endpoints for document retrieval. * @@ -11,4 +13,13 @@ public interface Deployment { /** Returns an Endpoint in the cluster with the given id. */ Endpoint endpoint(String id); + /** The Vespa runtime version of the deployment, e.g., 8.16.32. */ + String platformVersion(); + + /** The build number assigned to the application revision of the deployment, e.g., 496. */ + long applicationVersion(); + + /** The time at which the deployment was last updated with a new platform or application version. */ + Instant deployedAt(); + } 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 index d031054851c..b1aa2bb62ba 100644 --- 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 @@ -1,6 +1,7 @@ // Copyright Yahoo. 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.ApplicationId; import ai.vespa.cloud.Zone; import ai.vespa.hosted.cd.internal.TestRuntimeProvider; @@ -33,4 +34,6 @@ public interface TestRuntime { Zone zone(); + ApplicationId application(); + } diff --git a/tenant-cd-commons/src/main/java/ai/vespa/hosted/cd/commons/HttpDeployment.java b/tenant-cd-commons/src/main/java/ai/vespa/hosted/cd/commons/HttpDeployment.java index 1abdc4d4297..15f6b1f009a 100644 --- a/tenant-cd-commons/src/main/java/ai/vespa/hosted/cd/commons/HttpDeployment.java +++ b/tenant-cd-commons/src/main/java/ai/vespa/hosted/cd/commons/HttpDeployment.java @@ -6,6 +6,7 @@ import ai.vespa.hosted.cd.Endpoint; import ai.vespa.hosted.cd.EndpointAuthenticator; import java.net.URI; +import java.time.Instant; import java.util.Map; import java.util.NoSuchElementException; import java.util.stream.Collectors; @@ -18,9 +19,16 @@ import java.util.stream.Collectors; public class HttpDeployment implements Deployment { private final Map endpoints; + private final String platform; + private final long revision; + private final Instant deployedAt; /** Creates a representation of the given deployment endpoints, using the authenticator for data plane access. */ - public HttpDeployment(Map endpoints, EndpointAuthenticator authenticator) { + public HttpDeployment(String platform, long revision, Instant deployedAt, + Map endpoints, EndpointAuthenticator authenticator) { + this.platform = platform; + this.revision = revision; + this.deployedAt = deployedAt; this.endpoints = endpoints.entrySet().stream() .collect(Collectors.toUnmodifiableMap(entry -> entry.getKey(), entry -> new HttpEndpoint(entry.getValue(), authenticator))); @@ -34,4 +42,19 @@ public class HttpDeployment implements Deployment { return endpoints.get(id); } + @Override + public String platformVersion() { + return platform; + } + + @Override + public long applicationVersion() { + return revision; + } + + @Override + public Instant deployedAt() { + return deployedAt; + } + } diff --git a/vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/test/samples/UsingTestRuntimeTest.java b/vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/test/samples/UsingTestRuntimeTest.java index acb41bb42be..be60ef554af 100644 --- a/vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/test/samples/UsingTestRuntimeTest.java +++ b/vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/test/samples/UsingTestRuntimeTest.java @@ -17,6 +17,9 @@ public class UsingTestRuntimeTest { assertEquals(Environment.test, runtime.zone().environment()); assertEquals("name", runtime.zone().region()); assertNull(runtime.deploymentToTest().endpoint("dummy")); + assertEquals("1.2.3", runtime.deploymentToTest().platformVersion()); + assertEquals(321, runtime.deploymentToTest().applicationVersion()); + assertEquals(1000, runtime.deploymentToTest().deployedAt().toEpochMilli()); } } diff --git a/vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/testrunner/JunitRunnerTest.java b/vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/testrunner/JunitRunnerTest.java index 8e330b0228e..51acd4b1fdf 100644 --- a/vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/testrunner/JunitRunnerTest.java +++ b/vespa-osgi-testrunner/src/test/java/com/yahoo/vespa/testrunner/JunitRunnerTest.java @@ -1,8 +1,10 @@ package com.yahoo.vespa.testrunner; +import ai.vespa.cloud.ApplicationId; import ai.vespa.cloud.Environment; import ai.vespa.cloud.Zone; import ai.vespa.hosted.cd.Deployment; +import ai.vespa.hosted.cd.Endpoint; import ai.vespa.hosted.cd.TestRuntime; import com.yahoo.vespa.testrunner.TestReport.Status; import com.yahoo.vespa.testrunner.TestRunner.Suite; @@ -169,7 +171,12 @@ class JunitRunnerTest { @Override public Deployment deploymentToTest() { - return __ -> null; + return new Deployment() { + @Override public Endpoint endpoint(String id) { return null; } + @Override public String platformVersion() { return "1.2.3"; } + @Override public long applicationVersion() { return 321; } + @Override public Instant deployedAt() { return Instant.ofEpochMilli(1000); } + }; } @Override @@ -177,6 +184,11 @@ class JunitRunnerTest { return new Zone(Environment.test, "name"); } + @Override + public ApplicationId application() { + return null; + } + } } -- cgit v1.2.3