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

fix: do not initialize distro in unsupported NodeJS versions #172

Merged
merged 52 commits into from
May 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ab4ae24
fix: do not initialize distro on unsupported Node.js versions
Apr 28, 2023
97dbbec
fix: build dependencies
Apr 28, 2023
8295b68
fix: inclusion of supported versions in dedicated json file
Apr 28, 2023
d26c6fe
fix: eval output
Apr 28, 2023
3d9dd21
fix: async load of distro init
Apr 28, 2023
7e570f3
fix: distro installation in component tests
Apr 28, 2023
4ebff7c
fix: distro installation in integration tests
Apr 28, 2023
763b2b5
fix: various fixes
Apr 28, 2023
ac4afea
fix: spurious logs
Apr 30, 2023
a6e42e8
chore: remove multiline test dependency
Apr 28, 2023
3be78e9
fix: deprecation warning for Buffer()
Apr 30, 2023
9be174a
fix: reimplement FileSpanExporter to use async APIs and not to close …
Apr 28, 2023
4c02bb2
fix: http testing issues, streamline distro init
May 2, 2023
e4905be
fix: http component tests
May 3, 2023
fbe11d1
fix: increase delay for http test
May 3, 2023
3c1704a
fix: test setup
May 3, 2023
7ddef22
fix: increase http timeout some more
May 3, 2023
f32bbaf
chore: debug output for HTTP tests
May 3, 2023
4ffbcc5
fix: adjust component test assertions and document flakiness
May 3, 2023
657af60
fix: http component tests
May 3, 2023
625ab3e
fix: lint and increase parallelization in build
May 3, 2023
66a2fa0
fix: delete spurious file
May 3, 2023
c620149
fix: lint job in ci
May 3, 2023
5d5f5bc
chore: improve CI job names
May 3, 2023
0c9a2df
fix: await app start for integration tests
May 3, 2023
1f02a07
fix: simplify mongodb itests setups
May 3, 2023
8acb29c
chore: remove unnecessary markup in mongodb itests
May 3, 2023
3d8a223
fix: further streamline initialization, fix more tests
May 3, 2023
37a6ac3
fix: lint + docus
May 3, 2023
fb71dc1
fix: document support for Node.js 20
May 3, 2023
edf3974
fix: remove spurios lock file
May 3, 2023
acc0102
chore: improve build workflow structure
May 3, 2023
b7ec64e
chore: delete dead code
May 3, 2023
b6266f2
fix: spans lookup in mongodb
May 3, 2023
6260464
fix: more tests cleanup
May 4, 2023
578a48c
fix: remove deleted files
May 4, 2023
fd3d2a1
fix: remove no-longer existing job
May 4, 2023
90632e6
fix: express tests
May 4, 2023
8b554f9
chore: improve build job names
May 4, 2023
0cb9d29
chore: parallelize instrumentation tests
May 4, 2023
007deb0
fix: build?
May 4, 2023
a790589
fix: improve build parallelization
May 4, 2023
79c2391
chore: add debug output to troubleshoot express flakiness
May 4, 2023
19cee95
chore: more debug info for flaky express tests
May 4, 2023
bc42640
fix: remove unnecessary dependency
May 4, 2023
4982cb6
chore: TS-ify express tests
May 4, 2023
e7a7611
fix: adjust express.js instrumentation expectations
May 4, 2023
61301b2
fix: remove unused upstream package
May 4, 2023
749d214
fix: workaround for Express.js tests flakiness
May 4, 2023
1f5d1e6
fix: resilience in readSpanDump for race-condition between FileSpanEx…
May 4, 2023
f49a1ef
fix: workaround for legacy tarball name in integration tests
May 4, 2023
d399cf5
chore: remove code duplication and unnecessary dependency in tests
May 4, 2023
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
90 changes: 83 additions & 7 deletions .github/workflows/push-actions.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,55 @@
name: Tracer Testing
on: [push]
jobs:
version-testing:

build-package:
name: Validation ${{ matrix.npm-task }}
runs-on: ubuntu-latest
continue-on-error: true
strategy:
fail-fast: false # We don't want linting to prevent unit testing
matrix:
node_cimg_tag: [ 14, 16, 18 ]
name: Node ${{ matrix.node_cimg_tag }}
npm-task: ['prettier:ci', 'lint', 'test:unit']
steps:
- uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 16
architecture: x64
- run: sudo apt-get update && sudo apt-get install build-essential libsdl-pango-dev libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev || true # Node.js 18 does not carry pango
- run: npm ci
- run: npm run ${{ matrix.npm-task }}
- name: Upload distro as artifact
uses: actions/upload-artifact@v3
if: ${{ matrix.npm-task == 'test:unit' }}
with:
name: distro-package
path: distro.tgz
retention-days: 5

