Skip to content

Commit 3a28bd9

Browse files
authored
switch to tap for ci/core/tracing/profiling tests (#2889)
1 parent 3965634 commit 3a28bd9

File tree

92 files changed

+1272
-301
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1272
-301
lines changed

.github/workflows/appsec.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: AppSec
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
schedule:
8+
- cron: '0 4 * * *'
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
macos:
16+
runs-on: macos-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
- uses: ./.github/actions/node/setup
20+
- run: yarn install
21+
- run: yarn test:appsec:ci
22+
- uses: codecov/codecov-action@v2
23+
24+
ubuntu:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v2
28+
- uses: ./.github/actions/node/setup
29+
- run: yarn install
30+
- uses: ./.github/actions/node/14
31+
- run: yarn test:appsec:ci
32+
- uses: ./.github/actions/node/16
33+
- run: yarn test:appsec:ci
34+
- uses: ./.github/actions/node/18
35+
- run: yarn test:appsec:ci
36+
- uses: ./.github/actions/node/latest
37+
- run: yarn test:appsec:ci
38+
- uses: codecov/codecov-action@v2
39+
40+
windows:
41+
runs-on: windows-latest
42+
steps:
43+
- uses: actions/checkout@v2
44+
- uses: ./.github/actions/node/setup
45+
- run: yarn install
46+
- run: yarn test:appsec:ci
47+
- uses: codecov/codecov-action@v2
48+
49+
ldapjs:
50+
runs-on: ubuntu-latest
51+
env:
52+
PLUGINS: ldapjs
53+
services:
54+
openldap:
55+
image: bitnami/openldap:latest
56+
ports:
57+
- '1389:1389'
58+
- '1636:1636'
59+
env:
60+
LDAP_ADMIN_USERNAME: 'admin'
61+
LDAP_ADMIN_PASSWORD: 'adminpassword'
62+
LDAP_USERS: 'user01,user02'
63+
LDAP_PASSWORDS: 'password1,password2'
64+
steps:
65+
- uses: actions/checkout@v2
66+
- uses: ./.github/actions/node/setup
67+
- run: yarn install
68+
- uses: ./.github/actions/node/oldest
69+
- run: yarn test:appsec:plugins:ci
70+
- uses: ./.github/actions/node/latest
71+
- run: yarn test:appsec:plugins:ci
72+
- uses: codecov/codecov-action@v2

.github/workflows/plugins.yml

-25
Original file line numberDiff line numberDiff line change
@@ -471,31 +471,6 @@ jobs:
471471
- run: yarn test:plugins:upstream
472472
- uses: codecov/codecov-action@v2
473473

474-
ldapjs:
475-
runs-on: ubuntu-latest
476-
env:
477-
PLUGINS: ldapjs
478-
services:
479-
openldap:
480-
image: bitnami/openldap:latest
481-
ports:
482-
- '1389:1389'
483-
- '1636:1636'
484-
env:
485-
LDAP_ADMIN_USERNAME: 'admin'
486-
LDAP_ADMIN_PASSWORD: 'adminpassword'
487-
LDAP_USERS: 'user01,user02'
488-
LDAP_PASSWORDS: 'password1,password2'
489-
steps:
490-
- uses: actions/checkout@v2
491-
- uses: ./.github/actions/node/setup
492-
- run: yarn install
493-
- uses: ./.github/actions/node/oldest
494-
- run: yarn test:plugins:ci
495-
- uses: ./.github/actions/node/latest
496-
- run: yarn test:plugins:ci
497-
- uses: codecov/codecov-action@v2
498-
499474
limitd-client:
500475
runs-on: ubuntu-latest
501476
services:

.taprc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
check-coverage: false
2+
color: true
3+
coverage: false
4+
node-arg: --expose-gc
5+
reporter: spec

LICENSE-3rdparty.csv

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ dev,int64-buffer,MIT,Copyright 2015-2016 Yusuke Kawasaki
5151
dev,jszip,MIT,Copyright 2015-2016 Stuart Knightley and contributors
5252
dev,mkdirp,MIT,Copyright 2010 James Halliday
5353
dev,mocha,MIT,Copyright 2011-2018 JS Foundation and contributors https://js.foundation
54-
dev,mocha-junit-reporter,MIT,Copyright (c) 2015 Michael Allen
55-
dev,mocha-multi-reporters,MIT,Copyright 2019 Yousaf Nabi and 2015 Stanley Ng
5654
dev,multer,MIT,Copyright 2014 Hage Yaapa
5755
dev,msgpack-lite,MIT,Copyright 2015 Yusuke Kawasaki
5856
dev,nock,MIT,Copyright 2017 Pedro Teixeira and other contributors
@@ -62,6 +60,7 @@ dev,proxyquire,MIT,Copyright 2013 Thorsten Lorenz
6260
dev,rimraf,ISC,Copyright Isaac Z. Schlueter and Contributors
6361
dev,sinon,BSD-3-Clause,Copyright 2010-2017 Christian Johansen
6462
dev,sinon-chai,WTFPL and BSD-2-Clause,Copyright 2004 Sam Hocevar 2012–2017 Domenic Denicola
63+
dev,tap,ISC,Copyright 2011-2022 Isaac Z. Schlueter and Contributors
6564
dev,tape,MIT,Copyright James Halliday
6665
dev,wait-on,MIT,Copyright 2015 Jeff Barczewski
6766
file,aws-lambda-nodejs-runtime-interface-client,Apache 2.0,Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.

mocha-reporter.json

-3
This file was deleted.

package.json

+15-12
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,23 @@
1616
"services": "node ./scripts/install_plugin_modules && node packages/dd-trace/test/setup/services",
1717
"tdd": "node scripts/tdd.js",
1818
"test": "SERVICES=* yarn services && mocha --colors --exit --expose-gc 'packages/dd-trace/test/setup/node.js' 'packages/*/test/**/*.spec.js'",
19-
"test:trace:core": "mocha --colors --exit --expose-gc --file packages/dd-trace/test/setup/core.js --exclude \"packages/dd-trace/test/lambda/**/*.spec.js\" --exclude \"packages/dd-trace/test/profiling/**/*.spec.js\" --exclude \"packages/dd-trace/test/appsec/iast/**/*.plugin.spec.js\" \"packages/dd-trace/test/**/*.spec.js\"",
20-
"test:trace:core:ci": "nyc --no-clean --include \"packages/dd-trace/src/**/*.js\" --exclude \"packages/dd-trace/src/lambda/**/*.spec.js\" --exclude \"packages/dd-trace/src/profiling/**/*.js\" --exclude \"packages/dd-trace/test/appsec/iast/**/*.plugin.spec.js\" -- npm run test:trace:core -- --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter.json",
21-
"test:instrumentations": "mocha --colors --file 'packages/dd-trace/test/setup/core.js' 'packages/datadog-instrumentations/test/**/*.spec.js'",
19+
"test:appsec": "mocha --colors --exit -r \"packages/dd-trace/test/setup/mocha.js\" --exclude \"packages/dd-trace/test/appsec/iast/**/*.plugin.spec.js\" packages/dd-trace/test/appsec/**/*.spec.js",
20+
"test:appsec:ci": "nyc --no-clean --include \"packages/dd-trace/src/appsec/**/*.js\" --exclude \"packages/dd-trace/test/appsec/iast/**/*.plugin.spec.js\" -- npm run test:appsec",
21+
"test:appsec:plugins": "mocha --colors --exit -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/dd-trace/test/appsec/iast/**/*.@($(echo $PLUGINS)).plugin.spec.js\"",
22+
"test:appsec:plugins:ci": "yarn services && nyc --no-clean --include \"packages/dd-trace/test/appsec/iast/**/*.@($(echo $PLUGINS)).plugin.spec.js\" -- npm run test:appsec:plugins",
23+
"test:trace:core": "tap packages/dd-trace/test/*.spec.js packages/dd-trace/test/{ci-visibility,encode,exporters,opentracing,plugins,telemetry}/**/*.spec.js",
24+
"test:trace:core:ci": "npm run test:trace:core -- --coverage --nyc-arg=--include=packages/dd-trace/src/**/*.js",
25+
"test:instrumentations": "mocha --colors -r 'packages/dd-trace/test/setup/mocha.js' 'packages/datadog-instrumentations/test/**/*.spec.js'",
2226
"test:instrumentations:ci": "nyc --no-clean --include 'packages/datadog-instrumentations/src/**/*.js' -- npm run test:instrumentations",
23-
"test:core": "mocha --colors --file packages/datadog-core/test/setup.js 'packages/datadog-core/test/**/*.spec.js'",
24-
"test:core:ci": "nyc --no-clean --include 'packages/datadog-core/src/**/*.js' -- npm run test:core",
25-
"test:lambda": "mocha --colors --exit --file \"packages/dd-trace/test/setup/core.js\" \"packages/dd-trace/test/lambda/**/*.spec.js\"",
27+
"test:core": "tap packages/datadog-core/test/**/*.spec.js",
28+
"test:core:ci": "npm run test:core -- --coverage --nyc-arg=--include=packages/datadog-core/src/**/*.js",
29+
"test:lambda": "mocha --colors --exit -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/dd-trace/test/lambda/**/*.spec.js\"",
2630
"test:lambda:ci": "nyc --no-clean --include \"packages/dd-trace/src/lambda/**/*.js\" -- npm run test:lambda",
27-
"test:plugins": "mocha --colors --exit --file \"packages/dd-trace/test/setup/core.js\" \"packages/datadog-instrumentations/test/@($(echo $PLUGINS)).spec.js\" \"packages/datadog-plugin-@($(echo $PLUGINS))/test/**/*.spec.js\" \"packages/dd-trace/test/appsec/iast/**/*.@($(echo $PLUGINS)).plugin.spec.js\"",
28-
"test:plugins:ci": "yarn services && nyc --no-clean --include \"packages/datadog-instrumentations/src/@($(echo $PLUGINS)).js\" --include \"packages/datadog-instrumentations/src/@($(echo $PLUGINS))/**/*.js\" --include \"packages/datadog-plugin-@($(echo $PLUGINS))/src/**/*.js\" --include \"packages/dd-trace/test/appsec/iast/**/*.@($(echo $PLUGINS)).plugin.spec.js\" -- npm run test:plugins",
31+
"test:plugins": "mocha --colors --exit -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/datadog-instrumentations/test/@($(echo $PLUGINS)).spec.js\" \"packages/datadog-plugin-@($(echo $PLUGINS))/test/**/*.spec.js\"",
32+
"test:plugins:ci": "yarn services && nyc --no-clean --include \"packages/datadog-instrumentations/src/@($(echo $PLUGINS)).js\" --include \"packages/datadog-instrumentations/src/@($(echo $PLUGINS))/**/*.js\" --include \"packages/datadog-plugin-@($(echo $PLUGINS))/src/**/*.js\" -- npm run test:plugins",
2933
"test:plugins:upstream": "node ./packages/dd-trace/test/plugins/suite.js",
30-
"test:profiler": "mocha --colors --exit --file \"packages/dd-trace/test/setup/core.js\" \"packages/dd-trace/test/profiling/**/*.spec.js\"",
31-
"test:profiler:ci": "nyc --no-clean --include \"packages/dd-trace/src/profiling/**/*.js\" -- npm run test:profiler",
34+
"test:profiler": "tap packages/dd-trace/test/profiling/**/*.spec.js",
35+
"test:profiler:ci": "npm run test:profiler -- --coverage --nyc-arg=--include=packages/dd-trace/src/profiling/**/*.js",
3236
"test:integration": "mocha --colors --timeout 30000 \"integration-tests/**/*.spec.js\"",
3337
"test:shimmer": "mocha --colors 'packages/datadog-shimmer/test/**/*.spec.js'",
3438
"test:shimmer:ci": "nyc --no-clean --include 'packages/datadog-shimmer/src/**/*.js' -- npm run test:shimmer",
@@ -114,8 +118,6 @@
114118
"jszip": "^3.5.0",
115119
"mkdirp": "^0.5.1",
116120
"mocha": "8",
117-
"mocha-junit-reporter": "^2.1.0",
118-
"mocha-multi-reporters": "^1.5.1",
119121
"msgpack-lite": "^0.1.26",
120122
"multer": "^1.4.5-lts.1",
121123
"nock": "^11.3.3",
@@ -125,6 +127,7 @@
125127
"rimraf": "^3.0.0",
126128
"sinon": "^11.1.2",
127129
"sinon-chai": "^3.7.0",
130+
"tap": "^16.3.4",
128131
"tape": "^4.9.1",
129132
"wait-on": "^5.0.0"
130133
}

