Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: capture beforeAll hook errors #316

Merged
merged 2 commits into from
Jun 23, 2021

Conversation

vigneshshanmugam
Copy link
Member

  • fix propagate errors from beforeAll and afterAll hooks #280
  • We capture the beforeAll hook errors and any error that happens in any one of the hooks would be captured and all journeys that run on the current invocation will report that error event with failed status to be able to captured as part of the Uptime UI.
  • afterAll errors behaves the same - we report them in the stderror logs which will be captured by Heartbeat.

@apmmachine
Copy link

apmmachine commented Jun 22, 2021

❕ Build Aborted

Either there was a build timeout or someone aborted the build.'}

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts

Expand to view the summary

Build stats

  • Build Cause: Pull request #316 updated

  • Start Time: 2021-06-23T17:06:54.069+0000

  • Duration: 27 min 51 sec

  • Commit: d59eb65

Test stats 🧪

Test Results
Failed 0
Passed 110
Skipped 0
Total 110

Trends 🧪

Image of Build Times

Image of Tests

Log output

Expand to view the last 100 lines of log output

[2021-06-23T17:16:02.583Z]  > git config --get remote.origin.url # timeout=10
[2021-06-23T17:16:02.587Z] using GIT_SSH to set credentials GitHub user @elasticmachine SSH key
[2021-06-23T17:16:02.591Z]  > git merge f52f0bf3d18ca418d1eec4afd1370751fdd914ce # timeout=10
[2021-06-23T17:16:02.617Z]  > git rev-parse HEAD^{commit} # timeout=10
[2021-06-23T17:16:02.631Z]  > git config core.sparsecheckout # timeout=10
[2021-06-23T17:16:02.634Z]  > git checkout -f b16d162a47882357c4b24aa4e4224c78b652f742 # timeout=15
[2021-06-23T17:16:06.123Z] Commit message: "Merge commit 'f52f0bf3d18ca418d1eec4afd1370751fdd914ce' into HEAD"
[2021-06-23T17:16:06.131Z] First time build. Skipping changelog.
[2021-06-23T17:16:06.131Z] Cleaning workspace
[2021-06-23T17:16:06.126Z]  > git rev-list --no-walk 07b466ae5f1b62a76b8de63fe2f1d8d0aa1f77f2 # timeout=10
[2021-06-23T17:16:06.133Z]  > git rev-parse --verify HEAD # timeout=10
[2021-06-23T17:16:06.138Z] Resetting working tree
[2021-06-23T17:16:06.138Z]  > git reset --hard # timeout=10
[2021-06-23T17:16:06.158Z]  > git clean -fdx # timeout=10
[2021-06-23T17:16:07.701Z] Running in /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-316/src/github.com/elastic/synthetics
[2021-06-23T17:16:21.427Z] + set +x
[2021-06-23T17:16:21.427Z] => Downloading nvm from git to '/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-316/.nvm'
[2021-06-23T17:16:21.427Z] 
=> Initialized empty Git repository in /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-316/.nvm/.git/
[2021-06-23T17:16:21.994Z] From https://github.com/nvm-sh/nvm
[2021-06-23T17:16:21.994Z]  * [new tag]         v0.37.1    -> v0.37.1
[2021-06-23T17:16:22.252Z] => Compressing and cleaning up git repository
[2021-06-23T17:16:22.252Z] 
[2021-06-23T17:16:22.252Z] => Profile not found. Tried ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile.
[2021-06-23T17:16:22.252Z] => Create one of them and run this script again
[2021-06-23T17:16:22.252Z]    OR
[2021-06-23T17:16:22.252Z] => Append the following lines to the correct file yourself:
[2021-06-23T17:16:22.252Z] 
[2021-06-23T17:16:22.252Z] export NVM_DIR="$HOME/.nvm"
[2021-06-23T17:16:22.252Z] [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[2021-06-23T17:16:22.252Z] 
[2021-06-23T17:16:24.154Z] => Close and reopen your terminal to start using nvm or run the following to use it now:
[2021-06-23T17:16:24.154Z] 
[2021-06-23T17:16:24.154Z] export NVM_DIR="$HOME/.nvm"
[2021-06-23T17:16:24.154Z] [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[2021-06-23T17:16:24.154Z] Installing latest LTS version.
[2021-06-23T17:16:24.154Z] v14.17.1 is already installed.
[2021-06-23T17:16:24.413Z] Now using node v14.17.1 (npm v6.14.13)
[2021-06-23T17:16:24.476Z] Running in /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-316/src/github.com/elastic/synthetics
[2021-06-23T17:16:24.765Z] + chmod -R ugo+rw examples
[2021-06-23T17:16:24.782Z] Running in /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-316/src/github.com/elastic/synthetics/__tests__/e2e
[2021-06-23T17:16:25.082Z] + npm run test
[2021-06-23T17:16:25.082Z] 
[2021-06-23T17:16:25.082Z] > e2e-synthetics@ test /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-316/src/github.com/elastic/synthetics/__tests__/e2e
[2021-06-23T17:16:25.082Z] > npm i && npm run setup &&  bash scripts/test.sh
[2021-06-23T17:16:25.082Z] 
[2021-06-23T17:16:28.367Z] added 3 packages from 4 contributors and audited 178 packages in 2.451s
[2021-06-23T17:16:30.269Z] 
[2021-06-23T17:16:30.269Z] 66 packages are looking for funding
[2021-06-23T17:16:30.269Z]   run `npm fund` for details
[2021-06-23T17:16:30.269Z] 
[2021-06-23T17:16:30.269Z] found 1 moderate severity vulnerability
[2021-06-23T17:16:30.269Z]   run `npm audit fix` to fix them, or `npm audit` for details
[2021-06-23T17:16:30.531Z] 
[2021-06-23T17:16:30.531Z] > e2e-synthetics@ setup /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-316/src/github.com/elastic/synthetics/__tests__/e2e
[2021-06-23T17:16:30.531Z] > bash scripts/setup.sh
[2021-06-23T17:16:30.531Z] 
[2021-06-23T17:16:30.531Z] 
[2021-06-23T17:16:30.532Z] Temporary folder
[2021-06-23T17:16:30.532Z] Temporary files will be stored in: ./tmp
[2021-06-23T17:16:30.532Z] 
[2021-06-23T17:16:30.532Z] Starting elasticsearch , kibana and synthetics docker
[2021-06-23T17:16:30.532Z] 
[2021-06-23T17:16:30.532Z] 
[2021-06-23T17:16:30.532Z] Waiting for synthetics docker to start...
[2021-06-23T17:16:30.791Z] Error: No such object: synthetics
[2021-06-23T17:16:40.776Z] Error: No such object: synthetics
[2021-06-23T17:16:50.759Z] Error: No such object: synthetics
[2021-06-23T17:17:02.972Z] Error: No such object: synthetics
[2021-06-23T17:17:11.090Z] Error: No such object: synthetics
[2021-06-23T17:17:21.069Z] Error: No such object: synthetics
[2021-06-23T17:17:33.295Z] ✅ Setup completed successfully. Running e2e tests...
[2021-06-23T17:17:33.295Z] Waiting for Elastic Search  to start
[2021-06-23T17:18:20.211Z] Waiting for Synthetics to send data to ES for test monitor
[2021-06-23T17:33:31.079Z] Cancelling nested steps due to timeout
[2021-06-23T17:33:31.083Z] Sending interrupt signal to process
[2021-06-23T17:33:42.454Z] scripts/test.sh: line 26:  5224 Terminated              SYNTHETICS_JUNIT_FILE='junit.xml' npx @elastic/synthetics uptime.journey.ts --reporter junit
[2021-06-23T17:33:42.454Z] npm ERR! code ELIFECYCLE
[2021-06-23T17:33:42.454Z] npm ERR! errno 143
[2021-06-23T17:33:42.454Z] npm ERR! e2e-synthetics@ test: `npm i && npm run setup &&  bash scripts/test.sh`
[2021-06-23T17:33:42.454Z] npm ERR! Exit status 143
[2021-06-23T17:33:42.454Z] npm ERR! 
[2021-06-23T17:33:42.454Z] npm ERR! Failed at the e2e-synthetics@ test script.
[2021-06-23T17:33:42.454Z] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[2021-06-23T17:33:42.454Z] Terminated
[2021-06-23T17:33:42.459Z] script returned exit code 143
[2021-06-23T17:33:43.563Z] Post stage
[2021-06-23T17:33:43.587Z] Archiving artifacts
[2021-06-23T17:33:43.727Z] Recording test results
[2021-06-23T17:33:43.836Z] None of the test reports contained any result
[2021-06-23T17:33:43.841Z] [Checks API] No suitable checks publisher found.
[2021-06-23T17:33:43.924Z] Stage "Release" skipped due to earlier failure(s)
[2021-06-23T17:33:43.936Z] Stage "Release" skipped due to earlier failure(s)
[2021-06-23T17:33:43.963Z] Stage "Release" skipped due to earlier failure(s)
[2021-06-23T17:33:44.451Z] Running on Jenkins in /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-316
[2021-06-23T17:33:44.486Z] [INFO] getVaultSecret: Getting secrets
[2021-06-23T17:33:44.522Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2021-06-23T17:33:45.139Z] + chmod 755 generate-build-data.sh
[2021-06-23T17:33:45.139Z] + ./generate-build-data.sh https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-rum/elastic-synthetics/PR-316/ https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-rum/elastic-synthetics/PR-316/runs/2 ABORTED 1610810
[2021-06-23T17:33:45.139Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-rum/elastic-synthetics/PR-316/runs/2/steps/?limit=10000 -o steps-info.json
[2021-06-23T17:33:45.139Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-rum/elastic-synthetics/PR-316/runs/2/tests/?status=FAILED -o tests-errors.json

Copy link
Contributor

@andrewvc andrewvc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending the minor changes mentioned

__tests__/core/runner.test.ts Show resolved Hide resolved
src/reporters/json.ts Show resolved Hide resolved
@vigneshshanmugam vigneshshanmugam merged commit fc4f9bf into elastic:master Jun 23, 2021
@vigneshshanmugam vigneshshanmugam deleted the capture-hook-error branch June 23, 2021 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

propagate errors from beforeAll and afterAll hooks
3 participants