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

switch to tap for ci/core/tracing/profiling tests #2889

Merged
merged 7 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/appsec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: AppSec

on:
pull_request:
push:
branches: [master]
schedule:
- cron: '0 4 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

jobs:
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/node/setup
- run: yarn install
- run: yarn test:appsec:ci
- uses: codecov/codecov-action@v2

ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/node/setup
- run: yarn install
- uses: ./.github/actions/node/14
- run: yarn test:appsec:ci
- uses: ./.github/actions/node/16
- run: yarn test:appsec:ci
- uses: ./.github/actions/node/18
- run: yarn test:appsec:ci
- uses: ./.github/actions/node/latest
- run: yarn test:appsec:ci
- uses: codecov/codecov-action@v2

windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/node/setup
- run: yarn install
- run: yarn test:appsec:ci
- uses: codecov/codecov-action@v2

ldapjs:
runs-on: ubuntu-latest
env:
PLUGINS: ldapjs
services:
openldap:
image: bitnami/openldap:latest
ports:
- '1389:1389'
- '1636:1636'
env:
LDAP_ADMIN_USERNAME: 'admin'
LDAP_ADMIN_PASSWORD: 'adminpassword'
LDAP_USERS: 'user01,user02'
LDAP_PASSWORDS: 'password1,password2'
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/node/setup
- run: yarn install
- uses: ./.github/actions/node/oldest
- run: yarn test:appsec:plugins:ci
- uses: ./.github/actions/node/latest
- run: yarn test:appsec:plugins:ci
- uses: codecov/codecov-action@v2
25 changes: 0 additions & 25 deletions .github/workflows/plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -471,31 +471,6 @@ jobs:
- run: yarn test:plugins:upstream
- uses: codecov/codecov-action@v2

ldapjs:
runs-on: ubuntu-latest
env:
PLUGINS: ldapjs
services:
openldap:
image: bitnami/openldap:latest
ports:
- '1389:1389'
- '1636:1636'
env:
LDAP_ADMIN_USERNAME: 'admin'
LDAP_ADMIN_PASSWORD: 'adminpassword'
LDAP_USERS: 'user01,user02'
LDAP_PASSWORDS: 'password1,password2'
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/node/setup
- run: yarn install
- uses: ./.github/actions/node/oldest
- run: yarn test:plugins:ci
- uses: ./.github/actions/node/latest
- run: yarn test:plugins:ci
- uses: codecov/codecov-action@v2

limitd-client:
runs-on: ubuntu-latest
services:
Expand Down
5 changes: 5 additions & 0 deletions .taprc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
check-coverage: false
color: true
coverage: false
node-arg: --expose-gc
reporter: spec
3 changes: 1 addition & 2 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ dev,int64-buffer,MIT,Copyright 2015-2016 Yusuke Kawasaki
dev,jszip,MIT,Copyright 2015-2016 Stuart Knightley and contributors
dev,mkdirp,MIT,Copyright 2010 James Halliday
dev,mocha,MIT,Copyright 2011-2018 JS Foundation and contributors https://js.foundation
dev,mocha-junit-reporter,MIT,Copyright (c) 2015 Michael Allen
dev,mocha-multi-reporters,MIT,Copyright 2019 Yousaf Nabi and 2015 Stanley Ng
dev,multer,MIT,Copyright 2014 Hage Yaapa
dev,msgpack-lite,MIT,Copyright 2015 Yusuke Kawasaki
dev,nock,MIT,Copyright 2017 Pedro Teixeira and other contributors
Expand All @@ -62,6 +60,7 @@ dev,proxyquire,MIT,Copyright 2013 Thorsten Lorenz
dev,rimraf,ISC,Copyright Isaac Z. Schlueter and Contributors
dev,sinon,BSD-3-Clause,Copyright 2010-2017 Christian Johansen
dev,sinon-chai,WTFPL and BSD-2-Clause,Copyright 2004 Sam Hocevar 2012–2017 Domenic Denicola
dev,tap,ISC,Copyright 2011-2022 Isaac Z. Schlueter and Contributors
dev,tape,MIT,Copyright James Halliday
dev,wait-on,MIT,Copyright 2015 Jeff Barczewski
file,aws-lambda-nodejs-runtime-interface-client,Apache 2.0,Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Expand Down
3 changes: 0 additions & 3 deletions mocha-reporter.json

This file was deleted.

