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

wrap fs methods with promisify for node@12 compat #328

Merged
merged 1 commit into from
Jun 29, 2021
Merged

wrap fs methods with promisify for node@12 compat #328

merged 1 commit into from
Jun 29, 2021

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Jun 29, 2021

While working on limiting the node version in CI to match the version installed by Heartbeat (#327) we realized that the use of the fs/promises API is not compatible with this node version.

This PR removes the fs/promises usage and instead exposes part of the fs API wrapped with util.promisify() from src/helpers and uses that in src/core/runner.

@spalger spalger requested a review from vigneshshanmugam June 29, 2021 19:27
@apmmachine
Copy link

apmmachine commented Jun 29, 2021

💔 Tests Failed

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

Expand to view the summary

Build stats

  • Build Cause: Started by user Vignesh Shanmugam

  • Start Time: 2021-06-29T20:35:14.322+0000

  • Duration: 7 min 56 sec

  • Commit: 111f34d

Test stats 🧪

Test Results
Failed 1
Passed 112
Skipped 0
Total 113

Trends 🧪

Image of Build Times

Image of Tests

Test errors 1

Expand to view the tests failures

Test / CLI pass playwright options to runner – CLI pass playwright options to runner
  • no error details
  • Expand to view the stacktrace

     Error: error: unknown option '--json'
    
        at Socket.<anonymous> (/var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-328/src/github.com/elastic/synthetics/__tests__/cli.test.ts:236:50)
        at Socket.emit (events.js:375:28)
        at addChunk (internal/streams/readable.js:290:12)
        at readableAddChunk (internal/streams/readable.js:265:9)
        at Socket.Readable.push (internal/streams/readable.js:204:10)
        at Pipe.onStreamRead (internal/stream_base_commons.js:188:23) 
    

Steps errors 1

Expand to view the steps failures

Runs the tests
  • Took 1 min 45 sec . View more details on here
  • Description: ./node_modules/.bin/jest --ci --reporters=default --reporters=jest-junit

Log output

Expand to view the last 100 lines of log output

[2021-06-29T20:40:52.868Z] Installing latest LTS version.
[2021-06-29T20:40:52.868Z] v14.17.1 is already installed.
[2021-06-29T20:40:53.128Z] Now using node v14.17.1 (npm v6.14.13)
[2021-06-29T20:40:53.173Z] Running in /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-328/src/github.com/elastic/synthetics
[2021-06-29T20:40:53.463Z] + npm run build
[2021-06-29T20:40:53.463Z] 
[2021-06-29T20:40:53.463Z] > @elastic/[email protected] build /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-328/src/github.com/elastic/synthetics
[2021-06-29T20:40:53.463Z] > tsc
[2021-06-29T20:40:53.463Z] 
[2021-06-29T20:40:57.172Z] Timeout set to expire in 5 min 0 sec
[2021-06-29T20:40:58.163Z] Running in /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-328/src/github.com/elastic/synthetics
[2021-06-29T20:41:13.500Z] + set +x
[2021-06-29T20:41:13.500Z] => nvm is already installed in /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-328/.nvm, trying to update using git
[2021-06-29T20:41:14.070Z] 
=> => Compressing and cleaning up git repository
[2021-06-29T20:41:14.070Z] 
[2021-06-29T20:41:14.070Z] => Profile not found. Tried ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile.
[2021-06-29T20:41:14.070Z] => Create one of them and run this script again
[2021-06-29T20:41:14.070Z]    OR
[2021-06-29T20:41:14.070Z] => Append the following lines to the correct file yourself:
[2021-06-29T20:41:14.070Z] 
[2021-06-29T20:41:14.070Z] export NVM_DIR="$HOME/.nvm"
[2021-06-29T20:41:14.070Z] [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[2021-06-29T20:41:14.070Z] 
[2021-06-29T20:41:15.982Z] => Close and reopen your terminal to start using nvm or run the following to use it now:
[2021-06-29T20:41:15.982Z] 
[2021-06-29T20:41:15.982Z] export NVM_DIR="$HOME/.nvm"
[2021-06-29T20:41:15.982Z] [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[2021-06-29T20:41:15.982Z] Installing latest LTS version.
[2021-06-29T20:41:15.982Z] v14.17.1 is already installed.
[2021-06-29T20:41:16.243Z] Now using node v14.17.1 (npm v6.14.13)
[2021-06-29T20:41:16.288Z] Running in /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-328/src/github.com/elastic/synthetics
[2021-06-29T20:41:16.582Z] + npm add --dev jest-junit
[2021-06-29T20:41:16.842Z] npm WARN install Usage of the `--dev` option is deprecated. Use `--also=dev` instead.
[2021-06-29T20:41:23.431Z] npm WARN @elastic/[email protected] No repository field.
[2021-06-29T20:41:23.431Z] npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
[2021-06-29T20:41:23.431Z] npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[2021-06-29T20:41:23.431Z] 
[2021-06-29T20:41:23.431Z] + [email protected]
[2021-06-29T20:41:23.431Z] added 4 packages from 9 contributors and audited 769 packages in 5.656s
[2021-06-29T20:41:23.431Z] 
[2021-06-29T20:41:23.431Z] 66 packages are looking for funding
[2021-06-29T20:41:23.432Z]   run `npm fund` for details
[2021-06-29T20:41:23.432Z] 
[2021-06-29T20:41:23.432Z] found 10 moderate severity vulnerabilities
[2021-06-29T20:41:23.432Z]   run `npm audit fix` to fix them, or `npm audit` for details
[2021-06-29T20:41:23.727Z] + ./node_modules/.bin/jest --ci --reporters=default --reporters=jest-junit
[2021-06-29T20:41:27.945Z] 
[2021-06-29T20:41:27.945Z] Running without BrowserService
[2021-06-29T20:41:42.890Z] PASS __tests__/reporters/json.test.ts (14.009 s)
[2021-06-29T20:41:42.890Z] PASS __tests__/plugins/network.test.ts (14.555 s)
[2021-06-29T20:41:43.843Z] PASS __tests__/sdk/trace-metrics.test.ts
[2021-06-29T20:41:44.783Z] PASS __tests__/helper.test.ts
[2021-06-29T20:41:46.177Z] PASS __tests__/reporters/junit.test.ts
[2021-06-29T20:41:48.089Z] PASS __tests__/reporters/base.test.ts
[2021-06-29T20:41:49.034Z] PASS __tests__/core/index.test.ts
[2021-06-29T20:41:49.975Z] PASS __tests__/core/runner.test.ts (22.074 s)
[2021-06-29T20:41:51.892Z] PASS __tests__/plugins/browser-console.test.ts
[2021-06-29T20:41:51.892Z] PASS __tests__/index.test.ts
[2021-06-29T20:41:53.280Z] PASS __tests__/plugins/tracing.test.ts
[2021-06-29T20:41:55.203Z] PASS __tests__/core/gatherer.test.ts
[2021-06-29T20:41:55.462Z] PASS __tests__/plugins/performance.test.ts
[2021-06-29T20:41:56.850Z] PASS __tests__/plugins/plugin-manager.test.ts
[2021-06-29T20:41:56.850Z] PASS __tests__/config.test.ts
[2021-06-29T20:41:58.250Z] PASS __tests__/core/logger.test.ts
[2021-06-29T20:41:58.823Z] PASS __tests__/core/browser-service.test.ts
[2021-06-29T20:41:59.081Z] PASS __tests__/sdk/trace-processor.test.ts
[2021-06-29T20:41:59.656Z] PASS __tests__/dsl/journey.test.ts
[2021-06-29T20:42:07.786Z] FAIL __tests__/cli.test.ts (26.158 s)
[2021-06-29T20:42:07.786Z]   ● CLI › pass playwright options to runner
[2021-06-29T20:42:07.786Z] 
[2021-06-29T20:42:07.786Z]     error: unknown option '--json'
[2021-06-29T20:42:07.786Z] 
[2021-06-29T20:42:07.786Z]       234 | 
[2021-06-29T20:42:07.786Z]       235 |     this.exitCode = new Promise((res, rej) => {
[2021-06-29T20:42:07.786Z]     > 236 |       this.process.stderr.on('data', data => rej(new Error(data)));
[2021-06-29T20:42:07.786Z]           |                                                  ^
[2021-06-29T20:42:07.786Z]       237 |       this.process.on('exit', code => res(code));
[2021-06-29T20:42:07.786Z]       238 |     });
[2021-06-29T20:42:07.786Z]       239 |   }
[2021-06-29T20:42:07.786Z] 
[2021-06-29T20:42:07.786Z]       at Socket.<anonymous> (__tests__/cli.test.ts:236:50)
[2021-06-29T20:42:07.786Z] 
[2021-06-29T20:42:07.786Z] Test Suites: 1 failed, 19 passed, 20 total
[2021-06-29T20:42:07.786Z] Tests:       1 failed, 98 passed, 99 total
[2021-06-29T20:42:07.786Z] Snapshots:   11 passed, 11 total
[2021-06-29T20:42:07.786Z] Time:        40.633 s
[2021-06-29T20:42:07.786Z] Ran all test suites.
[2021-06-29T20:42:09.086Z] Post stage
[2021-06-29T20:42:09.102Z] Recording test results
[2021-06-29T20:42:09.159Z] [Checks API] No suitable checks publisher found.
[2021-06-29T20:42:09.204Z] Stage "E2e Test" skipped due to earlier failure(s)
[2021-06-29T20:42:09.228Z] Stage "Release" skipped due to earlier failure(s)
[2021-06-29T20:42:09.240Z] Stage "Release" skipped due to earlier failure(s)
[2021-06-29T20:42:09.263Z] Stage "Release" skipped due to earlier failure(s)
[2021-06-29T20:42:09.507Z] Running on Jenkins in /var/lib/jenkins/workspace/nt-rum_elastic-synthetics_PR-328
[2021-06-29T20:42:09.541Z] [INFO] getVaultSecret: Getting secrets
[2021-06-29T20:42:09.576Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2021-06-29T20:42:10.222Z] + chmod 755 generate-build-data.sh
[2021-06-29T20:42:10.223Z] + ./generate-build-data.sh https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-rum/elastic-synthetics/PR-328/ https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-rum/elastic-synthetics/PR-328/runs/3 FAILURE 415637
[2021-06-29T20:42:10.223Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-rum/elastic-synthetics/PR-328/runs/3/steps/?limit=10000 -o steps-info.json

Copy link
Member

@vigneshshanmugam vigneshshanmugam left a comment

Choose a reason for hiding this comment

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

Thanks @spalger for the quick fix,

I will merge this once I fix the broken tests in master.

@vigneshshanmugam vigneshshanmugam merged commit 17fee5e into elastic:master Jun 29, 2021
@spalger spalger deleted the implement/fs-promise-util branch June 29, 2021 20:55
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.

3 participants