use of com.walmartlabs.concord.client.NodeRosterHostsApi 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.*");
}
Aggregations