[Fleet] API integration test make docker server waitForLogline timeout configurable (#140128)

This commit is contained in:
Nicolas Chaulet 2022-09-07 12:26:10 -04:00 committed by GitHub
parent f7d1d6769d
commit feeee2a5fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 2 deletions

View file

@ -71,6 +71,7 @@ const dockerServerSchema = () =>
port: requiredWhenEnabled(Joi.number()),
portInContainer: requiredWhenEnabled(Joi.number()),
waitForLogLine: Joi.alternatives(Joi.object().instance(RegExp), Joi.string()).optional(),
waitForLogLineTimeoutMs: Joi.number().integer().optional(),
waitFor: Joi.func().optional(),
args: Joi.array().items(Joi.string()).optional(),
})

View file

@ -14,6 +14,7 @@ export interface DockerServerSpec {
port: number;
image: string;
waitForLogLine?: RegExp | string;
waitForLogLineTimeoutMs?: number;
/** a function that should return an observable that will allow the tests to execute as soon as it emits anything */
waitFor?: (server: DockerServer, logLine$: Rx.Observable<string>) => Rx.Observable<unknown>;
/* additional command line arguments passed to docker run */

View file

@ -101,7 +101,7 @@ export class DockerServersService {
private async startServer(server: DockerServer) {
const { log, lifecycle } = this;
const { image, name, waitFor, waitForLogLine } = server;
const { image, name, waitFor, waitForLogLine, waitForLogLineTimeoutMs } = server;
// pull image from registry
log.info(`[docker:${name}] pulling docker image "${image}"`);
@ -200,7 +200,8 @@ export class DockerServersService {
: line.includes(waitForLogLine)
)
),
`waitForLogLine didn't emit anything`
`waitForLogLine didn't emit anything`,
waitForLogLineTimeoutMs
)
).toPromise();
}

View file

@ -52,6 +52,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
port: registryPort,
args: dockerArgs,
waitForLogLine: 'package manifests loaded',
waitForLogLineTimeoutMs: 60 * 2 * 10000, // 2 minutes
},
}),
services: xPackAPITestsConfig.get('services'),