27 changes: 15 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,23 @@
"services": "node ./scripts/install_plugin_modules && node packages/dd-trace/test/setup/services",
"tdd": "node scripts/tdd.js",
"test": "SERVICES=* yarn services && mocha --colors --exit --expose-gc 'packages/dd-trace/test/setup/node.js' 'packages/*/test/**/*.spec.js'",
"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\"",
"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",
"test:instrumentations": "mocha --colors --file 'packages/dd-trace/test/setup/core.js' 'packages/datadog-instrumentations/test/**/*.spec.js'",
"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",
"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",
"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\"",
"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",
"test:trace:core": "tap packages/dd-trace/test/*.spec.js packages/dd-trace/test/{ci-visibility,encode,exporters,opentracing,plugins,telemetry}/**/*.spec.js",
"test:trace:core:ci": "npm run test:trace:core -- --coverage --nyc-arg=--include=packages/dd-trace/src/**/*.js",
"test:instrumentations": "mocha --colors -r 'packages/dd-trace/test/setup/mocha.js' 'packages/datadog-instrumentations/test/**/*.spec.js'",
"test:instrumentations:ci": "nyc --no-clean --include 'packages/datadog-instrumentations/src/**/*.js' -- npm run test:instrumentations",
"test:core": "mocha --colors --file packages/datadog-core/test/setup.js 'packages/datadog-core/test/**/*.spec.js'",
"test:core:ci": "nyc --no-clean --include 'packages/datadog-core/src/**/*.js' -- npm run test:core",
"test:lambda": "mocha --colors --exit --file \"packages/dd-trace/test/setup/core.js\" \"packages/dd-trace/test/lambda/**/*.spec.js\"",
"test:core": "tap packages/datadog-core/test/**/*.spec.js",
"test:core:ci": "npm run test:core -- --coverage --nyc-arg=--include=packages/datadog-core/src/**/*.js",
"test:lambda": "mocha --colors --exit -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/dd-trace/test/lambda/**/*.spec.js\"",
"test:lambda:ci": "nyc --no-clean --include \"packages/dd-trace/src/lambda/**/*.js\" -- npm run test:lambda",
"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\"",
"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",
"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\"",
"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",
"test:plugins:upstream": "node ./packages/dd-trace/test/plugins/suite.js",
"test:profiler": "mocha --colors --exit --file \"packages/dd-trace/test/setup/core.js\" \"packages/dd-trace/test/profiling/**/*.spec.js\"",
"test:profiler:ci": "nyc --no-clean --include \"packages/dd-trace/src/profiling/**/*.js\" -- npm run test:profiler",
"test:profiler": "tap packages/dd-trace/test/profiling/**/*.spec.js",
"test:profiler:ci": "npm run test:profiler -- --coverage --nyc-arg=--include=packages/dd-trace/src/profiling/**/*.js",
"test:integration": "mocha --colors --timeout 30000 \"integration-tests/**/*.spec.js\"",
"test:shimmer": "mocha --colors 'packages/datadog-shimmer/test/**/*.spec.js'",
"test:shimmer:ci": "nyc --no-clean --include 'packages/datadog-shimmer/src/**/*.js' -- npm run test:shimmer",
Expand Down Expand Up @@ -114,8 +118,6 @@
"jszip": "^3.5.0",
"mkdirp": "^0.5.1",
"mocha": "8",
"mocha-junit-reporter": "^2.1.0",
"mocha-multi-reporters": "^1.5.1",
"msgpack-lite": "^0.1.26",
"multer": "^1.4.5-lts.1",
"nock": "^11.3.3",
Expand All @@ -125,6 +127,7 @@
"rimraf": "^3.0.0",
"sinon": "^11.1.2",
"sinon-chai": "^3.7.0",
"tap": "^16.3.4",
"tape": "^4.9.1",
"wait-on": "^5.0.0"
}
Expand Down
2 changes: 2 additions & 0 deletions packages/datadog-core/test/setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

require('tap').mochaGlobals()

const chai = require('chai')
const sinonChai = require('sinon-chai')

Expand Down
2 changes: 2 additions & 0 deletions packages/datadog-core/test/storage/async_hooks.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

require('../setup')

const StorageBackend = require('../../src/storage/async_hooks')
const testStorage = require('./test')

Expand Down
2 changes: 2 additions & 0 deletions packages/datadog-core/test/storage/async_resource.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

require('../setup')

const StorageBackend = require('../../src/storage/async_resource')
const testStorage = require('./test')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

require('../../../dd-trace/test/setup/tap')

const { executionAsyncId } = require('async_hooks')
const { expect } = require('chai')
const { storage } = require('../../../datadog-core')
Expand Down
3 changes: 2 additions & 1 deletion packages/dd-trace/src/profiling/exporters/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ class AgentExporter {
const operation = retry.operation({
randomize: true,
minTimeout: this._backoffTime,
retries: this._backoffTries
retries: this._backoffTries,
unref: true
})

operation.attempt((attempt) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/dd-trace/test/analytics_sampler.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

require('./setup/tap')

const MEASURED = require('../../../ext/tags').MEASURED

describe('analyticsSampler', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
'use strict'

require('../../../../../dd-trace/test/setup/tap')

const nock = require('nock')

const AgentProxyCiVisibilityExporter = require('../../../../src/ci-visibility/exporters/agent-proxy')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

require('../../../../../dd-trace/test/setup/tap')

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
'use strict'

require('../../../../../dd-trace/test/setup/tap')

const cp = require('child_process')

const { expect } = require('chai')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

require('../../../../../dd-trace/test/setup/tap')

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

Expand Down Expand Up @@ -103,7 +105,6 @@ describe('CI Visibility Writer', () => {
})

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
'use strict'

require('../../../../dd-trace/test/setup/tap')

const cp = require('child_process')

const CiVisibilityExporter = require('../../../src/ci-visibility/exporters/ci-visibility-exporter')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
'use strict'

require('../../../../../dd-trace/test/setup/tap')

const nock = require('nock')
const os = require('os')
const fs = require('fs')
Expand Down
2 changes: 2 additions & 0 deletions packages/dd-trace/test/config.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

require('./setup/tap')

const { expect } = require('chai')
const path = require('path')
describe('Config', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/dd-trace/test/dd-trace.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

require('./setup/tap')

const Uint64BE = require('int64-buffer').Uint64BE
const agent = require('./plugins/agent')

Expand Down
Loading