From 3e519d9eaa79e38156c4ffbedcc84572a7c32a7a Mon Sep 17 00:00:00 2001 From: Rauno Viskus Date: Sat, 12 Jun 2021 11:45:31 +0300 Subject: [PATCH] chore: add node:16 to the test matrix (#510) Co-authored-by: Valentin Marchaud --- .github/workflows/publish.yml | 2 +- .github/workflows/release-pr.yml | 6 ++-- .github/workflows/unit-test.yml | 8 +++-- .../package.json | 2 +- .../test/connect.test.ts | 32 ++++++++++++++----- .../package.json | 2 -- .../package.json | 2 +- 7 files changed, 35 insertions(+), 19 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6353c4b200..68a4a776d9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,7 +3,7 @@ on: pull_request: branches: [main] types: [closed] - + jobs: publish_to_npm: name: Publish to NPM and GitHub diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index 3e29aa3382..6bb8a18a33 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -10,7 +10,7 @@ jobs: create_release_pr: name: Create Release PR and Draft Release runs-on: ubuntu-latest - steps: + steps: - name: Checkout Repository uses: actions/checkout@v2 with: @@ -56,8 +56,8 @@ jobs: branch: release/${{ github.event.inputs.version }} commit-message: 'chore: ${{ github.event.inputs.version }} release proposal' title: 'chore: ${{ github.event.inputs.version }} release proposal' - body: | + body: | This is an auto-generated release PR. If additional changes need to be incorporated before the release, the CHANGELOG must be updated manually. - + Merging this PR will automatically release all packages to NPM. delete-branch: true diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 3eeac25e0e..c60700cfa8 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - container: ["node:8", "node:10", "node:12", "node:14"] + container: ["node:8", "node:10", "node:12", "node:14", "node:16"] runs-on: ubuntu-latest container: image: ${{ matrix.container }} @@ -91,7 +91,9 @@ jobs: key: ${{ runner.os }}-${{ matrix.container }}-${{ hashFiles('**/package.json') }} - name: Install Root Dependencies run: npm install --ignore-scripts - - name: Boostrap Dependencies + - name: Fix npm cache permissions + run: chown -R 1001:121 "/github/home/.npm" + - name: Bootstrap Dependencies run: npx lerna bootstrap --no-ci - name: Unit tests run: npm run test @@ -124,7 +126,7 @@ jobs: key: ${{ runner.os }}-node:12-${{ hashFiles('**/package.json') }} - name: Install Root Dependencies run: npm install --ignore-scripts - - name: Boostrap Dependencies + - name: Bootstrap Dependencies run: npx lerna bootstrap --no-ci - name: Unit tests run: npm run test:browser diff --git a/packages/opentelemetry-id-generator-aws-xray/package.json b/packages/opentelemetry-id-generator-aws-xray/package.json index d74619b27c..6c98259d34 100644 --- a/packages/opentelemetry-id-generator-aws-xray/package.json +++ b/packages/opentelemetry-id-generator-aws-xray/package.json @@ -68,7 +68,7 @@ "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", "karma-spec-reporter": "0.0.32", - "karma-webpack": "5.0.0", + "karma-webpack": "^4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2", diff --git a/plugins/node/opentelemetry-instrumentation-net/test/connect.test.ts b/plugins/node/opentelemetry-instrumentation-net/test/connect.test.ts index 72182b024f..eaacca2174 100644 --- a/plugins/node/opentelemetry-instrumentation-net/test/connect.test.ts +++ b/plugins/node/opentelemetry-instrumentation-net/test/connect.test.ts @@ -175,16 +175,32 @@ describe('NetInstrumentation', () => { }); it('should produce a generic span in case transport type can not be determined', done => { - socket.once(SocketEvent.CLOSE, () => { - const span = getSpan(); + const assertSpan = () => { + try { + const span = getSpan(); + assert.strictEqual( + span.attributes[SemanticAttributes.NET_TRANSPORT], + undefined + ); + assert.strictEqual(span.status.code, SpanStatusCode.ERROR); + done(); + } catch (e) { + done(e); + } + }; + try { + // socket.connect() will not throw before node@16 only closes + socket.once(SocketEvent.CLOSE, assertSpan); + socket.connect(undefined as unknown as string); + } catch (e) { + // socket.connect() will throw in node@16 + socket.removeListener(SocketEvent.CLOSE, assertSpan); assert.strictEqual( - span.attributes[SemanticAttributes.NET_TRANSPORT], - undefined + e.message, + 'The "options" or "port" or "path" argument must be specified' ); - assert.strictEqual(span.status.code, SpanStatusCode.ERROR); - done(); - }); - socket.connect(undefined as unknown as string); + assertSpan(); + } }); }); diff --git a/plugins/node/opentelemetry-instrumentation-router/package.json b/plugins/node/opentelemetry-instrumentation-router/package.json index 7a7b4ca5af..a32e5ac480 100644 --- a/plugins/node/opentelemetry-instrumentation-router/package.json +++ b/plugins/node/opentelemetry-instrumentation-router/package.json @@ -57,8 +57,6 @@ "rimraf": "3.0.2", "router": "1.3.5", "ts-mocha": "8.0.0", - "tslint-consistent-codestyle": "1.16.0", - "tslint-microsoft-contrib": "6.2.0", "typescript": "4.3.2" }, "dependencies": { diff --git a/propagators/opentelemetry-propagator-aws-xray/package.json b/propagators/opentelemetry-propagator-aws-xray/package.json index 7ba734265e..92194b57bf 100644 --- a/propagators/opentelemetry-propagator-aws-xray/package.json +++ b/propagators/opentelemetry-propagator-aws-xray/package.json @@ -61,7 +61,7 @@ "karma-coverage-istanbul-reporter": "3.0.3", "karma-mocha": "2.0.1", "karma-spec-reporter": "0.0.32", - "karma-webpack": "5.0.0", + "karma-webpack": "^4.0.2", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "3.0.2",