Skip to content

Commit

Permalink
feat: re-enable TAV (open-telemetry#823)
Browse files Browse the repository at this point in the history
Co-authored-by: Valentin Marchaud <contact@vmarchaud.fr>
  • Loading branch information
rauno56 and vmarchaud authored Jan 20, 2022
1 parent 8ab7ddc commit 2e14f46
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 34 deletions.
4 changes: 4 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ Before creating a pull request, please make sure:
## Short description of the changes

-

## Checklist

- [ ] Ran `npm run test-all-versions` for the edited package(s) on the latest commit if applicable.
106 changes: 82 additions & 24 deletions .github/workflows/test-all-versions.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
name: Test-all-versions
name: Test All Versions
on:
pull_request:
branches: [main]
push:
branches:
- "main"
- "release/**"
- "release-please/**"
schedule:
- cron: "30 4 * * *"
workflow_dispatch:

jobs:
tav:
# skip the workflow for now #816
if: false
name: run test-all-version (tav)
name: Run test-all-versions
strategy:
fail-fast: false
matrix:
node: ["8", "10", "12", "14", "16"]
include:
- node: "8"
lerna-extra-args: >-
--ignore @opentelemetry/instrumentation-aws-sdk
--ignore @opentelemetry/instrumentation-pino
--ignore @opentelemetry/instrumentation-tedious
- node: "10"
lerna-extra-args: >-
--ignore @opentelemetry/instrumentation-pino
runs-on: ubuntu-latest
services:
memcached:
Expand All @@ -18,6 +35,19 @@ jobs:
image: mongo
ports:
- 27017:27017
mssql:
image: mcr.microsoft.com/mssql/server:2017-latest
env:
SA_PASSWORD: mssql_passw0rd
ACCEPT_EULA: Y
ports:
- 1433:1433
options: >-
--health-cmd "/opt/mssql-tools/bin/sqlcmd -U sa -P $SA_PASSWORD -Q 'select 1' -b -o /dev/null"
--health-interval 1s
--health-timeout 30s
--health-start-period 10s
--health-retries 20
mysql:
image: circleci/mysql:5.7
env:
Expand Down Expand Up @@ -62,33 +92,61 @@ jobs:
RUN_MEMCACHED_TESTS: 1
RUN_MONGODB_TESTS: 1
RUN_MYSQL_TESTS: 1
RUN_MSSQL_TESTS: 1
RUN_POSTGRES_TESTS: 1
RUN_REDIS_TESTS: 1
OPENTELEMETRY_MEMCACHED_HOST: memcached
OPENTELEMETRY_MEMCACHED_PORT: 11211
POSTGRES_USER: postgres
POSTGRES_DB: circle_database
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
OPENTELEMETRY_REDIS_HOST: redis
OPENTELEMETRY_REDIS_PORT: 6379
CASSANDRA_HOST: localhost
MONGODB_DB: opentelemetry-tests
MONGODB_HOST: 127.0.0.1
MONGODB_PORT: 27017
MYSQL_USER: otel
MYSQL_PASSWORD: secret
MSSQL_PASSWORD: mssql_passw0rd
MYSQL_DATABASE: circle_database
MYSQL_HOST: mysql
MYSQL_HOST: localhost
MYSQL_PASSWORD: secret
MYSQL_PORT: 3306
MYSQL_USER: otel
OPENTELEMETRY_MEMCACHED_HOST: localhost
OPENTELEMETRY_MEMCACHED_PORT: 11211
OPENTELEMETRY_REDIS_HOST: localhost
OPENTELEMETRY_REDIS_PORT: 6379
POSTGRES_DB: circle_database
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
NPM_CONFIG_UNSAFE_PERM: true
CASSANDRA_HOST: cassandra
CASSANDRA_PORT: 9042
steps:
- name: checkout
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- run: npm install --ignore-scripts
- run: lerna bootstrap --since origin/main --include-dependencies
- run: lerna run compile --since origin/main --include-dependencies
- run: lerna run test-all-versions --since origin/main --stream --concurrency=1
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Cache Dependencies
uses: actions/cache@v2
with:
path: |
node_modules
package-lock.json
detectors/node/*/node_modules
detectors/node/*/package-lock.json
metapackages/*/node_modules
metapackages/*/package-lock.json
packages/*/node_modules
packages/*/package-lock.json
plugins/node/*/node_modules
plugins/node/*/package-lock.json
plugins/web/*/node_modules
plugins/web/*/package-lock.json
propagators/*/node_modules
propagators/*/package-lock.json
key: ${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('package.json', 'detectors/node/*/package.json', 'metapackages/*/package.json', 'packages/*/package.json', 'plugins/node/*/package.json', 'plugins/web/*/package.json', 'propagators/*/package.json') }}
- name: Legacy Peer Dependencies for npm 7
if: matrix.node == '16'
run: npm config set legacy-peer-deps=true
- name: Install Root Dependencies
run: npm install --ignore-scripts
- name: Bootstrap Dependencies
run: lerna bootstrap --no-ci --hoist --nohoist='zone.js' --nohoist='mocha' --nohoist='ts-mocha'
- name: Run test-all-versions
run: lerna run test-all-versions ${{ matrix.lerna-extra-args }} --stream --concurrency 1
3 changes: 2 additions & 1 deletion .nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
"**/*.d.ts",
"build/**/**/*.js",
"src/index.ts",
"src/version.ts",
"karma.conf.js",
"src/platform/browser/*.ts",
"test/index-webpack.ts",
"test/*.ts",
"webpack/*.js",
".eslintrc.js"
],
Expand Down
4 changes: 3 additions & 1 deletion packages/opentelemetry-test-utils/src/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ export interface TimedEvent {
}

