Search in sources :

Example 6 with ProcessEntry

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

the class ProcessIT method testGetProcessErrorMessageFromRuntime.

@Test
public void testGetProcessErrorMessageFromRuntime() throws Exception {
    byte[] archive = archive(ProcessIT.class.getResource("throwRuntime").toURI());
    // start the process
    ConcordProcess proc = concord.processes().start(new Payload().archive(archive));
    // wait for completion
    ProcessEntry pe = proc.expectStatus(StatusEnum.FAILED);
    assertProcessErrorMessage(pe, "BOOOM");
}
Also used : ConcordProcess(ca.ibodrov.concord.testcontainers.ConcordProcess) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) Payload(ca.ibodrov.concord.testcontainers.Payload) Test(org.junit.jupiter.api.Test)

Example 7 with ProcessEntry

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

the class ProcessIT method testKillCascade.

@Test
public void testKillCascade() throws Exception {
    byte[] archive = archive(ProcessIT.class.getResource("killCascade").toURI());
    ConcordProcess proc = concord.processes().start(new Payload().archive(archive));
    proc.waitForChildStatus(StatusEnum.ENQUEUED, StatusEnum.PREPARING, StatusEnum.STARTING, StatusEnum.RUNNING);
    proc.killCascade();
    proc.waitForChildStatus(StatusEnum.CANCELLED, StatusEnum.FINISHED, StatusEnum.FAILED);
    List<ProcessEntry> processEntryList = proc.subprocesses();
    for (ProcessEntry pe : processEntryList) {
        assertEquals(StatusEnum.CANCELLED, pe.getStatus());
    }
}
Also used : ConcordProcess(ca.ibodrov.concord.testcontainers.ConcordProcess) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) Payload(ca.ibodrov.concord.testcontainers.Payload) Test(org.junit.jupiter.api.Test)

Example 8 with ProcessEntry

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

the class ProcessIT method testMetadataWithWithItems.

@Test
public void testMetadataWithWithItems() throws Exception {
    ConcordProcess proc = concord.processes().start(new Payload().archive(resource("processMetadataWithItems")));
    ProcessEntry pe = proc.expectStatus(StatusEnum.FINISHED);
    assertNotNull(pe.getMeta());
    assertEquals("c", pe.getMeta().get("var"));
}
Also used : ConcordProcess(ca.ibodrov.concord.testcontainers.ConcordProcess) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) Payload(ca.ibodrov.concord.testcontainers.Payload) Test(org.junit.jupiter.api.Test)

Example 9 with ProcessEntry

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

the class ProcessIT method testInvalidEntryPointError.

@Test
public void testInvalidEntryPointError() throws Exception {
    byte[] archive = archive(ProcessIT.class.getResource("multipart").toURI());
    // ---
    Payload payload = new Payload().archive(archive).entryPoint("not-found");
    ConcordProcess proc = concord.processes().start(payload);
    // wait for completion
    ProcessEntry pe = proc.expectStatus(StatusEnum.FAILED);
    assertProcessErrorMessage(pe, "Process 'not-found' not found");
}
Also used : ConcordProcess(ca.ibodrov.concord.testcontainers.ConcordProcess) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) Payload(ca.ibodrov.concord.testcontainers.Payload) Test(org.junit.jupiter.api.Test)

Example 10 with ProcessEntry

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

the class ProcessIT method testOnFailureVariables.

/**
 * Verifies that variables changed in runtime are available in onFailure flows.
 */
@Test
public void testOnFailureVariables() throws Exception {
    ConcordProcess proc = concord.processes().start(new Payload().archive(resource("onFailureVars")));
    proc.expectStatus(StatusEnum.FAILED);
    // wait for the onFailure process
    ConcordProcess onFailureProc;
    while (true) {
        List<ProcessEntry> l = proc.subprocesses();
        if (!l.isEmpty()) {
            onFailureProc = concord.processes().get(l.get(0).getInstanceId());
            break;
        }
        Thread.sleep(1000);
    }
    onFailureProc.expectStatus(StatusEnum.FINISHED);
    onFailureProc.assertLog(".*I've got xyz.*");
    onFailureProc.assertLog(".*Last error was:.*Boom!.*");
}
Also used : ConcordProcess(ca.ibodrov.concord.testcontainers.ConcordProcess) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) Payload(ca.ibodrov.concord.testcontainers.Payload) 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