diff options
author | gjoranv <gv@verizonmedia.com> | 2020-05-27 22:23:02 +0200 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2020-05-28 11:56:22 +0200 |
commit | 0a509536daebb0f5c19c333ced3d7c8475226e9f (patch) | |
tree | f4d01454744cecf27a98b090e3865eb4bb0ce9f3 /configserver/src/test | |
parent | 2b6f7803304582f37b628aeee9bc04b5f8c702b3 (diff) |
Store the file reference of the distributed app package in ZK
Diffstat (limited to 'configserver/src/test')
2 files changed, 18 insertions, 0 deletions
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java index eaa3991c0d3..d55bb35bfde 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java @@ -45,6 +45,7 @@ import com.yahoo.vespa.config.server.tenant.EndpointCertificateMetadataStore; import com.yahoo.vespa.config.server.tenant.EndpointCertificateRetriever; import com.yahoo.vespa.config.server.zookeeper.ConfigCurator; import com.yahoo.vespa.curator.mock.MockCurator; +import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.flags.InMemoryFlagSource; import org.junit.Before; import org.junit.Rule; @@ -67,6 +68,7 @@ import java.util.Optional; import java.util.Set; import java.util.logging.Level; +import static com.yahoo.vespa.config.server.session.SessionZooKeeperClient.APPLICATION_PACKAGE_REFERENCE_PATH; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -195,6 +197,13 @@ public class SessionPreparerTest { } @Test + public void require_that_file_reference_of_application_package_is_written_to_zk() throws Exception { + flagSource.withBooleanFlag(Flags.CONFIGSERVER_DISTRIBUTE_APPLICATION_PACKAGE.id(), true); + prepare(testApp); + assertTrue(configCurator.exists(sessionsPath.append(APPLICATION_PACKAGE_REFERENCE_PATH).getAbsolute())); + } + + @Test public void require_that_container_endpoints_are_written_and_used() throws Exception { var modelFactory = new TestModelFactory(version123); preparer = createPreparer(new ModelFactoryRegistry(List.of(modelFactory)), HostProvisionerProvider.empty()); diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClientTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClientTest.java index df765902b44..5633ec2c5f8 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClientTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClientTest.java @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.server.session; +import com.yahoo.config.FileReference; import com.yahoo.config.provision.ApplicationId; import com.yahoo.path.Path; import com.yahoo.text.Utf8; @@ -99,6 +100,14 @@ public class SessionZooKeeperClientTest { assertThat(zkc.readCreateTime(), is(Instant.ofEpochSecond(now.getEpochSecond()))); } + @Test + public void require_that_application_package_file_reference_can_be_written_and_read() { + final FileReference testRef = new FileReference("test-ref"); + SessionZooKeeperClient zkc = createSessionZKClient("3"); + zkc.writeApplicationPackageReference(testRef); + assertThat(zkc.readApplicationPackageReference(), is(testRef)); + } + private void assertApplicationIdParse(String sessionId, String idString, String expectedIdString) { SessionZooKeeperClient zkc = createSessionZKClient(sessionId); String path = "/" + sessionId + "/" + SessionZooKeeperClient.APPLICATION_ID_PATH; |