Search in sources :

Example 1 with HostStatus

use of com.yahoo.vespa.config.server.application.FileDistributionStatus.HostStatus in project vespa by vespa-engine.

the class FileDistributionStatusTest method require_different_statuses_many_hosts.

@Test
public void require_different_statuses_many_hosts() throws IOException {
    application = createApplication("localhost", "localhost2");
    Map<String, Double> fileReferenceStatuses = new HashMap<>();
    fileReferenceStatuses.put("1234", 0.2);
    fileReferenceStatuses.put("abcd", 1.0);
    HostStatus localhost = statusWithError("localhost", Status.IN_PROGRESS, fileReferenceStatuses, "connection timed out");
    Map<String, Double> fileReferenceStatuses2 = new HashMap<>();
    fileReferenceStatuses2.put("1234", 1.0);
    HostStatus localhost2 = statusFinished("localhost2", Status.FINISHED, fileReferenceStatuses2);
    FileDistributionStatus status = new MockStatus(new HashSet<>(Arrays.asList(localhost, localhost2)));
    application = createApplication("localhost", "localhost2");
    HttpResponse response = getStatus(status, application);
    assertResponse(200, "{" + "\"hosts\":[" + "{\"hostname\":\"localhost\"," + "\"status\":\"IN_PROGRESS\"," + "\"message\":\"connection timed out\"," + "\"fileReferences\":[" + "{\"1234\":0.2},{\"abcd\":1.0}]}," + "{\"hostname\":\"localhost2\"," + "\"status\":\"FINISHED\"," + "\"fileReferences\":[" + "{\"1234\":1.0}]}" + "]," + "\"status\":\"IN_PROGRESS\"}", response);
}
Also used : HashMap(java.util.HashMap) HttpResponse(com.yahoo.container.jdisc.HttpResponse) HostStatus(com.yahoo.vespa.config.server.application.FileDistributionStatus.HostStatus) Test(org.junit.Test) SessionHandlerTest(com.yahoo.vespa.config.server.http.SessionHandlerTest)

Aggregations

HttpResponse (com.yahoo.container.jdisc.HttpResponse)1 HostStatus (com.yahoo.vespa.config.server.application.FileDistributionStatus.HostStatus)1 SessionHandlerTest (com.yahoo.vespa.config.server.http.SessionHandlerTest)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1