Skip to content

Commit

Permalink
Run sample uptime tests using @elastic/synthetics
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Sep 15, 2021
1 parent a4b28a6 commit 12a8125
Show file tree
Hide file tree
Showing 19 changed files with 4,581 additions and 10 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@
"lodash": "^4.17.21",
"lru-cache": "^4.1.5",
"lz-string": "^1.4.4",
"maplibre-gl": "1.15.2",
"mapbox-gl-draw-rectangle-mode": "1.0.4",
"maplibre-gl": "1.15.2",
"markdown-it": "^10.0.0",
"md5": "^2.1.0",
"mdast-util-to-hast": "10.0.1",
Expand Down Expand Up @@ -438,6 +438,7 @@
"@elastic/eslint-plugin-eui": "0.0.2",
"@elastic/github-checks-reporter": "0.0.20b3",
"@elastic/makelogs": "^6.0.0",
"@elastic/synthetics": "^1.0.0-beta.12",
"@emotion/babel-preset-css-prop": "^11.2.0",
"@emotion/jest": "^11.3.0",
"@istanbuljs/schema": "^0.1.2",
Expand Down Expand Up @@ -639,8 +640,8 @@
"@types/yauzl": "^2.9.1",
"@types/zen-observable": "^0.8.0",
"@typescript-eslint/eslint-plugin": "^4.14.1",
"@typescript-eslint/typescript-estree": "^4.14.1",
"@typescript-eslint/parser": "^4.14.1",
"@typescript-eslint/typescript-estree": "^4.14.1",
"@yarnpkg/lockfile": "^1.1.0",
"abab": "^2.0.4",
"aggregate-error": "^3.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ it('produces the right watch and ignore list', () => {
<absolute path>/x-pack/plugins/security_solution/scripts,
<absolute path>/x-pack/plugins/security_solution/server/lib/detection_engine/scripts,
<absolute path>/x-pack/plugins/metrics_entities/server/scripts,
<absolute path>/x-pack/plugins/uptime/e2e,
]
`);
});
1 change: 1 addition & 0 deletions packages/kbn-cli-dev-mode/src/get_server_watch_paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export function getServerWatchPaths({ pluginPaths, pluginScanDirs }: Options) {
fromRoot('x-pack/plugins/security_solution/scripts'),
fromRoot('x-pack/plugins/security_solution/server/lib/detection_engine/scripts'),
fromRoot('x-pack/plugins/metrics_entities/server/scripts'),
fromRoot('x-pack/plugins/uptime/e2e'),
];

return {
Expand Down
1 change: 1 addition & 0 deletions src/dev/license_checker/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const LICENSE_ALLOWED = [
'(MIT OR Apache-2.0)',
'(MIT OR GPL-3.0)',
'(WTFPL OR MIT)',
'(MIT OR WTFPL)',
'(Unlicense OR Apache-2.0)',
'AFLv2.1',
'Apache 2.0',
Expand Down
5 changes: 5 additions & 0 deletions src/dev/typescript/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ export const PROJECTS = [
disableTypeCheck: true,
}),

createProject('x-pack/plugins/uptime/e2e/tsconfig.json', {
name: 'uptime/synthetics-e2e-tests',
disableTypeCheck: true,
}),

...findProjects('packages/*/tsconfig.json'),
...findProjects('src/plugins/*/tsconfig.json'),
...findProjects('src/plugins/chart_expressions/*/tsconfig.json'),
Expand Down
12 changes: 12 additions & 0 deletions test/scripts/jenkins_uptime_playwright.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

source test/scripts/jenkins_test_setup_xpack.sh

echo " -> Running Uptime @elastic/synthetics tests"
cd "$XPACK_DIR"

checks-reporter-with-killswitch "Uptime @elastic/synthetics Tests" \
node plugins/uptime/scripts/e2e.js

echo ""
echo ""
9 changes: 9 additions & 0 deletions vars/tasks.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ def functionalXpack(Map params = [:]) {
task(kibanaPipeline.functionalTestProcess('xpack-APMCypress', './test/scripts/jenkins_apm_cypress.sh'))
}
}

whenChanged([
'x-pack/plugins/uptime/',
]) {
if (githubPr.isPr()) {
task(kibanaPipeline.functionalTestProcess('xpack-UptimePlaywright', './test/scripts/jenkins_uptime_playwright.sh'))
}
}

}
}

Expand Down
54 changes: 54 additions & 0 deletions x-pack/plugins/uptime/e2e/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* 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.
*/

import { FtrConfigProviderContext } from '@kbn/test';

import { CA_CERT_PATH } from '@kbn/dev-utils';
async function config({ readConfigFile }: FtrConfigProviderContext) {
const kibanaCommonTestsConfig = await readConfigFile(
require.resolve('../../../../test/common/config.js')
);
const xpackFunctionalTestsConfig = await readConfigFile(
require.resolve('../../../test/functional/config.js')
);

return {
...kibanaCommonTestsConfig.getAll(),

esTestCluster: {
...xpackFunctionalTestsConfig.get('esTestCluster'),
serverArgs: [
...xpackFunctionalTestsConfig.get('esTestCluster.serverArgs'),
// define custom es server here
// API Keys is enabled at the top level
'xpack.security.enabled=true',
],
},

kbnTestServer: {
...xpackFunctionalTestsConfig.get('kbnTestServer'),
sourceArgs: [...xpackFunctionalTestsConfig.get('kbnTestServer.sourceArgs'), '--no-watch'],
serverArgs: [
...xpackFunctionalTestsConfig.get('kbnTestServer.serverArgs'),
'--csp.strict=false',
'--home.disableWelcomeScreen=true',
'--csp.warnLegacyBrowsers=false',
// define custom kibana server args here
`--elasticsearch.ssl.certificateAuthorities=${CA_CERT_PATH}`,
`--elasticsearch.ignoreVersionMismatch=true`,
`--uiSettings.overrides.theme:darkMode=true`,
`--elasticsearch.username=kibana_system`,
`--elasticsearch.password=changeme`,
'--migrations.enableV2=false',
'--xpack.reporting.enabled=false',
],
},
};
}

// eslint-disable-next-line import/no-default-export
export default config;
Binary file not shown.
Loading

0 comments on commit 12a8125

Please sign in to comment.