use of com.yahoo.cloud.config.LbServicesConfig in project vespa by vespa-engine.
the class SuperModelControllerTest method test_lb_config_simple.
@Test
public void test_lb_config_simple() {
LbServicesConfig.Builder lb = new LbServicesConfig.Builder();
handler.getSuperModel().getConfig(lb);
LbServicesConfig lbc = new LbServicesConfig(lb);
assertThat(lbc.tenants().size(), is(1));
assertThat(lbc.tenants("a").applications().size(), is(1));
Applications app = lbc.tenants("a").applications("foo:prod:default:default");
assertTrue(app.hosts().size() > 0);
}
use of com.yahoo.cloud.config.LbServicesConfig in project vespa by vespa-engine.
the class SuperModelConfigProvider method getConfig.
public ConfigPayload getConfig(ConfigKey<?> configKey) {
// TODO: Override not applied, but not really necessary here
if (configKey.equals(new ConfigKey<>(LbServicesConfig.class, configKey.getConfigId()))) {
LbServicesConfig.Builder builder = new LbServicesConfig.Builder();
getConfig(builder);
return ConfigPayload.fromInstance(new LbServicesConfig(builder));
} else if (configKey.equals(new ConfigKey<>(RoutingConfig.class, configKey.getConfigId()))) {
RoutingConfig.Builder builder = new RoutingConfig.Builder();
getConfig(builder);
return ConfigPayload.fromInstance(new RoutingConfig(builder));
} else {
throw new ConfigurationRuntimeException(configKey + " is not valid when asking for config from SuperModel");
}
}
use of com.yahoo.cloud.config.LbServicesConfig in project vespa by vespa-engine.
the class LbServicesProducerTest method testConfigAliases.
@Test
public void testConfigAliases() throws IOException, SAXException {
Map<TenantName, Map<ApplicationId, ApplicationInfo>> testModel = createTestModel(new DeployState.Builder());
LbServicesConfig conf = getLbServicesConfig(Zone.defaultZone(), testModel);
final LbServicesConfig.Tenants.Applications.Hosts.Services services = conf.tenants("foo").applications("foo:prod:default:default").hosts("foo.foo.yahoo.com").services("qrserver");
assertThat(services.servicealiases().size(), is(1));
assertThat(services.endpointaliases().size(), is(2));
assertThat(services.servicealiases(0), is("service1"));
assertThat(services.endpointaliases(0), is("foo1.bar1.com"));
assertThat(services.endpointaliases(1), is("foo2.bar2.com"));
}
use of com.yahoo.cloud.config.LbServicesConfig in project vespa by vespa-engine.
the class SuperModelControllerTest method test_lb_config_multiple_apps.
@Test
public void test_lb_config_multiple_apps() throws IOException, SAXException {
Map<TenantName, Map<ApplicationId, ApplicationInfo>> models = new LinkedHashMap<>();
models.put(TenantName.from("t1"), new LinkedHashMap<>());
models.put(TenantName.from("t2"), new LinkedHashMap<>());
File testApp1 = new File("src/test/resources/deploy/app");
File testApp2 = new File("src/test/resources/deploy/advancedapp");
File testApp3 = new File("src/test/resources/deploy/advancedapp");
// TODO must fix equals, hashCode on Tenant
Version vespaVersion = Version.fromIntValues(1, 2, 3);
models.get(TenantName.from("t1")).put(applicationId("mysimpleapp"), new ApplicationInfo(applicationId("mysimpleapp"), 4l, new VespaModel(FilesApplicationPackage.fromFile(testApp1))));
models.get(TenantName.from("t1")).put(applicationId("myadvancedapp"), new ApplicationInfo(applicationId("myadvancedapp"), 4l, new VespaModel(FilesApplicationPackage.fromFile(testApp2))));
models.get(TenantName.from("t2")).put(applicationId("minetooadvancedapp"), new ApplicationInfo(applicationId("minetooadvancedapp"), 4l, new VespaModel(FilesApplicationPackage.fromFile(testApp3))));
SuperModel superModel = new SuperModel(models);
SuperModelController han = new SuperModelController(new SuperModelConfigProvider(superModel, Zone.defaultZone()), new TestConfigDefinitionRepo(), 2, new UncompressedConfigResponseFactory());
LbServicesConfig.Builder lb = new LbServicesConfig.Builder();
han.getSuperModel().getConfig(lb);
LbServicesConfig lbc = new LbServicesConfig(lb);
assertThat(lbc.tenants().size(), is(2));
assertThat(lbc.tenants("t1").applications().size(), is(2));
assertThat(lbc.tenants("t2").applications().size(), is(1));
assertThat(lbc.tenants("t2").applications("minetooadvancedapp:prod:default:default").hosts().size(), is(1));
assertQrServer(lbc.tenants("t2").applications("minetooadvancedapp:prod:default:default"));
}
use of com.yahoo.cloud.config.LbServicesConfig in project vespa by vespa-engine.
the class LbServicesProducerTest method testDeterministicGetConfig.
@Test
public void testDeterministicGetConfig() throws IOException, SAXException {
Map<TenantName, Map<ApplicationId, ApplicationInfo>> testModel = createTestModel(new DeployState.Builder().rotations(rotations));
LbServicesConfig last = null;
for (int i = 0; i < 100; i++) {
testModel = randomizeTenant(testModel, i);
LbServicesConfig config = getLbServicesConfig(Zone.defaultZone(), testModel);
if (last != null) {
assertConfig(last, config);
}
last = config;
}
}
Aggregations