forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…tic#47632) * refactor failed_tests_reporter to use TS, no octokit (elastic#46993) * refactor failed_tests_reporter to use TS, no octokit * update renovate config * ensure that all kbn-test files are in ts project * fix some type errors * add some more tests * [kbn-test/githubapi] cleanup and document * collect log messages as strings instead of message objects * ensure issue is open when updating body * improve readability of getKibanaIssues * expose axios helpers from dev-utils * fix request params for fetching github issues and validate locally * include a README for failed_tests_reporter * improve axios error helpers # Conflicts: # package.json # packages/kbn-test/src/index.ts # packages/kbn-test/src/mocha/junit_report_generation.js # renovate.json5 # src/dev/jest/junit_reporter.js # yarn.lock * ensure all of kbn-test is in ts project
- Loading branch information
Spencer
authored
Oct 9, 2019
1 parent
1240208
commit 9293ea9
Showing
41 changed files
with
1,092 additions
and
565 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
export * from './errors'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,5 @@ | |
}, | ||
"include": [ | ||
"src/**/*" | ||
], | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# failed tests reporter | ||
|
||
A little CLI that runs in CI to find the failed tests in the JUnit reports, then create/update github issues for each failure. | ||
|
||
## Test this script locally | ||
|
||
To fetch some JUnit reports from a recent build on CI, visit its `Google Cloud Storage Upload Report` and execute the following in the JS Console: | ||
|
||
```js | ||
copy(`wget "${Array.from($$('a[href$=".xml"]')).filter(a => a.innerText === 'Download').map(a => a.href.replace('https://storage.cloud.google.com/', 'https://storage.googleapis.com/')).join('" "')}"`) | ||
``` | ||
|
||
This copies a script to download the reporets, which can be executed in the `test/junit` directory. | ||
|
||
Next, run the CLI in `--dry-run` mode so that it doesn't actually communicate with Github. | ||
|
||
```sh | ||
node scripts/report_failed_tests.js --verbose --dry-run --build-url foo | ||
``` | ||
|
||
If you specify the `GITHUB_TOKEN` environment variable then `--dry-run` will execute read operations but still won't execute write operations. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
91 changes: 91 additions & 0 deletions
91
packages/kbn-test/src/failed_tests_reporter/get_failures.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { ToolingLog } from '@kbn/dev-utils'; | ||
|
||
import { getFailures } from './get_failures'; | ||
|
||
const log = new ToolingLog(); | ||
|
||
it('discovers failures in ftr report', async () => { | ||
const failures = await getFailures(log, require.resolve('./__fixtures__/ftr_report.xml')); | ||
expect(failures).toMatchInlineSnapshot(` | ||
Array [ | ||
Object { | ||
"classname": "Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/maps/sample_data·js", | ||
"failure": " | ||
Error: retry.try timeout: TimeoutError: Waiting for element to be located By(css selector, [data-test-subj~=\\"layerTocActionsPanelToggleButtonRoad_Map_-_Bright\\"]) | ||
Wait timed out after 10055ms | ||
at /var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-ciGroup7/node/immutable/kibana/node_modules/selenium-webdriver/lib/webdriver.js:834:17 | ||
at process._tickCallback (internal/process/next_tick.js:68:7) | ||
at lastError (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-ciGroup7/node/immutable/kibana/test/common/services/retry/retry_for_success.ts:28:9) | ||
at onFailure (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-ciGroup7/node/immutable/kibana/test/common/services/retry/retry_for_success.ts:68:13) | ||
", | ||
"name": "maps app maps loaded from sample data ecommerce \\"before all\\" hook", | ||
"time": "154.378", | ||
}, | ||
] | ||
`); | ||
}); | ||
|
||
it('discovers failures in jest report', async () => { | ||
const failures = await getFailures(log, require.resolve('./__fixtures__/jest_report.xml')); | ||
expect(failures).toMatchInlineSnapshot(` | ||
Array [ | ||
Object { | ||
"classname": "X-Pack Jest Tests.x-pack/legacy/plugins/code/server/lsp", | ||
"failure": " | ||
TypeError: Cannot read property '0' of undefined | ||
at Object.<anonymous>.test (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-intake/node/immutable/kibana/x-pack/legacy/plugins/code/server/lsp/abstract_launcher.test.ts:166:10) | ||
", | ||
"name": "launcher can reconnect if process died", | ||
"time": "7.060", | ||
}, | ||
] | ||
`); | ||
}); | ||
|
||
it('discovers failures in karma report', async () => { | ||
const failures = await getFailures(log, require.resolve('./__fixtures__/karma_report.xml')); | ||
expect(failures).toMatchInlineSnapshot(` | ||
Array [ | ||
Object { | ||
"classname": "Browser Unit Tests.CoordinateMapsVisualizationTest", | ||
"failure": "Error: expected 7069 to be below 64 | ||
at Assertion.__kbnBundles__.tests../packages/kbn-expect/expect.js.Assertion.assert (http://localhost:5610/bundles/tests.bundle.js?shards=4&shard_num=1:13671:11) | ||
at Assertion.__kbnBundles__.tests../packages/kbn-expect/expect.js.Assertion.lessThan.Assertion.below (http://localhost:5610/bundles/tests.bundle.js?shards=4&shard_num=1:13891:8) | ||
at Function.lessThan (http://localhost:5610/bundles/tests.bundle.js?shards=4&shard_num=1:14078:15) | ||
at _callee3$ (http://localhost:5610/bundles/tests.bundle.js?shards=4&shard_num=1:158985:60) | ||
at tryCatch (webpack://%5Bname%5D/./node_modules/regenerator-runtime/runtime.js?:62:40) | ||
at Generator.invoke [as _invoke] (webpack://%5Bname%5D/./node_modules/regenerator-runtime/runtime.js?:288:22) | ||
at Generator.prototype.<computed> [as next] (webpack://%5Bname%5D/./node_modules/regenerator-runtime/runtime.js?:114:21) | ||
at asyncGeneratorStep (http://localhost:5610/bundles/tests.bundle.js?shards=4&shard_num=1:158772:103) | ||
at _next (http://localhost:5610/bundles/tests.bundle.js?shards=4&shard_num=1:158774:194) | ||
", | ||
"name": "CoordinateMapsVisualizationTest CoordinateMapsVisualization - basics should initialize OK", | ||
"time": "0.265", | ||
}, | ||
] | ||
`); | ||
}); | ||
|
||
it('discovers failures in mocha report', async () => { | ||
const failures = await getFailures(log, require.resolve('./__fixtures__/mocha_report.xml')); | ||
expect(failures).toMatchInlineSnapshot(`Array []`); | ||
}); |
Oops, something went wrong.