UNPKG

dockest

Version:

Dockest is an integration testing tool aimed at alleviating the process of evaluating unit tests whilst running multi-container Docker applications.

23 lines 1.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createRedisReadinessCheck = 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 defaultPortConfig = () => 6379; const redisReadinessCheck = (portConfig) => async (args) => { const port = await (typeof portConfig === 'function' ? portConfig(args.runner) : portConfig); const command = `docker exec ${args.runner.containerId} redis-cli \ -h localhost \ -p ${port} \ PING`; (0, execa_wrapper_1.execaWrapper)(command, { runner: args.runner }); }; const createRedisReadinessCheck = (args) => { var _a, _b; return (0, with_no_stop_1.withNoStop)((0, with_retry_1.withRetry)(redisReadinessCheck((_a = args === null || args === void 0 ? void 0 : args.port) !== null && _a !== void 0 ? _a : defaultPortConfig), { retryCount: (_b = args === null || args === void 0 ? void 0 : args.retryCount) !== null && _b !== void 0 ? _b : 30, })); }; exports.createRedisReadinessCheck = createRedisReadinessCheck; //# sourceMappingURL=create-redis-readiness-check.js.map