Skip to content

Commit

Permalink
[EDR Workflows] Add junit config to osquery cypress tests (#169060)
Browse files Browse the repository at this point in the history
Co-authored-by: Patryk Kopyciński <[email protected]>
  • Loading branch information
tomsonpl and patrykkopycinski authored Oct 18, 2023
1 parent 9a9c21b commit 69cfe3a
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 10 deletions.
6 changes: 0 additions & 6 deletions .buildkite/pipelines/pull_request/osquery_cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ steps:
automatic:
- exit_status: '*'
limit: 1
artifact_paths:
- "target/kibana-osquery/**/*"

- command: .buildkite/scripts/steps/functional/security_serverless_osquery.sh
label: 'Serverless Osquery Cypress Tests'
Expand All @@ -24,8 +22,6 @@ steps:
automatic:
- exit_status: '*'
limit: 1
artifact_paths:
- 'target/kibana-osquery/**/*'

- command: .buildkite/scripts/steps/functional/osquery_cypress_burn.sh
label: 'Osquery Cypress Tests, burning changed specs'
Expand All @@ -36,5 +32,3 @@ steps:
soft_fail: true
retry:
automatic: false
artifact_paths:
- 'target/kibana-osquery/**/*'
1 change: 1 addition & 0 deletions .buildkite/scripts/lifecycle/post_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ if [[ "$IS_TEST_EXECUTION_STEP" == "true" ]]; then
buildkite-agent artifact upload 'target/kibana-coverage/functional/**/*'
buildkite-agent artifact upload 'target/kibana-*'
buildkite-agent artifact upload 'target/kibana-security-solution/**/*.png'
buildkite-agent artifact upload 'target/kibana-osquery/**/*.png'
buildkite-agent artifact upload 'target/kibana-fleet/**/*.png'
buildkite-agent artifact upload 'target/test-metrics/*'
buildkite-agent artifact upload 'target/test-suites-ci-plan.json'
Expand Down
10 changes: 7 additions & 3 deletions .buildkite/scripts/steps/functional/osquery_cypress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

set -euo pipefail

source .buildkite/scripts/common/util.sh
source .buildkite/scripts/steps/functional/common.sh
source .buildkite/scripts/steps/functional/common_cypress.sh

.buildkite/scripts/bootstrap.sh
# TODO: remove the line below to use build artifacts for tests.
# in addition to remove the line, we will have to expose the kibana install dir into the downloaded build location
# by exporting a var like:
# export KIBANA_INSTALL_DIR=${KIBANA_BUILD_LOCATION}
node scripts/build_kibana_platform_plugins.js

export JOB=kibana-osquery-cypress
Expand All @@ -14,4 +17,5 @@ echo "--- Osquery Cypress tests"

cd x-pack/plugins/osquery

yarn --cwd x-pack/plugins/osquery cypress:run
set +e
yarn cypress:run; status=$?; yarn junit:merge || :; exit $status
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ export JOB=kibana-osquery-cypress-serverless

echo "--- Security Osquery Serverless Cypress"

yarn --cwd x-pack/plugins/osquery cypress:serverless:run
cd x-pack/plugins/osquery

set +e
yarn cypress:serverless:run; status=$?; yarn junit:merge || :; exit $status
5 changes: 5 additions & 0 deletions x-pack/plugins/osquery/cypress/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ const ROLES_YAML_FILE_PATH = path.join(
const roleDefinitions = loadYaml(readFileSync(ROLES_YAML_FILE_PATH, 'utf8')) as YamlRoleDefinitions;

export default defineCypressConfig({
reporter: '../../../node_modules/cypress-multi-reporters',
reporterOptions: {
configFile: './cypress/reporter_config.json',
},

defaultCommandTimeout: 60000,
execTimeout: 120000,
pageLoadTimeout: 12000,
Expand Down
10 changes: 10 additions & 0 deletions x-pack/plugins/osquery/cypress/reporter_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"reporterEnabled": "mochawesome, mocha-junit-reporter",
"reporterOptions": {
"html": false,
"json": true,
"mochaFile": "../../../target/kibana-osquery/cypress/results/TEST-osquery-cypress-[hash].xml",
"overwrite": false,
"reportDir": "../../../target/kibana-osquery/cypress/results"
}
}
5 changes: 5 additions & 0 deletions x-pack/plugins/osquery/cypress/serverless_cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import { setupUserDataLoader } from '../../../test_serverless/functional/test_su

// eslint-disable-next-line import/no-default-export
export default defineCypressConfig({
reporter: '../../../node_modules/cypress-multi-reporters',
reporterOptions: {
configFile: './cypress/reporter_config.json',
},

defaultCommandTimeout: 60000,
execTimeout: 60000,
pageLoadTimeout: 60000,
Expand Down

0 comments on commit 69cfe3a

Please sign in to comment.