use of com.walmartlabs.concord.client.StartProcessResponse in project concord by walmartlabs.
the class OutVariablesIT method testPredefined.
@Test
public void testPredefined() throws Exception {
byte[] payload = archive(ProcessIT.class.getResource("out").toURI());
Map<String, Object> input = new HashMap<>();
input.put("archive", payload);
input.put("request", Collections.singletonMap("activeProfiles", Arrays.asList("predefinedOut")));
input.put("sync", false);
StartProcessResponse spr = start(input);
Map<String, Object> data = getOutVars(spr.getInstanceId());
assertNotNull(data);
assertEquals(123, data.get("x"));
}
use of com.walmartlabs.concord.client.StartProcessResponse in project concord by walmartlabs.
the class ProcessContainerIT method test.
@Test
public void test() throws Exception {
Path src = Paths.get(DockerIT.class.getResource("processContainer").toURI());
Path dst = IOUtils.createTempDir("test");
IOUtils.copy(src, dst);
Path concordYml = dst.resolve("concord.yml");
String s = new String(Files.readAllBytes(concordYml));
s = s.replaceAll("%%image%%", ITConstants.DOCKER_ANSIBLE_IMAGE);
Files.write(concordYml, s.getBytes());
// ---
byte[] payload = archive(dst.toUri());
StartProcessResponse spr = start(payload);
// --
ProcessApi processApi = new ProcessApi(getApiClient());
ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
assertNotNull(pir.getLogFileName());
assertEquals(ProcessEntry.StatusEnum.FINISHED, pir.getStatus());
byte[] ab = getLog(pir.getLogFileName());
assertLog(".*Hello from Docker!.*", ab);
}
use of com.walmartlabs.concord.client.StartProcessResponse in project concord by walmartlabs.
the class FilePermissionsIT method test.
@Test
public void test() throws Exception {
Path src = Paths.get(FilePermissionsIT.class.getResource("filePerm").toURI());
Path tmpDir = createTempDir();
IOUtils.copy(src, tmpDir);
Path testFile = tmpDir.resolve("test.sh");
Set<PosixFilePermission> permissions = new HashSet<>(Files.getPosixFilePermissions(testFile));
permissions.add(PosixFilePermission.OWNER_EXECUTE);
Files.setPosixFilePermissions(testFile, permissions);
ByteArrayOutputStream payload = new ByteArrayOutputStream();
try (ZipArchiveOutputStream zip = new ZipArchiveOutputStream(payload)) {
IOUtils.zip(zip, tmpDir);
}
// ---
ProcessApi processApi = new ProcessApi(getApiClient());
StartProcessResponse spr = start(payload.toByteArray());
assertNotNull(spr.getInstanceId());
ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
byte[] ab = getLog(pir.getLogFileName());
assertLog(".*Hello!.*", ab);
}
use of com.walmartlabs.concord.client.StartProcessResponse in project concord by walmartlabs.
the class ForceSuspendIT method testTask.
@Test
public void testTask() throws Exception {
String eventName = "ev_" + randomString();
byte[] payload = archive(ForceSuspendIT.class.getResource("suspendTask").toURI());
Map<String, Object> input = new HashMap<>();
input.put("archive", payload);
input.put("arguments.eventName", eventName);
Map<String, Object> cfg = new HashMap<>();
cfg.put("dependencies", new String[] { "mvn://com.walmartlabs.concord.it.tasks:suspend-test:" + ITConstants.PROJECT_VERSION });
input.put("request", cfg);
StartProcessResponse spr = start(input);
ProcessApi processApi = new ProcessApi(getApiClient());
ProcessEntry pir = waitForStatus(processApi, spr.getInstanceId(), ProcessEntry.StatusEnum.SUSPENDED);
byte[] ab = getLog(pir.getLogFileName());
assertLog(".*Requesting suspend.*", ab);
assertLog(".*Whoa!.*", 0, ab);
// ---
processApi.resume(pir.getInstanceId(), eventName, null, null);
pir = waitForCompletion(processApi, spr.getInstanceId());
ab = getLog(pir.getLogFileName());
assertLog(".*Whoa!.*", ab);
}
use of com.walmartlabs.concord.client.StartProcessResponse in project concord by walmartlabs.
the class AnsibleRetryIT method testSaveRetry.
@Test
public void testSaveRetry() throws Exception {
URI uri = ProcessIT.class.getResource("ansibleSaveRetry").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.FAILED, pir.getStatus());
// retrieve the retry file
File r = processApi.downloadAttachment(pir.getInstanceId(), "hello.retry");
assertNotNull(r);
}
Aggregations