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

update some tests to run in isolated workers using tap #2538

Closed
wants to merge 20 commits into from

Conversation

rochdev
Copy link
Member

@rochdev rochdev commented Nov 17, 2022

What does this PR do?

Update some tests to run in isolated workers using tap.

Motivation

We need a way to isolate tests so that we can write integration tests without complex logic to cleanup after the suite, which is also not always possible.

@codecov
Copy link

codecov bot commented Nov 17, 2022

Codecov Report

Merging #2538 (8f9d9a9) into master (9b350c1) will decrease coverage by 2.46%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #2538      +/-   ##
==========================================
- Coverage   89.74%   87.29%   -2.46%     
==========================================
  Files         291      294       +3     
  Lines        9958     9996      +38     
==========================================
- Hits         8937     8726     -211     
- Misses       1021     1270     +249     
Impacted Files Coverage Δ
packages/dd-trace/src/appsec/reporter.js 12.30% <0.00%> (-87.70%) ⬇️
packages/dd-trace/src/appsec/index.js 17.24% <0.00%> (-82.76%) ⬇️
...kages/dd-trace/src/appsec/gateway/engine/runner.js 17.64% <0.00%> (-82.36%) ⬇️
...kages/dd-trace/src/appsec/gateway/engine/engine.js 27.11% <0.00%> (-72.89%) ⬇️
...ckages/dd-trace/src/appsec/gateway/engine/index.js 27.77% <0.00%> (-72.23%) ⬇️
...trace/src/appsec/iast/taint-tracking/operations.js 32.81% <0.00%> (-64.07%) ⬇️
packages/dd-trace/src/appsec/rule_manager.js 36.36% <0.00%> (-63.64%) ⬇️
...ce/src/appsec/iast/analyzers/injection-analyzer.js 62.50% <0.00%> (-37.50%) ⬇️
.../dd-trace/src/appsec/iast/taint-tracking/filter.js 66.66% <0.00%> (-33.34%) ⬇️
.../src/appsec/iast/analyzers/weak-cipher-analyzer.js 66.66% <0.00%> (-33.34%) ⬇️
... and 34 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@pr-commenter
Copy link

pr-commenter bot commented Nov 19, 2022

Benchmarks

Comparing candidate commit 8f9d9a9 in PR branch mocha-parallel with baseline commit 9b350c1 in branch master.

Found 1 performance improvements and 14 performance regressions! Performance is the same for 951 cases.

scenario:plugin-bluebird-with-tracer-14

  • 🟥 cpu_user_time [+5.797ms; +8.801ms] or [+2.502%; +3.799%]
  • 🟥 execution_time [+8.188ms; +8.945ms] or [+3.142%; +3.432%]
  • 🟥 max_rss_usage [+0.935KB; +1.023KB] or [+1.797%; +1.965%]

scenario:plugin-http-server-with-tracer-14

  • 🟩 cpu_usage_percentage [-2.035%; -1.426%]
  • 🟥 execution_time [+33.964ms; +48.168ms] or [+4.054%; +5.750%]

scenario:startup-control-everything-14

  • 🟥 instructions [+54325848; +63885594] or [+1.732%; +2.037%]
  • 🟥 max_rss_usage [+3.370KB; +5.827KB] or [+2.344%; +4.053%]

scenario:startup-with-tracer-everything-14

  • 🟥 instructions [+66801126; +77173940] or [+1.847%; +2.134%]

scenario:plugin-bluebird-with-tracer-16

  • 🟥 cpu_user_time [+5.843ms; +9.294ms] or [+2.487%; +3.956%]
  • 🟥 execution_time [+8.309ms; +8.881ms] or [+3.125%; +3.340%]

scenario:startup-control-everything-16

  • 🟥 instructions [+67377175; +77670469] or [+2.136%; +2.462%]

scenario:startup-with-tracer-everything-16

  • 🟥 instructions [+64965020; +77274217] or [+1.813%; +2.157%]

scenario:startup-control-everything-18

  • 🟥 instructions [+58268056; +69357639] or [+1.936%; +2.305%]

scenario:startup-with-tracer-everything-18

  • 🟥 cpu_user_time [+0.021s; +0.047s] or [+1.508%; +3.369%]
  • 🟥 instructions [+75478357; +87202152] or [+2.180%; +2.519%]

@rochdev rochdev changed the title update mocha tests to run in parallel update some tests to run in isolated workers using tap Nov 19, 2022
@rochdev rochdev marked this pull request as ready for review November 22, 2022 21:24
@rochdev rochdev requested a review from a team as a code owner November 22, 2022 21:24
@@ -402,7 +404,7 @@ describe('Overhead controller', () => {
})
}

testInRequest(app, tests)
() => testInRequest(app, tests) // TODO: re-enable when fixed with tap
Copy link
Collaborator

Choose a reason for hiding this comment

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

A bare arrow function is a pretty weird way to comment something out. Can you just use a normal comment here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I was trying to avoid changing too many lines and came up with this, but I can comment out all the lines involved instead.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't you just comment out this line?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@Qard
Copy link
Contributor

Qard commented Nov 23, 2022

Lots of notes about things not working with this test runner. Is the plan to fix these before landing? Otherwise we should at least elaborate on why those tests are not working so it's clear what is involved in enabling them again.

Copy link
Member

@simon-id simon-id left a comment

Choose a reason for hiding this comment

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

Are you sure we can't find a way to include the setup script automatically for every file ? using the NODE_ARGS env var with a -r or something ?

Comment on lines +32 to +33
// TODO: make this work regardless of the test runner
it.skip('call does not fail', () => {
Copy link
Member

Choose a reason for hiding this comment

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

cc: @uurien

…-analyzer.spec.js

Co-authored-by: simon-id <simon.id@datadoghq.com>
@simon-id
Copy link
Member

@uurien The CI is failing on windows for IAST tests only, please take a look.

@Qard
Copy link
Contributor

Qard commented Nov 25, 2022

@simon-id I would prefer we not use extra args to do that. I'd like to be able just run a single test directly more easily by just running node path/to/test.js.

@@ -1,5 +1,7 @@
'use strict'

require('../setup')
Copy link
Member

Choose a reason for hiding this comment

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

Should these first two files be require('../setup/tap')?

@rochdev
Copy link
Member Author

rochdev commented Mar 13, 2023

Superseded by #2889

@rochdev rochdev closed this Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants