Skip to content

Commit

Permalink
Actually wait
Browse files Browse the repository at this point in the history
  • Loading branch information
hayesgm committed Jan 30, 2020
1 parent e6da2ca commit fa61fe1
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions tests/IntegrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,23 @@ function sleep(ms) {
}

async function waitForLogs(serviceLogPairs) {
let [service, log] = Object.entries(serviceLogPairs)[0];
const serviceLogs = await compose.logs([service], composeOptions);
let results = await Promise.all(Object.entries(serviceLogPairs).map(async ([service, log]) => {
const serviceLogs = await compose.logs([service], composeOptions);

if (!serviceLogs.out.includes(log)) {
console.log(`Waiting for logs ${JSON.stringify(serviceLogPairs)}`);
console.log(serviceLogs.out);
if (!serviceLogs.out.includes(log)) {
console.log(`Waiting for logs ${JSON.stringify(serviceLogPairs)}`);
console.log(serviceLogs.out);
return false;
} else {
return true;
}
}));

let complete = results.every((x) => x === true);

if (complete) {
return;
} else {
await sleep(5000);
await waitForLogs(serviceLogPairs);
}
Expand Down

0 comments on commit fa61fe1

Please sign in to comment.