gitbeaker/scripts/probe.js
Justin Dalrymple db63076a5a
Reach > 90% coverage and add Integration Testing (#709)
- Added many many more unit tests to increase coverage to 90% +
- Removed the upsert functionality of PushRules to maintain documented API parity
2020-06-20 14:55:12 +02:00

39 lines
680 B
JavaScript

/* eslint-disable */
const request = require('got');
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
// Define readiness function
async function checkReadiness() {
const body = await request.get(`${process.env.GITLAB_URL}/-/readiness?all=1`).json();
return body.master_check[0].status == 'ok';
}
// Poll GL for a successful readiness status
async function run() {
let attempt = 0;
await sleep(170000);
while (attempt < 10) {
try {
const ready = await checkReadiness();
if (ready) break;
} catch (e) {
console.error(e.message);
}
await sleep(10000);
attempt += 1;
}
}
run();