use of com.yahoo.vespa.config.server.rpc.GetConfigProcessor in project vespa by vespa-engine.
the class GetConfigProcessorTest method testSentinelConfig.
@Test
public void testSentinelConfig() {
MockRpc rpc = new MockRpc(13337, false);
// should be a sentinel config, but it does not matter for this test
rpc.response = new MockConfigResponse("foo");
// one tenant, which has host1 assigned
boolean pretentToHaveLoadedApplications = true;
TenantName testTenant = TenantName.from("test");
rpc.onTenantCreate(testTenant, new MockTenantProvider(pretentToHaveLoadedApplications));
rpc.hostsUpdated(testTenant, Collections.singleton("host1"));
{
// a config is returned normally
JRTServerConfigRequest req = createV3SentinelRequest("host1");
GetConfigProcessor proc = new GetConfigProcessor(rpc, req, false);
proc.run();
assertTrue(rpc.tryResolveConfig);
assertTrue(rpc.tryRespond);
assertThat(rpc.errorCode, is(0));
}
rpc.resetChecks();
// host1 is replaced by host2 for this tenant
rpc.hostsUpdated(testTenant, Collections.singleton("host2"));
{
// this causes us to get an empty config instead of normal config resolution
JRTServerConfigRequest req = createV3SentinelRequest("host1");
GetConfigProcessor proc = new GetConfigProcessor(rpc, req, false);
proc.run();
// <-- no normal config resolution happening
assertFalse(rpc.tryResolveConfig);
assertTrue(rpc.tryRespond);
assertThat(rpc.errorCode, is(0));
}
}
Aggregations