use of com.yahoo.config.provision.Rotation in project vespa by vespa-engine.
the class DeployStateTest method testRotations.
@Test
public void testRotations() {
Set<Rotation> rotations = new HashSet<>();
assertThat(new DeployState.Builder().rotations(rotations).build(true).getRotations().size(), is(0));
for (String name : new String[] { "rotation-001.vespa.a02.yahoodns.net", "rotation-002.vespa.a02.yahoodns.net" }) {
rotations.add(new Rotation(name));
}
assertThat(new DeployState.Builder().rotations(rotations).build(true).getRotations(), equalTo(rotations));
}
use of com.yahoo.config.provision.Rotation in project vespa by vespa-engine.
the class SessionPreparerTest method require_that_rotations_are_written_in_prepare.
@Test
public void require_that_rotations_are_written_in_prepare() throws IOException {
final String rotations = "mediasearch.msbe.global.vespa.yahooapis.com";
final ApplicationId applicationId = applicationId("test");
PrepareParams params = new PrepareParams.Builder().applicationId(applicationId).rotations(rotations).build();
File app = new File("src/test/resources/deploy/app");
preparer.prepare(getContext(getApplicationPackage(app)), getLogger(), params, Optional.empty(), tenantPath, Instant.now());
assertThat(readRotationsFromZK(applicationId), contains(new Rotation(rotations)));
}
use of com.yahoo.config.provision.Rotation 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)));
}
use of com.yahoo.config.provision.Rotation in project vespa by vespa-engine.
the class PrepareParamsTest method testCorrectParsingWithRotation.
@Test
public void testCorrectParsingWithRotation() {
PrepareParams prepareParams = createParams(request + "&" + PrepareParams.ROTATIONS_PARAM_NAME + "=" + rotation, TenantName.from("foo"));
assertThat(prepareParams.getApplicationId().serializedForm(), is("foo:baz:default"));
assertTrue(prepareParams.isDryRun());
assertTrue(prepareParams.isVerbose());
assertFalse(prepareParams.ignoreValidationErrors());
Version expectedVersion = Version.fromString(vespaVersion);
assertThat(prepareParams.vespaVersion().get(), is(expectedVersion));
assertTrue(prepareParams.getTimeoutBudget().hasTimeLeft());
Set<Rotation> rotations = prepareParams.rotations();
assertThat(rotations.size(), is(1));
assertThat(rotations, contains(equalTo(new Rotation(rotation))));
}
use of com.yahoo.config.provision.Rotation in project vespa by vespa-engine.
the class ModelContextImplTest method testModelContextTest.
@Test
public void testModelContextTest() {
final Rotation rotation = new Rotation("this.is.a.mock.rotation");
final Set<Rotation> rotations = Collections.singleton(rotation);
ModelContext context = new ModelContextImpl(MockApplicationPackage.createEmpty(), Optional.empty(), Optional.empty(), new BaseDeployLogger(), new StaticConfigDefinitionRepo(), new MockFileRegistry(), Optional.empty(), new ModelContextImpl.Properties(ApplicationId.defaultId(), true, Collections.emptyList(), null, false, Zone.defaultZone(), rotations), Optional.empty(), new Version(6), new Version(6));
assertTrue(context.applicationPackage() instanceof MockApplicationPackage);
assertFalse(context.hostProvisioner().isPresent());
assertFalse(context.permanentApplicationPackage().isPresent());
assertFalse(context.previousModel().isPresent());
assertTrue(context.getFileRegistry() instanceof MockFileRegistry);
assertTrue(context.configDefinitionRepo() instanceof StaticConfigDefinitionRepo);
assertThat(context.properties().applicationId(), is(ApplicationId.defaultId()));
assertTrue(context.properties().configServerSpecs().isEmpty());
assertTrue(context.properties().multitenant());
assertTrue(context.properties().zone() instanceof Zone);
assertFalse(context.properties().hostedVespa());
assertThat(context.properties().rotations(), equalTo(rotations));
}
Aggregations