packages/datadog-core/test/setup.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict'
22

3+
require('tap').mochaGlobals()
4+
35
const chai = require('chai')
46
const sinonChai = require('sinon-chai')
57

packages/datadog-core/test/storage/async_hooks.spec.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict'
22

3+
require('../setup')
4+
35
const StorageBackend = require('../../src/storage/async_hooks')
46
const testStorage = require('./test')
57

packages/datadog-core/test/storage/async_resource.spec.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict'
22

3+
require('../setup')
4+
35
const StorageBackend = require('../../src/storage/async_resource')
46
const testStorage = require('./test')
57

packages/datadog-instrumentations/test/helpers/instrument.spec.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict'
22

3+
require('../../../dd-trace/test/setup/tap')
4+
35
const { executionAsyncId } = require('async_hooks')
46
const { expect } = require('chai')
57
const { storage } = require('../../../datadog-core')

packages/dd-trace/src/profiling/exporters/agent.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ class AgentExporter {
103103
const operation = retry.operation({
104104
randomize: true,
105105
minTimeout: this._backoffTime,
106-
retries: this._backoffTries
106+
retries: this._backoffTries,
107+
unref: true
107108
})
108109

109110
operation.attempt((attempt) => {

packages/dd-trace/test/analytics_sampler.spec.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict'
22

3+
require('./setup/tap')
4+
35
const MEASURED = require('../../../ext/tags').MEASURED
46

57
describe('analyticsSampler', () => {

packages/dd-trace/test/ci-visibility/exporters/agent-proxy/agent-proxy.spec.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
'use strict'
2+
3+
require('../../../../../dd-trace/test/setup/tap')
4+
25
const nock = require('nock')
36

47
const AgentProxyCiVisibilityExporter = require('../../../../src/ci-visibility/exporters/agent-proxy')

packages/dd-trace/test/ci-visibility/exporters/agentless/coverage-writer.spec.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict'
22

3+
require('../../../../../dd-trace/test/setup/tap')
4+
35
const proxyquire = require('proxyquire')
46
const { expect } = require('chai')
57

packages/dd-trace/test/ci-visibility/exporters/agentless/exporter.spec.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
'use strict'
2+
3+
require('../../../../../dd-trace/test/setup/tap')
4+
25
const cp = require('child_process')
36

47
const { expect } = require('chai')

packages/dd-trace/test/ci-visibility/exporters/agentless/writer.spec.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict'
22

3+
require('../../../../../dd-trace/test/setup/tap')
4+
35
const proxyquire = require('proxyquire')
46
const { expect } = require('chai')
57

@@ -103,7 +105,6 @@ describe('CI Visibility Writer', () => {
103105
})
104106

105107
describe('when request fails', function () {
106-
this.timeout(100000)
107108
it('should log request errors', done => {
108109
const error = new Error('boom')
109110

packages/dd-trace/test/ci-visibility/exporters/ci-visibility-exporter.spec.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
'use strict'
2+
3+
require('../../../../dd-trace/test/setup/tap')
4+
25
const cp = require('child_process')
36

47
const CiVisibilityExporter = require('../../../src/ci-visibility/exporters/ci-visibility-exporter')

packages/dd-trace/test/ci-visibility/exporters/git/git_metadata.spec.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
'use strict'
2+
3+
require('../../../../../dd-trace/test/setup/tap')
4+
25
const nock = require('nock')
36
const os = require('os')
47
const fs = require('fs')

packages/dd-trace/test/config.spec.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict'
22

3+
require('./setup/tap')
4+
35
const { expect } = require('chai')
46
const path = require('path')
57
describe('Config', () => {

packages/dd-trace/test/dd-trace.spec.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict'
22

3+
require('./setup/tap')
4+
35
const Uint64BE = require('int64-buffer').Uint64BE
46
const agent = require('./plugins/agent')
57

0 commit comments

Comments
 (0)