use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.
the class DependenciesIT method testUploadAndRun.
@Test
public void testUploadAndRun() throws Exception {
String dep = "file:///" + ITConstants.DEPENDENCIES_DIR + "/example.jar";
String request = "{ \"entryPoint\": \"main\", \"dependencies\": [ \"" + dep + "\" ] }";
Path tmpDir = createTempDir();
Path requestFile = tmpDir.resolve(Constants.Files.CONFIGURATION_FILE_NAME);
Files.write(requestFile, Collections.singletonList(request));
Path src = Paths.get(DependenciesIT.class.getResource("deps").toURI());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (ZipArchiveOutputStream zip = new ZipArchiveOutputStream(baos)) {
IOUtils.zip(zip, src);
IOUtils.zip(zip, tmpDir);
}
byte[] payload = baos.toByteArray();
// ---
ProcessApi processApi = new ProcessApi(getApiClient());
StartProcessResponse spr = start(payload);
assertNotNull(spr.getInstanceId());
ProcessEntry psr = waitForCompletion(processApi, spr.getInstanceId());
assertEquals(ProcessEntry.StatusEnum.FINISHED, psr.getStatus());
// ---
byte[] ab = getLog(psr.getLogFileName());
assertLog(".*Hello!.*", ab);
}
use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.
the class DependencyManagerIT method test.
@Test
public void test() throws Exception {
byte[] payload = archive(DependencyManagerIT.class.getResource("dependencyManager").toURI());
Map<String, Object> input = new HashMap<>();
input.put("archive", payload);
Map<String, Object> cfg = new HashMap<>();
cfg.put("dependencies", new String[] { "mvn://com.walmartlabs.concord.it.tasks:dependency-manager-test:" + ITConstants.PROJECT_VERSION });
String url = "http://" + env("IT_DOCKER_HOST_ADDR", "localhost") + ":" + rule.getPort() + "/item.txt";
cfg.put("arguments", Collections.singletonMap("url", url));
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(".*downloading.*", ab);
assertLog(".*using a cached copy.*", ab);
assertLog(".*Got: Hello!.*", ab);
}
use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.
the class DockerAnsibleIT method test.
@Test
public void test() throws Exception {
byte[] payload = archive(DockerIT.class.getResource("dockerAnsible").toURI(), ITConstants.DEPENDENCIES_DIR);
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());
assertEquals(ProcessEntry.StatusEnum.FINISHED, pir.getStatus());
byte[] ab = getLog(pir.getLogFileName());
assertLog(".*\"msg\": \"Hello from Docker!\".*", ab);
// --
File resp = processApi.downloadAttachment(pir.getInstanceId(), "ansible_stats.json");
assertNotNull(resp);
}
use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.
the class DockerIT method testTaskSyntaxOut.
@Test
public void testTaskSyntaxOut() throws Exception {
byte[] payload = archive(DockerIT.class.getResource("dockerTaskSyntaxOut").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());
assertLog(".*!! Hello, world.*", ab);
assertLog(".*DOCKER: STDERR STILL WORKS.*", ab);
}
use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.
the class DockerIT method testLogWithoutStdOut.
@Test
public void testLogWithoutStdOut() throws Exception {
byte[] payload = archive(DockerIT.class.getResource("dockerLogWithoutStdOut").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());
assertLog(".*DOCKER: Hello, world.*", ab);
assertLog(".*DOCKER: STDERR WORKS.*", ab);
}
Aggregations