use of ca.ibodrov.concord.testcontainers.Payload in project concord-plugins by walmartlabs.
the class TerraformTaskIT method test.
private void test(String concordYmlSource) throws Exception {
String orgName = "org_" + randomString();
concord.organizations().create(orgName);
String projectName = "project_" + randomString();
concord.projects().create(orgName, projectName);
byte[] terraform_file = readToBytes("it/main.tf");
Payload payload = new Payload().org(orgName).project(projectName).file("main.tf", terraform_file).file("mydir/main.tf", terraform_file).file("mydir/nested/main.tf", terraform_file).concordYml(new String(readToBytes(concordYmlSource)).replace("%%version%%", CURRENT_VERSION));
ConcordProcess proc = concord.processes().start(payload);
proc.waitForStatus(ProcessEntry.StatusEnum.FINISHED);
proc.assertLog(".*FINISHED.*");
proc.assertLogAtLeast(".*No changes\\..*", 3);
}
use of ca.ibodrov.concord.testcontainers.Payload in project concord by walmartlabs.
the class ProcessIT method testTags.
@Test
public void testTags() throws Exception {
byte[] archive = archive(ProcessIT.class.getResource("example").toURI());
ConcordProcess parent = concord.processes().start(new Payload().archive(archive));
// ---
parent.expectStatus(StatusEnum.FINISHED);
// ---
archive = archive(ProcessIT.class.getResource("tags").toURI());
Payload payload = new Payload().archive(archive).parent(parent.instanceId());
ConcordProcess child = concord.processes().start(payload);
// ---
child.expectStatus(StatusEnum.FINISHED);
// ---
List<ProcessEntry> l = parent.subprocesses("abc");
assertTrue(l.isEmpty());
l = parent.subprocesses("test");
assertEquals(1, l.size());
ProcessEntry e = l.get(0);
assertEquals(child.instanceId(), e.getInstanceId());
// ---
l = concord.processes().list(ProcessListQuery.builder().addTags("xyz").build());
assertTrue(l.isEmpty());
l = concord.processes().list(ProcessListQuery.builder().addTags("IT").build());
assertEquals(1, l.size());
e = l.get(0);
assertEquals(child.instanceId(), e.getInstanceId());
}
use of ca.ibodrov.concord.testcontainers.Payload in project concord by walmartlabs.
the class ConcordTaskIT method testSuspendParentProcess.
@Test
public void testSuspendParentProcess() throws Exception {
Payload payload = new Payload().archive(resource("concord/concordTaskSuspendParentProcess"));
ConcordProcess proc = concord.processes().start(payload);
expectStatus(proc, ProcessEntry.StatusEnum.FINISHED);
// ---
proc.assertLog(".*Hello, Concord!.*");
}
use of ca.ibodrov.concord.testcontainers.Payload in project concord by walmartlabs.
the class ConcordTaskIT method testForkSuspend.
@Test
public void testForkSuspend() throws Exception {
String nameVar = "name_" + randomString();
String orgName = "org_" + randomString();
concord.organizations().create(orgName);
String projectName = "project_" + randomString();
concord.projects().create(orgName, projectName);
Payload payload = new Payload().archive(resource("concord/concordTaskForkSuspend")).org(orgName).project(projectName).arg("name", nameVar);
ConcordProcess proc = concord.processes().start(payload);
// ---
expectStatus(proc, ProcessEntry.StatusEnum.FINISHED);
// ---
proc.assertLog(".*\\{varFromFork=Hello, " + nameVar + "}.*");
proc.assertLog(".*\\{varFromFork=Bye, " + nameVar + "}.*");
}
use of ca.ibodrov.concord.testcontainers.Payload in project concord by walmartlabs.
the class ConcordTaskIT method testExternalApiToken.
/**
* start process with api key
*/
@Test
public void testExternalApiToken() throws Exception {
String username = "user_" + randomString();
UsersApi usersApi = new UsersApi(concord.apiClient());
usersApi.createOrUpdate(new CreateUserRequest().setUsername(username).setType(CreateUserRequest.TypeEnum.LOCAL));
ApiKeysApi apiKeysApi = new ApiKeysApi(concord.apiClient());
CreateApiKeyResponse cakr = apiKeysApi.create(new CreateApiKeyRequest().setUsername(username));
// ---
Payload payload = new Payload().archive(resource("concord/concordTaskApiKey")).arg("myApiKey", cakr.getKey());
ConcordProcess proc = concord.processes().start(payload);
// ---
expectStatus(proc, ProcessEntry.StatusEnum.FINISHED);
// ---
proc.assertLog(".*Hello, Concord!. From: .*" + username + ".*");
}
Aggregations