2020-06-29 15:24:11 +02:00
|
|
|
/*
|
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
2021-02-04 03:12:39 +01:00
|
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
|
|
* 2.0.
|
2020-06-29 15:24:11 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
import { Context } from 'mocha';
|
|
|
|
import { ToolingLog } from '@kbn/dev-utils';
|
2020-07-22 19:29:44 +02:00
|
|
|
import { FtrProviderContext } from '../api_integration/ftr_provider_context';
|
2020-06-29 15:24:11 +02:00
|
|
|
|
|
|
|
export function warnAndSkipTest(mochaContext: Context, log: ToolingLog) {
|
|
|
|
log.warning(
|
2020-11-12 19:50:59 +01:00
|
|
|
'disabling tests because DockerServers service is not enabled, set FLEET_PACKAGE_REGISTRY_PORT to run them'
|
2020-06-29 15:24:11 +02:00
|
|
|
);
|
|
|
|
mochaContext.skip();
|
|
|
|
}
|
2020-07-22 19:29:44 +02:00
|
|
|
|
|
|
|
export function skipIfNoDockerRegistry(providerContext: FtrProviderContext) {
|
|
|
|
const { getService } = providerContext;
|
|
|
|
const dockerServers = getService('dockerServers');
|
|
|
|
|
|
|
|
const server = dockerServers.get('registry');
|
|
|
|
const log = getService('log');
|
|
|
|
|
2020-07-23 18:45:38 +02:00
|
|
|
beforeEach(function beforeSetupWithDockerRegistry() {
|
2020-07-22 19:29:44 +02:00
|
|
|
if (!server.enabled) {
|
|
|
|
warnAndSkipTest(this, log);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|