use of com.walmartlabs.concord.client.ProcessApi 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);
}
use of com.walmartlabs.concord.client.ProcessApi 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);
}
use of com.walmartlabs.concord.client.ProcessApi 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);
}
use of com.walmartlabs.concord.client.ProcessApi 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);
}
use of com.walmartlabs.concord.client.ProcessApi in project concord by walmartlabs.
the class ThrowExceptionTaskIT method testThrowExceptionMessage.
@Test
public void testThrowExceptionMessage() throws Exception {
URI uri = ThrowExceptionTaskIT.class.getResource("throwExceptionMessage").toURI();
byte[] payload = archive(uri);
// start the process
ProcessApi processApi = new ProcessApi(getApiClient());
StartProcessResponse spr = start(payload);
// wait for completion
ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
assertEquals(ProcessEntry.StatusEnum.FAILED, pir.getStatus());
// check logs
byte[] ab = getLog(pir.getLogFileName());
assertLog(".*Kaboom!! Error occurred.*", 2, ab);
}
Aggregations