export const getPackageVersion = (packageName: string) => {
const packagePath = require.resolve(packageName);
const packagePath = require?.resolve(packageName, {
paths: require?.main?.paths,
});
const packageJsonPath = path.join(path.dirname(packagePath), 'package.json');
return require(packageJsonPath).version;
};
2 changes: 1 addition & 1 deletion plugins/node/instrumentation-tedious/.tav.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
tedious:
# 4.0.0 is broken: https://github.com/tediousjs/tedious/commit/4eceb48
versions: ">=1.11.0 <4 || >=4.0.1"
versions: "1.11.0 || 1.14.0 || 2.7.1 || 3.0.1 || 4.2.0 || ^6.7.0 || 8.3.0 || 9.2.3 || 11.0.9 || 11.2.0 || 11.4.0 || ^11.8.0 || ^12.3.0 || ^13.2.0 || ^14.0.0"
commands: npm run test

# Fix missing `test-utils` package
Expand Down
5 changes: 3 additions & 2 deletions plugins/node/instrumentation-tedious/test/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ export const makeApi = (tedious: tedious) => {

const bulkLoad = {
tableName: '[dbo].[test_bulk]',
tableNameShort: 'test_bulk',
createTable: (connection: Connection): Promise<boolean> => {
return new Promise((resolve, reject) => {
const sql = `
Expand All @@ -276,9 +277,9 @@ export const makeApi = (tedious: tedious) => {
// <2.2.0 didn't take bulkOptions
const request =
connection.newBulkLoad.length === 2
? connection.newBulkLoad(bulkLoad.tableName, requestDoneCb)
? connection.newBulkLoad(bulkLoad.tableNameShort, requestDoneCb)
: (connection.newBulkLoad as any)(
bulkLoad.tableName,
bulkLoad.tableNameShort,
{ keepNulls: true },
requestDoneCb
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ describe('tedious', () => {
procCount: 0,
});
assertSpan(spans[2], {
name: 'execBulkLoad [dbo].[test_bulk] master',
name: 'execBulkLoad test_bulk master',
procCount: 0,
table: '[dbo].[test_bulk]',
table: 'test_bulk',
});
});
});
Expand Down
3 changes: 3 additions & 0 deletions plugins/node/opentelemetry-instrumentation-mongodb/.tav.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
mongodb:
versions: ">=3.3 <4"
commands: npm run test

# Fix missing `contrib-test-utils` package
pretest: npm run --prefix ../../../ lerna:link
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"repository": "open-telemetry/opentelemetry-js-contrib",
"scripts": {
"docker:start": "docker run -e MONGODB_DB=opentelemetry-tests -e MONGODB_PORT=27017 -e MONGODB_HOST=localhost -p 27017:27017 --rm mongo",
"test": "nyc ts-mocha --parallel -p tsconfig.json --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'",
"test": "nyc ts-mocha -p tsconfig.json --require '@opentelemetry/contrib-test-utils' 'test/**/*.test.ts'",
"test-all-versions": "tav",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"tdd": "npm run test -- --watch-extensions ts --watch",
Expand Down
2 changes: 1 addition & 1 deletion plugins/node/opentelemetry-instrumentation-mysql2/.tav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ mysql2:
commands: npm run test

# Fix missing `test-utils` package
pretest: npm run --prefix ../../../ lerna:link
pretest: npm run --prefix ../../../ lerna:link
2 changes: 2 additions & 0 deletions plugins/node/opentelemetry-instrumentation-pg/.tav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ pg:
# a sample from supported versions
- versions: "8.5.1 || 8.6.0 || 8.7.1"
peerDependencies: pg-pool@^3
pretest: npm run --prefix ../../../ lerna:link
commands: npm run test
- versions: "7.3.0 || 7.12.1 || 7.18.2"
peerDependencies: pg-pool@^2
pretest: npm run --prefix ../../../ lerna:link
commands: npm run test
2 changes: 1 addition & 1 deletion plugins/node/opentelemetry-instrumentation-redis/.tav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ redis:
commands: npm run test

# Fix missing `contrib-test-utils` package
pretest: npm run --prefix ../../../ lerna:link
pretest: npm run --prefix ../../../ lerna:link

0 comments on commit 2e14f46

Please sign in to comment.