instrumentations-to-test:
name: List instrumentations to test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: list_instrumentations
run: |
instrumentations_as_json_list=$(ls -1 test/instrumentations | jq --raw-input --slurp 'split("\n") | map(select(. != ""))' | jq -r tostring)
echo "instrumentations=${instrumentations_as_json_list}" >> "${GITHUB_OUTPUT}"
echo "instrumentations=${instrumentations_as_json_list}"
outputs:
instrumentations: ${{ steps.list_instrumentations.outputs.instrumentations }}

supported-node-versions-testing:
name: 'Node ${{ matrix.node_cimg_tag }} ${{ matrix.instrumentations_to_test }} tests'
runs-on: ubuntu-latest
needs: [build-package, instrumentations-to-test]
strategy:
fail-fast: false # We want to see all tests being tried, rather than stop when the first fails
matrix:
node_cimg_tag: [ 14, 16, 18, 20 ]
instrumentations_to_test: ${{ fromJson(needs.instrumentations-to-test.outputs.instrumentations) }}
steps:
- uses: actions/checkout@v3
- name: Set up Node
Expand All @@ -16,7 +59,40 @@ jobs:
architecture: x64
- run: sudo apt-get update && sudo apt-get install build-essential libsdl-pango-dev libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev || true # Node.js 18 does not carry pango
- run: npm ci
- run: npm run build
- run: npm run test:unit
- run: npm run test:component
- run: npm run test:integration:version
- run: npm run test:instrumentations
env:
INSTRUMENTATION_UNDER_TEST: ${{ matrix.instrumentations_to_test }}

unsupported-node-versions-testing:
name: 'Node ${{ matrix.node_cimg_tag }} unsupported'
runs-on: ubuntu-latest
needs: [build-package]
strategy:
matrix:
node_cimg_tag: [ 10, 12 ]
steps:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_cimg_tag }}
architecture: x64
- name: Download distro
uses: actions/download-artifact@v3
with:
name: distro-package
- run: npm i ./distro.tgz
- run: |
output=$(node -e "require('@lumigo/opentelemetry')" 2>&1)

if [[ "${output}" != "@lumigo/opentelemetry: Node.js version '$(node --version)' is not supported"* ]]; then
echo "Unexpected output: ${output}"
exit 1
fi

all-tests:
runs-on: ubuntu-latest
needs:
- supported-node-versions-testing
- unsupported-node-versions-testing
steps:
- run: echo "Hurray!"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,6 @@ dist

test/component/node/package-lock.json
test/component/node/spans-test*.json

# Local VSCode settings
.vscode
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*
!dist/**/**.json
!dist/**/**.js
!dist/**/**.js.map
!dist/**/**.ts
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ In case your execution tags on different spans appear on different invocations t

## Supported runtimes

* Node.js: 14.x, 16.x, 18.x
* Node.js: 14.x, 16.x, 18.x, 20.x

## Supported packages

Expand Down
6 changes: 0 additions & 6 deletions jest.component.config.js

This file was deleted.

17 changes: 0 additions & 17 deletions jest.component.setup.js

This file was deleted.

16 changes: 16 additions & 0 deletions jest.instrumentations.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const allInstrumentations = '**';
const instrumentationToTest = process.env.INSTRUMENTATION_UNDER_TEST || allInstrumentations;

/** @type {import('jest').Config} */
const config = {
testEnvironment: 'node',
testMatch: [`**/instrumentations/${instrumentationToTest}/*.test.ts`],
roots: ['./test'],
setupFilesAfterEnv: ['./jest.instrumentations.setup.js', 'jest-json', 'jest-expect-message'],
reporters: [
'default',
'jest-summarizing-reporter'
]
};

module.exports = config;
4 changes: 2 additions & 2 deletions jest.integration.setup.js → jest.instrumentations.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ afterEach(() => {

beforeAll(() => {
global.console = require('console');
require('console-stamp')(global.console)
require('console-stamp')(global.console);
});

afterAll(() => {
console.info('Starting afterAll...');
const versions = instrumentationsVersionManager.getInstrumantaionsVersions();
const versions = instrumentationsVersionManager.getInstrumantationsVersions();
const versions_keys = Object.keys(versions);
if (versions_keys.length) {
versions_keys.forEach((lib) => {
Expand Down
10 changes: 0 additions & 10 deletions jest.integration.config.js

This file was deleted.

Loading