Search in sources :

Example 1 with MockRestartAction

use of com.yahoo.vespa.config.server.configchange.MockRestartAction in project vespa by vespa-engine.

the class SessionPrepareHandlerTest method require_that_config_change_actions_are_logged_if_existing.

@Test
public void require_that_config_change_actions_are_logged_if_existing() throws Exception {
    List<ServiceInfo> services = Collections.singletonList(new ServiceInfo("serviceName", "serviceType", null, ImmutableMap.of("clustername", "foo", "clustertype", "bar"), "configId", "hostName"));
    ConfigChangeActions actions = new ConfigChangeActions(Arrays.asList(new MockRestartAction("change", services), new MockRefeedAction("change-id", false, "other change", services, "test")));
    MockSession session = new MockSession(1, null, actions);
    localRepo.addSession(session);
    HttpResponse response = createHandler().handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
    assertResponseContains(response, "Change(s) between active and new application that require restart:\\nIn cluster 'foo' of type 'bar");
    assertResponseContains(response, "Change(s) between active and new application that may require re-feed:\\nchange-id: Consider removing data and re-feed document type 'test'");
}
Also used : ServiceInfo(com.yahoo.config.model.api.ServiceInfo) ConfigChangeActions(com.yahoo.vespa.config.server.configchange.ConfigChangeActions) HttpResponse(com.yahoo.container.jdisc.HttpResponse) MockRestartAction(com.yahoo.vespa.config.server.configchange.MockRestartAction) MockRefeedAction(com.yahoo.vespa.config.server.configchange.MockRefeedAction) Test(org.junit.Test)

Example 2 with MockRestartAction

use of com.yahoo.vespa.config.server.configchange.MockRestartAction in project vespa by vespa-engine.

the class SessionPreparerTest method require_that_config_change_actions_are_collected_from_all_models.

@Test
public void require_that_config_change_actions_are_collected_from_all_models() throws IOException {
    ServiceInfo service = new ServiceInfo("serviceName", "serviceType", null, new HashMap<>(), "configId", "hostName");
    ModelFactoryRegistry modelFactoryRegistry = new ModelFactoryRegistry(Arrays.asList(new ConfigChangeActionsModelFactory(Version.fromIntValues(1, 2, 3), new MockRestartAction("change", Arrays.asList(service))), new ConfigChangeActionsModelFactory(Version.fromIntValues(1, 2, 4), new MockRestartAction("other change", Arrays.asList(service)))));
    preparer = createPreparer(modelFactoryRegistry, HostProvisionerProvider.empty());
    List<RestartActions.Entry> actions = preparer.prepare(getContext(getApplicationPackage(testApp)), getLogger(), new PrepareParams.Builder().build(), Optional.empty(), tenantPath, Instant.now()).getRestartActions().getEntries();
    assertThat(actions.size(), is(1));
    assertThat(actions.get(0).getMessages(), equalTo(ImmutableSet.of("change", "other change")));
}
Also used : ServiceInfo(com.yahoo.config.model.api.ServiceInfo) ModelFactoryRegistry(com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry) MockRestartAction(com.yahoo.vespa.config.server.configchange.MockRestartAction) Test(org.junit.Test)

Aggregations

ServiceInfo (com.yahoo.config.model.api.ServiceInfo)2 MockRestartAction (com.yahoo.vespa.config.server.configchange.MockRestartAction)2 Test (org.junit.Test)2 HttpResponse (com.yahoo.container.jdisc.HttpResponse)1 ConfigChangeActions (com.yahoo.vespa.config.server.configchange.ConfigChangeActions)1 MockRefeedAction (com.yahoo.vespa.config.server.configchange.MockRefeedAction)1 ModelFactoryRegistry (com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry)1