dockest
Version:
Dockest is an integration testing tool aimed at alleviating the process of evaluating unit tests whilst running multi-container Docker applications.
15 lines • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createWebReadinessCheck = void 0;
const with_no_stop_1 = require("./with-no-stop");
const with_retry_1 = require("./with-retry");
const execa_wrapper_1 = require("../utils/execa-wrapper");
const webReadinessCheck = (portConfig) => async (args) => {
const port = await (typeof portConfig === 'function' ? portConfig(args.runner) : portConfig);
const command = `docker exec ${args.runner.containerId} \
sh -c "wget --quiet --tries=1 --spider http://localhost:${port}/.well-known/healthcheck"`;
(0, execa_wrapper_1.execaWrapper)(command, { runner: args.runner });
};
const createWebReadinessCheck = (args) => { var _a, _b; return (0, with_no_stop_1.withNoStop)((0, with_retry_1.withRetry)(webReadinessCheck((_a = args === null || args === void 0 ? void 0 : args.port) !== null && _a !== void 0 ? _a : 3000), { retryCount: (_b = args === null || args === void 0 ? void 0 : args.retryCount) !== null && _b !== void 0 ? _b : 30 })); };
exports.createWebReadinessCheck = createWebReadinessCheck;
//# sourceMappingURL=create-web-readiness-check.js.map