Search in sources :

Example 1 with ClusterControllerClientFactoryMock

use of com.yahoo.vespa.orchestrator.controller.ClusterControllerClientFactoryMock in project vespa by vespa-engine.

the class HostResourceTest method throws_409_when_request_rejected_by_policies.

@Test
public void throws_409_when_request_rejected_by_policies() {
    final OrchestratorImpl alwaysRejectResolver = new OrchestratorImpl(new AlwaysFailPolicy(), new ClusterControllerClientFactoryMock(), EVERY_HOST_IS_UP_HOST_STATUS_SERVICE, mockInstanceLookupService, SERVICE_MONITOR_CONVERGENCE_LATENCY_SECONDS);
    try {
        HostResource hostResource = new HostResource(alwaysRejectResolver, uriInfo);
        hostResource.suspend("hostname");
        fail();
    } catch (WebApplicationException w) {
        assertThat(w.getResponse().getStatus()).isEqualTo(409);
    }
}
Also used : ClusterControllerClientFactoryMock(com.yahoo.vespa.orchestrator.controller.ClusterControllerClientFactoryMock) WebApplicationException(javax.ws.rs.WebApplicationException) OrchestratorImpl(com.yahoo.vespa.orchestrator.OrchestratorImpl) Test(org.junit.Test)

Example 2 with ClusterControllerClientFactoryMock

use of com.yahoo.vespa.orchestrator.controller.ClusterControllerClientFactoryMock in project vespa by vespa-engine.

the class HostResourceTest method throws_409_when_request_rejected_by_policies_for_batch.

@Test
public void throws_409_when_request_rejected_by_policies_for_batch() {
    final OrchestratorImpl alwaysRejectResolver = new OrchestratorImpl(new AlwaysFailPolicy(), new ClusterControllerClientFactoryMock(), EVERY_HOST_IS_UP_HOST_STATUS_SERVICE, mockInstanceLookupService, SERVICE_MONITOR_CONVERGENCE_LATENCY_SECONDS);
    try {
        HostSuspensionResource hostSuspensionResource = new HostSuspensionResource(alwaysRejectResolver);
        hostSuspensionResource.suspendAll("parentHostname", Arrays.asList("hostname1", "hostname2"));
        fail();
    } catch (WebApplicationException w) {
        assertThat(w.getResponse().getStatus()).isEqualTo(409);
    }
}
Also used : ClusterControllerClientFactoryMock(com.yahoo.vespa.orchestrator.controller.ClusterControllerClientFactoryMock) WebApplicationException(javax.ws.rs.WebApplicationException) OrchestratorImpl(com.yahoo.vespa.orchestrator.OrchestratorImpl) Test(org.junit.Test)

Example 3 with ClusterControllerClientFactoryMock

use of com.yahoo.vespa.orchestrator.controller.ClusterControllerClientFactoryMock in project vespa by vespa-engine.

the class OrchestratorImplTest method setUp.

@Before
public void setUp() throws Exception {
    // Extract applications and hosts from dummy instance lookup service
    Iterator<ApplicationInstance> iterator = DummyInstanceLookupService.getApplications().iterator();
    ApplicationInstanceReference app1_ref = iterator.next().reference();
    app1 = OrchestratorUtil.toApplicationId(app1_ref);
    app1_host1 = DummyInstanceLookupService.getContentHosts(app1_ref).iterator().next();
    app2 = OrchestratorUtil.toApplicationId(iterator.next().reference());
    clustercontroller = new ClusterControllerClientFactoryMock();
    orchestrator = new OrchestratorImpl(clustercontroller, new InMemoryStatusService(), new OrchestratorConfig(new OrchestratorConfig.Builder()), new DummyInstanceLookupService());
    clustercontroller.setAllDummyNodesAsUp();
}
Also used : OrchestratorConfig(com.yahoo.vespa.orchestrator.config.OrchestratorConfig) ClusterControllerClientFactoryMock(com.yahoo.vespa.orchestrator.controller.ClusterControllerClientFactoryMock) ApplicationInstance(com.yahoo.vespa.applicationmodel.ApplicationInstance) InMemoryStatusService(com.yahoo.vespa.orchestrator.status.InMemoryStatusService) ApplicationInstanceReference(com.yahoo.vespa.applicationmodel.ApplicationInstanceReference) Before(org.junit.Before)

Aggregations

ClusterControllerClientFactoryMock (com.yahoo.vespa.orchestrator.controller.ClusterControllerClientFactoryMock)3 OrchestratorImpl (com.yahoo.vespa.orchestrator.OrchestratorImpl)2 WebApplicationException (javax.ws.rs.WebApplicationException)2 Test (org.junit.Test)2 ApplicationInstance (com.yahoo.vespa.applicationmodel.ApplicationInstance)1 ApplicationInstanceReference (com.yahoo.vespa.applicationmodel.ApplicationInstanceReference)1 OrchestratorConfig (com.yahoo.vespa.orchestrator.config.OrchestratorConfig)1 InMemoryStatusService (com.yahoo.vespa.orchestrator.status.InMemoryStatusService)1 Before (org.junit.Before)1