Search in sources :

Example 11 with Version

use of com.yahoo.config.provision.Version in project vespa by vespa-engine.

the class SessionPreparerTest method require_that_rotations_are_read_from_zookeeper_and_used.

@Test
public void require_that_rotations_are_read_from_zookeeper_and_used() throws IOException {
    final Version vespaVersion = Version.fromIntValues(1, 2, 3);
    final TestModelFactory modelFactory = new TestModelFactory(vespaVersion);
    preparer = createPreparer(new ModelFactoryRegistry(Arrays.asList(modelFactory)), HostProvisionerProvider.empty());
    final String rotations = "foo.msbe.global.vespa.yahooapis.com";
    final ApplicationId applicationId = applicationId("test");
    new Rotations(curator, tenantPath).writeRotationsToZooKeeper(applicationId, Collections.singleton(new Rotation(rotations)));
    final PrepareParams params = new PrepareParams.Builder().applicationId(applicationId).build();
    final File app = new File("src/test/resources/deploy/app");
    preparer.prepare(getContext(getApplicationPackage(app)), getLogger(), params, Optional.empty(), tenantPath, Instant.now());
    // check that the rotation from zookeeper were used
    final ModelContext modelContext = modelFactory.getModelContext();
    final Set<Rotation> rotationSet = modelContext.properties().rotations();
    assertThat(rotationSet, contains(new Rotation(rotations)));
    // Check that the persisted value is still the same
    assertThat(readRotationsFromZK(applicationId), contains(new Rotation(rotations)));
}
Also used : ModelContext(com.yahoo.config.model.api.ModelContext) Version(com.yahoo.config.provision.Version) ModelFactoryRegistry(com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry) TestModelFactory(com.yahoo.vespa.config.server.model.TestModelFactory) ApplicationId(com.yahoo.config.provision.ApplicationId) Rotation(com.yahoo.config.provision.Rotation) File(java.io.File) Rotations(com.yahoo.vespa.config.server.tenant.Rotations) Test(org.junit.Test)

Aggregations

Version (com.yahoo.config.provision.Version)11 Test (org.junit.Test)7 File (java.io.File)5 ModelContext (com.yahoo.config.model.api.ModelContext)2 ApplicationId (com.yahoo.config.provision.ApplicationId)2 TenantName (com.yahoo.config.provision.TenantName)2 ModelFactoryRegistry (com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry)2 ArrayList (java.util.ArrayList)2 ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)1 LbServicesConfig (com.yahoo.cloud.config.LbServicesConfig)1 ApplicationInfo (com.yahoo.config.model.api.ApplicationInfo)1 HostProvisioner (com.yahoo.config.model.api.HostProvisioner)1 Model (com.yahoo.config.model.api.Model)1 ModelCreateResult (com.yahoo.config.model.api.ModelCreateResult)1 ModelFactory (com.yahoo.config.model.api.ModelFactory)1 SuperModel (com.yahoo.config.model.api.SuperModel)1 DeployState (com.yahoo.config.model.deploy.DeployState)1 AllocatedHosts (com.yahoo.config.provision.AllocatedHosts)1 ApplicationLockException (com.yahoo.config.provision.ApplicationLockException)1 OutOfCapacityException (com.yahoo.config.provision.OutOfCapacityException)1