use of com.walmartlabs.concord.client.ProcessEntry 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);
}
use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.
the class TimeoutHandlingIT method testTimeout.
@Test
public void testTimeout() throws Exception {
ProcessApi processApi = new ProcessApi(getApiClient());
// prepare the payload
byte[] payload = archive(ProcessIT.class.getResource("timeoutHandling").toURI());
// start the process and wait for it to fail
StartProcessResponse spr = start(payload);
waitForStatus(processApi, spr.getInstanceId(), ProcessEntry.StatusEnum.TIMED_OUT);
// find the child processes
ProcessEntry child = waitForChild(processApi, spr.getInstanceId(), ProcessEntry.KindEnum.TIMEOUT_HANDLER, ProcessEntry.StatusEnum.FINISHED);
// check the handler's logs for expected messages
byte[] ab = getLog(child.getLogFileName());
assertLog(".*projectInfo: \\{.*orgName=Default.*\\}.*", ab);
assertLog(".*processInfo: \\{.*sessionKey=.*\\}.*", ab);
assertLog(".*initiator: \\{.*username=.*\\}.*", ab);
}
use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.
the class ResourceIT method test.
private void test(String resource, String pattern) throws Exception {
URI dir = ResourceIT.class.getResource(resource).toURI();
byte[] payload = archive(dir);
ProcessApi processApi = new ProcessApi(getApiClient());
StartProcessResponse spr = start(payload);
ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
assertEquals(ProcessEntry.StatusEnum.FINISHED, pir.getStatus());
byte[] ab = getLog(pir.getLogFileName());
assertLog(pattern, ab);
}
use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.
the class NodeRosterIT method test.
/**
* Tests various methods of the 'noderoster' plugin.
*/
@Test
public void test() throws Exception {
// run the Ansible flow first to get some data
String concordYml = resourceToString(NodeRosterIT.class.getResource("noderoster/ansible.yml")).replaceAll("PROJECT_VERSION", ITConstants.PROJECT_VERSION);
ConcordProcess proc = concord.processes().start(new Payload().concordYml(concordYml).resource("playbook.yml", NodeRosterIT.class.getResource("noderoster/playbook.yml")));
ProcessEntry pe = expectStatus(proc, ProcessEntry.StatusEnum.FINISHED);
// wait for the Node Roster data to appear
NodeRosterHostsApi hostsApi = new NodeRosterHostsApi(concord.apiClient());
while (true) {
List<HostEntry> l = hostsApi.list(null, null, pe.getInstanceId(), null, 10, 0);
if (!l.isEmpty()) {
break;
}
}
// run the Node Roster flow next to test the plugin
concordYml = resourceToString(ProcessIT.class.getResource("noderoster/noderoster.yml")).replaceAll("PROJECT_VERSION", ITConstants.PROJECT_VERSION);
proc = concord.processes().start(new Payload().concordYml(concordYml));
expectStatus(proc, ProcessEntry.StatusEnum.FINISHED);
proc.assertLog(".*hostsWithArtifacts:.*ok=true.*");
proc.assertLog(".*ansible_dns=.*");
proc.assertLog(".*deployedOnHost:.*ok=true.*");
}
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 = expectStatus(proc, ProcessEntry.StatusEnum.FINISHED);
assertNotNull(pe.getMeta());
assertEquals("c", pe.getMeta().get("var"));
}
Aggregations