Search in sources :

Example 56 with ProcessEntry

use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.

the class DockerIT method testNoLogWithStdOut.

@Test
public void testNoLogWithStdOut() throws Exception {
    byte[] payload = archive(DockerIT.class.getResource("dockerNoLogWithStdOut").toURI());
    Map<String, Object> input = new HashMap<>();
    input.put("archive", payload);
    input.put("arguments.image", ITConstants.DOCKER_ANSIBLE_IMAGE);
    StartProcessResponse spr = start(input);
    ProcessApi processApi = new ProcessApi(getApiClient());
    ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
    assertNotNull(pir.getLogFileName());
    byte[] ab = getLog(pir.getLogFileName());
    assertNoLog(".*!! Hello, world .*", ab);
    assertNoLog(".*STDERR WORKS !!.*", ab);
}
Also used : ProcessApi(com.walmartlabs.concord.client.ProcessApi) HashMap(java.util.HashMap) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) StartProcessResponse(com.walmartlabs.concord.client.StartProcessResponse) Test(org.junit.jupiter.api.Test)

Example 57 with ProcessEntry

use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.

the class SuspendIT method testSuspendForCompletion.

@Test
public void testSuspendForCompletion() throws Exception {
    // ---
    byte[] payload = archive(SuspendIT.class.getResource("suspendForCompletion").toURI());
    ProcessApi processApi = new ProcessApi(getApiClient());
    StartProcessResponse parentSpr = start(payload);
    // ---
    ProcessEntry p = waitForStatus(processApi, parentSpr.getInstanceId(), ProcessEntry.StatusEnum.SUSPENDED);
    List<UUID> childrenIds = p.getChildrenIds();
    assertEquals(2, childrenIds.size());
    for (UUID childId : childrenIds) {
        waitForCompletion(processApi, childId);
    }
    ProcessEntry pir = waitForCompletion(processApi, parentSpr.getInstanceId());
    byte[] ab = getLog(pir.getLogFileName());
    assertLog(".*process is resumed.*", ab);
}
Also used : ProcessApi(com.walmartlabs.concord.client.ProcessApi) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) UUID(java.util.UUID) StartProcessResponse(com.walmartlabs.concord.client.StartProcessResponse) Test(org.junit.jupiter.api.Test)

Example 58 with ProcessEntry

use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.

the class SuspendIT method testSuspendForForkedProcess.

@Test
public void testSuspendForForkedProcess() throws Exception {
    // ---
    byte[] payload = archive(SuspendIT.class.getResource("suspendForForkedProcesses").toURI());
    ProcessApi processApi = new ProcessApi(getApiClient());
    StartProcessResponse parentSpr = start(payload);
    // ---
    ProcessEntry p = waitForStatus(processApi, parentSpr.getInstanceId(), ProcessEntry.StatusEnum.SUSPENDED);
    List<UUID> childrenIds = p.getChildrenIds();
    assertEquals(3, childrenIds.size());
    for (UUID childId : childrenIds) {
        waitForCompletion(processApi, childId);
    }
    ProcessEntry pir = waitForCompletion(processApi, parentSpr.getInstanceId());
    byte[] ab = getLog(pir.getLogFileName());
    assertLog(".*task completed.*", ab);
}
Also used : ProcessApi(com.walmartlabs.concord.client.ProcessApi) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) UUID(java.util.UUID) StartProcessResponse(com.walmartlabs.concord.client.StartProcessResponse) Test(org.junit.jupiter.api.Test)

Example 59 with ProcessEntry

use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.

the class TaskRetryIT method testAnsibleRetryWithExpression.

@Test
public void testAnsibleRetryWithExpression() throws Exception {
    URI uri = ProcessIT.class.getResource("taskRetryWithExpression").toURI();
    byte[] payload = archive(uri, ITConstants.DEPENDENCIES_DIR);
    // start the process
    ProcessApi processApi = new ProcessApi(getApiClient());
    Map<String, Object> input = new HashMap<>();
    input.put("archive", payload);
    input.put("arguments.retryCount", "1");
    input.put("arguments.retryDelay", "2");
    StartProcessResponse spr = start(input);
    // wait for completion
    ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
    assertEquals(ProcessEntry.StatusEnum.FINISHED, pir.getStatus());
    // check logs
    byte[] ab = getLog(pir.getLogFileName());
    assertLog(".*msg\": \"Hi retry!\".*", ab);
}
Also used : ProcessApi(com.walmartlabs.concord.client.ProcessApi) HashMap(java.util.HashMap) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) URI(java.net.URI) StartProcessResponse(com.walmartlabs.concord.client.StartProcessResponse) Test(org.junit.jupiter.api.Test)

Example 60 with ProcessEntry

use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.

the class TaskRetryIT method testAnsibleRetry.

@Test
public void testAnsibleRetry() throws Exception {
    URI uri = ProcessIT.class.getResource("taskRetry").toURI();
    byte[] payload = archive(uri, ITConstants.DEPENDENCIES_DIR);
    // start the process
    ProcessApi processApi = new ProcessApi(getApiClient());
    StartProcessResponse spr = start(payload);
    // wait for completion
    ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
    assertEquals(ProcessEntry.StatusEnum.FINISHED, pir.getStatus());
    // check logs
    byte[] ab = getLog(pir.getLogFileName());
    assertLog(".*msg\": \"Hi retry!\".*", ab);
}
Also used : ProcessApi(com.walmartlabs.concord.client.ProcessApi) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) URI(java.net.URI) StartProcessResponse(com.walmartlabs.concord.client.StartProcessResponse) Test(org.junit.jupiter.api.Test)

Aggregations

ProcessEntry (com.walmartlabs.concord.client.ProcessEntry)70 Test (org.junit.jupiter.api.Test)68 ProcessApi (com.walmartlabs.concord.client.ProcessApi)55 StartProcessResponse (com.walmartlabs.concord.client.StartProcessResponse)54 HashMap (java.util.HashMap)35 URI (java.net.URI)23 ConcordProcess (ca.ibodrov.concord.testcontainers.ConcordProcess)15 Payload (ca.ibodrov.concord.testcontainers.Payload)15 Path (java.nio.file.Path)4 ITUtils.randomString (com.walmartlabs.concord.it.common.ITUtils.randomString)3 Utils.resourceToString (com.walmartlabs.concord.it.runtime.v2.Utils.resourceToString)3 File (java.io.File)3 FormListEntry (com.walmartlabs.concord.client.FormListEntry)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 UUID (java.util.UUID)2 ZipArchiveOutputStream (org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream)2 ApiClient (com.walmartlabs.concord.ApiClient)1 FormSubmitResponse (com.walmartlabs.concord.client.FormSubmitResponse)1 HostEntry (com.walmartlabs.concord.client.HostEntry)1 NodeRosterHostsApi (com.walmartlabs.concord.client.NodeRosterHostsApi)1