From a267436fc6a9b135fa84d1bf5c4cb0af3fce3930 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 29 Mar 2023 11:37:13 +0200 Subject: [PATCH 01/13] action: run on windows --- .ci/Jenkinsfile | 132 +---------------------------- .github/workflows/test-windows.yml | 124 +++++++++++++++++++++++++++ .github/workflows/test.yml | 8 -- 3 files changed, 125 insertions(+), 139 deletions(-) create mode 100644 .github/workflows/test-windows.yml diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 636729fdf1..c742cdc6af 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -29,12 +29,10 @@ pipeline { quietPeriod(10) } triggers { - issueCommentTrigger("(${obltGitHubComments()}|^run (module|benchmark) tests.*)") + issueCommentTrigger("(${obltGitHubComments()}|^run benchmark tests.*)") } parameters { - booleanParam(name: 'Run_As_Main_Branch', defaultValue: false, description: 'Allow to run any steps on a PR, some steps normally only run on main branch.') booleanParam(name: 'bench_ci', defaultValue: true, description: 'Enable benchmarks.') - booleanParam(name: 'tests_ci', defaultValue: true, description: 'Enable tests.') } stages { /** @@ -48,47 +46,8 @@ pipeline { gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true, shallow: false, reference: "/var/lib/jenkins/.git-references/${REPO}.git") stash allowEmpty: true, name: 'source', useDefaultExcludes: false - script { - dir("${BASE_DIR}"){ - - // Skip all the stages except docs for PR's with asciidoc or md changes only - env.ONLY_DOCS = isGitRegionMatch(patterns: [ '.*\\.(asciidoc|md)' ], shouldMatchAll: true) - } - } } } - /** - Run tests. - */ - stage('Test') { - options { skipDefaultCheckout() } - environment { - HOME = "${env.WORKSPACE}" - } - when { - beforeAgent true - allOf { - not { tag pattern: 'v\\d+\\.\\d+\\.\\d+', comparator: 'REGEXP' } - expression { return env.ONLY_DOCS == "false" } - expression { return params.tests_ci } - } - } - steps { - withGithubNotify(context: 'Test', tab: 'tests') { - deleteDir() - unstash 'source' - dir("${BASE_DIR}"){ - script { - def parallelTasks = [:] - // Only 14 for the time being - parallelTasks["Windows-Node.js-14"] = generateStepForWindows(version: '14') - parallel(parallelTasks) - } - } - } - } - } - stage('Release') { options { skipDefaultCheckout() } when { @@ -197,7 +156,6 @@ pipeline { allOf { anyOf { branch 'main' - expression { return params.Run_As_Main_Branch } expression { return env.GITHUB_COMMENT?.contains('benchmark tests') } } expression { return params.bench_ci } @@ -234,94 +192,6 @@ pipeline { } } -def generateStep(Map params = [:]){ - def version = params?.version - def buildType = params.containsKey('buildType') ? params.buildType : 'release' - def contextManager = params.get('disableAsyncHooks', false) ? 'patch' : '' - return { - withNode(labels: 'linux && immutable', forceWorkspace: true, forceWorker: true) { - withEnv(["VERSION=${version}", "ELASTIC_APM_CONTEXT_MANAGER=${contextManager}"]) { - deleteDir() - unstash 'source' - // Grab the current docker context for helping to troubleshoot the docker containers using filebeat and metricbeat - dockerContext(filebeatOutput: "docker-${version}-${buildType}.log", metricbeatOutput: "docker-${version}-${buildType}-metricbeat.log", archiveOnlyOnFail: true){ - dir("${BASE_DIR}"){ - try { - retryWithSleep(retries: 2, seconds: 5, backoff: true) { - sh(label: "Run Tests", script: """.ci/scripts/test.sh -b "${buildType}" "${version}" """) - } - } finally { - junit(testResults: "test_output/*.junit.xml", allowEmptyResults: true, keepLongStdio: true) - archiveArtifacts(artifacts: "test_output/*.tap", allowEmptyArchive: true) - } - } - } - } - } - } -} - -def generateStepForWindows(Map params = [:]){ - def version = params?.version - def contextManager = params.get('disableAsyncHooks', false) ? 'patch' : '' - return { - sh label: 'Prepare services', script: ".ci/scripts/windows/prepare-test.sh ${version}" - def linuxIp = grabWorkerIP() - withNode(labels: 'windows-2019-docker-immutable', forceWorkspace: true, forceWorker: true) { - // When installing with choco the PATH might not be updated within the already connected worker. - withEnv(["PATH=${PATH};C:\\Program Files\\nodejs", - "VERSION=${version}", - "ELASTIC_APM_CONTEXT_MANAGER=${contextManager}", - "CASSANDRA_HOST=${linuxIp}", - "ES_HOST=${linuxIp}", - "LOCALSTACK_HOST=${linuxIp}", - "MEMCACHED_HOST=${linuxIp}", - "MONGODB_HOST=${linuxIp}", - "MSSQL_HOST=${linuxIp}", - "MYSQL_HOST=${linuxIp}", - "PGHOST=${linuxIp}", - "REDIS_HOST=${linuxIp}"]) { - try { - deleteDir() - unstash 'source' - dir(BASE_DIR) { - bat label: 'Ping linux worker', script: "ping -n 3 ${linuxIp}" - installTools([ [tool: 'nodejs-lts', version: "${version}" ] ]) - bat label: 'Tool versions', script: ''' - npm --version - node --version - ''' - retryWithSleep(retries: 2, sideEffect: { bat 'npm cache clean --force' }) { - bat 'npm install' - } - bat 'node test/test.js' - } - } catch(e){ - error(e.toString()) - } finally { - echo 'JUnit archiving no yet in place' - } - } - } - - // If the above execution failed, then it will not reach this section. TBD - sh label: 'Stop services', script: ".ci/scripts/windows/stop-test.sh ${version}" - } -} - - -def grabWorkerIP(){ - def linuxIp = '' - retryWithSleep(retries: 3, seconds: 5, backoff: true){ - linuxIp = sh(label: 'Get IP', script: '''hostname -I | awk '{print $1}' ''', returnStdout: true)?.trim() - log(level: 'INFO', text: "Worker IP '${linuxIp}'") - if(!linuxIp?.trim()){ - error('Unable to get the Linux worker IP') - } - } - return linuxIp -} - /** * Transform TAG releases from v{major}.{minor}.{patch} to * ver-{major}-{minor}-{patch}. e.g: given v1.2.3 then diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml new file mode 100644 index 0000000000..af0c2babed --- /dev/null +++ b/.github/workflows/test-windows.yml @@ -0,0 +1,124 @@ +# Run a significant subset of tests on GitHub Actions on windows +name: Test-Windows + +# https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662/2 +on: + push: + branches: + - main + paths-ignore: + - '**/*.md' + - '**/*.asciidoc' + - 'docs/**' + - 'examples/**' + pull_request: + branches: + - main + paths-ignore: + - '**/*.md' + - '**/*.asciidoc' + - 'docs/**' + - 'examples/**' + +## Concurrency only allowed in the main branch. +## So old builds running for old commits within the same Pull Request are cancelled +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + test-windows: + + # These services and their configuration should match test/docker-compose.yml. + services: + + redis: + image: redis + ports: + - 6379:6379 + + memcached: + image: memcached:alpine + ports: + - 11211:11211 + + cassandra: + image: cassandra + ports: + - 9042:9042 + env: + MAX_HEAP_SIZE: '1G' + HEAP_NEWSIZE: '400m' + volumes: + - nodecassandradata:/var/lib/cassandra + + postgres: + image: postgres:9.6 + ports: + - 5432:5432 + volumes: + - nodepgdata:/var/lib/postgresql/data + env: + POSTGRES_USER: 'postgres' + POSTGRES_DB: 'test_elastic_apm' + POSTGRES_HOST_AUTH_METHOD: 'trust' + + mongodb: + image: mongo:5 + ports: + - 27017:27017 + volumes: + - nodemongodata:/data/db + + mysql: + image: mysql:5.7 + ports: + - 3306:3306 + volumes: + - nodemysqldata:/var/lib/mysql + env: + MYSQL_ALLOW_EMPTY_PASSWORD: 1 + + mssql: + image: mcr.microsoft.com/mssql/server + env: + ACCEPT_EULA: 'Y' + SA_PASSWORD: 'Very(!)Secure' + MSSQL_PID: 'Developer' + ports: + - 1433:1433 + volumes: + - nodemssqldata:/var/opt/mssql + + elasticsearch: + image: docker.elastic.co/elasticsearch/elasticsearch:8.2.1 + env: + ES_JAVA_OPTS: '-Xms512m -Xmx512m' + network.host: '' + transport.host: '127.0.0.1' + http.host: '0.0.0.0' + xpack.security.enabled: 'false' + ports: + - 9200:9200 + volumes: + - nodeesdata:/usr/share/elasticsearch/data + + localstack: + image: localstack/localstack:0.12.12 + env: + LOCALSTACK_SERVICES: 's3' + DATA_DIR: '/var/lib/localstack' + ports: + - "4566:4566" + volumes: + - nodelocalstackdata:/var/lib/localstack + + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 14 + - run: npm install + - run: npm ls --all || true + - run: npm test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 24a7540bbe..63a0e2d3b7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,12 +1,4 @@ # Run a significant subset of tests on GitHub Actions. -# -# Examples of things *not* being run here currently that are run by -# the Jenkins-based tests: -# - a test run on windows -# - the "TAV" tests that run against all supported versions of instrumented -# modules -# - the integration tests that run with an apm-server -# - code coverage (npm run coverage) name: Test From 0908508cde4fc965f59c94a62e5b5ec72893e002 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 29 Mar 2023 11:38:12 +0200 Subject: [PATCH 02/13] chore: for testing purposes --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 63a0e2d3b7..e477a2ee94 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,6 +15,7 @@ on: pull_request: branches: - main + - feature/run-on-windows paths-ignore: - '**/*.md' - '**/*.asciidoc' From 3dc616942b755fa660ecacef59f95bd39c26af2c Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 29 Mar 2023 11:39:19 +0200 Subject: [PATCH 03/13] chore: for testing purposes --- .github/workflows/test-windows.yml | 1 + .github/workflows/test.yml | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index af0c2babed..45a5fe8f8d 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -14,6 +14,7 @@ on: pull_request: branches: - main + - feature/run-on-windows paths-ignore: - '**/*.md' - '**/*.asciidoc' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e477a2ee94..63a0e2d3b7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,6 @@ on: pull_request: branches: - main - - feature/run-on-windows paths-ignore: - '**/*.md' - '**/*.asciidoc' From 0dfefedbd8c28664b0b8f5cac72016df1bd1547e Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 30 Mar 2023 09:45:07 +0200 Subject: [PATCH 04/13] action: use the same github workflow --- .github/workflows/test-windows.yml | 125 ----------------------------- .github/workflows/test.yml | 11 +++ 2 files changed, 11 insertions(+), 125 deletions(-) delete mode 100644 .github/workflows/test-windows.yml diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml deleted file mode 100644 index 45a5fe8f8d..0000000000 --- a/.github/workflows/test-windows.yml +++ /dev/null @@ -1,125 +0,0 @@ -# Run a significant subset of tests on GitHub Actions on windows -name: Test-Windows - -# https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662/2 -on: - push: - branches: - - main - paths-ignore: - - '**/*.md' - - '**/*.asciidoc' - - 'docs/**' - - 'examples/**' - pull_request: - branches: - - main - - feature/run-on-windows - paths-ignore: - - '**/*.md' - - '**/*.asciidoc' - - 'docs/**' - - 'examples/**' - -## Concurrency only allowed in the main branch. -## So old builds running for old commits within the same Pull Request are cancelled -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} - -jobs: - test-windows: - - # These services and their configuration should match test/docker-compose.yml. - services: - - redis: - image: redis - ports: - - 6379:6379 - - memcached: - image: memcached:alpine - ports: - - 11211:11211 - - cassandra: - image: cassandra - ports: - - 9042:9042 - env: - MAX_HEAP_SIZE: '1G' - HEAP_NEWSIZE: '400m' - volumes: - - nodecassandradata:/var/lib/cassandra - - postgres: - image: postgres:9.6 - ports: - - 5432:5432 - volumes: - - nodepgdata:/var/lib/postgresql/data - env: - POSTGRES_USER: 'postgres' - POSTGRES_DB: 'test_elastic_apm' - POSTGRES_HOST_AUTH_METHOD: 'trust' - - mongodb: - image: mongo:5 - ports: - - 27017:27017 - volumes: - - nodemongodata:/data/db - - mysql: - image: mysql:5.7 - ports: - - 3306:3306 - volumes: - - nodemysqldata:/var/lib/mysql - env: - MYSQL_ALLOW_EMPTY_PASSWORD: 1 - - mssql: - image: mcr.microsoft.com/mssql/server - env: - ACCEPT_EULA: 'Y' - SA_PASSWORD: 'Very(!)Secure' - MSSQL_PID: 'Developer' - ports: - - 1433:1433 - volumes: - - nodemssqldata:/var/opt/mssql - - elasticsearch: - image: docker.elastic.co/elasticsearch/elasticsearch:8.2.1 - env: - ES_JAVA_OPTS: '-Xms512m -Xmx512m' - network.host: '' - transport.host: '127.0.0.1' - http.host: '0.0.0.0' - xpack.security.enabled: 'false' - ports: - - 9200:9200 - volumes: - - nodeesdata:/usr/share/elasticsearch/data - - localstack: - image: localstack/localstack:0.12.12 - env: - LOCALSTACK_SERVICES: 's3' - DATA_DIR: '/var/lib/localstack' - ports: - - "4566:4566" - volumes: - - nodelocalstackdata:/var/lib/localstack - - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 14 - - run: npm install - - run: npm ls --all || true - - run: npm test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 63a0e2d3b7..a73fdd7129 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -153,3 +153,14 @@ jobs: path: "test_output/*.junit.xml" type: "junit" githubToken: ${{ secrets.GITHUB_TOKEN }} + + test-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 14 + - run: npm install + - run: npm ls --all || true + - run: npm test From 1b54c5fbcfedf2023c3d88aab5877f4532aae272 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 30 Mar 2023 10:01:15 +0200 Subject: [PATCH 05/13] exclude running test on GH windows runners those tests are the ones defined in the list of modules in .github/workflows/tav.yml --- .../modules/@elastic/elasticsearch-canary.test.js | 5 +++++ test/instrumentation/modules/@elastic/elasticsearch.test.js | 5 +++++ test/instrumentation/modules/apollo-server-express.test.js | 5 +++++ test/instrumentation/modules/aws-sdk/aws4-retries.test.js | 5 +++++ test/instrumentation/modules/aws-sdk/dynamodb.test.js | 5 +++++ test/instrumentation/modules/aws-sdk/s3.test.js | 5 +++++ test/instrumentation/modules/aws-sdk/sns.test.js | 5 +++++ test/instrumentation/modules/aws-sdk/sqs.test.js | 6 ++++++ test/instrumentation/modules/bluebird/bluebird.test.js | 5 +++++ test/instrumentation/modules/bluebird/cancel.test.js | 5 +++++ test/instrumentation/modules/cassandra-driver/index.test.js | 5 +++++ test/instrumentation/modules/elasticsearch.test.js | 5 +++++ test/instrumentation/modules/express-graphql.test.js | 5 +++++ test/instrumentation/modules/express-queue.test.js | 5 +++++ test/instrumentation/modules/express/basic.test.js | 5 +++++ .../modules/express/capture-exceptions-off.test.js | 5 +++++ .../modules/express/capture-exceptions-on.test.js | 5 +++++ test/instrumentation/modules/express/set-framework.test.js | 5 +++++ test/instrumentation/modules/fastify/async-await.test.js | 5 +++++ test/instrumentation/modules/fastify/fastify.test.js | 5 +++++ test/instrumentation/modules/fastify/set-framework.test.js | 5 +++++ test/instrumentation/modules/finalhandler.test.js | 5 +++++ test/instrumentation/modules/generic-pool.test.js | 5 +++++ test/instrumentation/modules/graphql.test.js | 5 +++++ test/instrumentation/modules/handlebars.test.js | 5 +++++ test/instrumentation/modules/ioredis.test.js | 5 +++++ test/instrumentation/modules/koa-router/new-name.test.js | 5 +++++ test/instrumentation/modules/koa-router/old-name.test.js | 5 +++++ test/instrumentation/modules/mimic-response.test.js | 5 +++++ test/instrumentation/modules/mongodb-core.test.js | 5 +++++ test/instrumentation/modules/mongodb.test.js | 5 +++++ test/instrumentation/modules/mysql/mysql.test.js | 5 +++++ test/instrumentation/modules/mysql/pool-release-1.test.js | 5 +++++ test/instrumentation/modules/mysql2/mysql.test.js | 5 +++++ test/instrumentation/modules/mysql2/pool-release-1.test.js | 5 +++++ test/instrumentation/modules/next/next.test.js | 5 +++++ .../modules/pg/knex-no-span-stack-traces.test.js | 5 +++++ test/instrumentation/modules/pg/knex.test.js | 5 +++++ test/instrumentation/modules/pg/pg.test.js | 5 +++++ test/instrumentation/modules/pug.test.js | 5 +++++ test/instrumentation/modules/redis-2-3.test.js | 5 +++++ test/instrumentation/modules/redis.test.js | 5 +++++ test/instrumentation/modules/redis4-legacy.test.js | 5 +++++ test/instrumentation/modules/restify/basic.test.js | 5 +++++ test/instrumentation/modules/restify/set-framework.test.js | 5 +++++ test/instrumentation/modules/tedious.test.js | 5 +++++ test/instrumentation/modules/undici/fetch.test.js | 5 +++++ test/instrumentation/modules/undici/undici.test.js | 5 +++++ test/instrumentation/modules/ws.test.js | 5 +++++ 49 files changed, 246 insertions(+) diff --git a/test/instrumentation/modules/@elastic/elasticsearch-canary.test.js b/test/instrumentation/modules/@elastic/elasticsearch-canary.test.js index ad1bb4119b..6eca93bc95 100644 --- a/test/instrumentation/modules/@elastic/elasticsearch-canary.test.js +++ b/test/instrumentation/modules/@elastic/elasticsearch-canary.test.js @@ -6,5 +6,10 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + process.env.ELASTIC_APM_TEST_ESCLIENT_PACKAGE_NAME = '@elastic/elasticsearch-canary' require('./elasticsearch.test.js') diff --git a/test/instrumentation/modules/@elastic/elasticsearch.test.js b/test/instrumentation/modules/@elastic/elasticsearch.test.js index 2a2576f519..8fe9d345ec 100644 --- a/test/instrumentation/modules/@elastic/elasticsearch.test.js +++ b/test/instrumentation/modules/@elastic/elasticsearch.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + process.env.ELASTIC_APM_TEST = true const agent = require('../../../..').start({ serviceName: 'test-elasticsearch', diff --git a/test/instrumentation/modules/apollo-server-express.test.js b/test/instrumentation/modules/apollo-server-express.test.js index 58bca92d45..a12d57f99d 100644 --- a/test/instrumentation/modules/apollo-server-express.test.js +++ b/test/instrumentation/modules/apollo-server-express.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../..').start({ serviceName: 'test', secretToken: 'test', diff --git a/test/instrumentation/modules/aws-sdk/aws4-retries.test.js b/test/instrumentation/modules/aws-sdk/aws4-retries.test.js index 907f0eadec..7b2b390544 100644 --- a/test/instrumentation/modules/aws-sdk/aws4-retries.test.js +++ b/test/instrumentation/modules/aws-sdk/aws4-retries.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + // Test the fix for bug #2134, that AWS4 signature auth with the aws-sdk // and *retries* works as expected. diff --git a/test/instrumentation/modules/aws-sdk/dynamodb.test.js b/test/instrumentation/modules/aws-sdk/dynamodb.test.js index a27a0634bb..bc1f623b3c 100644 --- a/test/instrumentation/modules/aws-sdk/dynamodb.test.js +++ b/test/instrumentation/modules/aws-sdk/dynamodb.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + const agent = require('../../../..').start({ serviceName: 'test-dynamodb', captureExceptions: false, diff --git a/test/instrumentation/modules/aws-sdk/s3.test.js b/test/instrumentation/modules/aws-sdk/s3.test.js index 3c61f812b6..4a817b6e3c 100644 --- a/test/instrumentation/modules/aws-sdk/s3.test.js +++ b/test/instrumentation/modules/aws-sdk/s3.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + // Test S3 instrumentation of the 'aws-sdk' module. // // Note that this uses localstack for testing, which mimicks the S3 API but diff --git a/test/instrumentation/modules/aws-sdk/sns.test.js b/test/instrumentation/modules/aws-sdk/sns.test.js index 3826ab24eb..a2e2a09b2e 100644 --- a/test/instrumentation/modules/aws-sdk/sns.test.js +++ b/test/instrumentation/modules/aws-sdk/sns.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + const agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', diff --git a/test/instrumentation/modules/aws-sdk/sqs.test.js b/test/instrumentation/modules/aws-sdk/sqs.test.js index 5b9af7ce4d..72aaf74e46 100644 --- a/test/instrumentation/modules/aws-sdk/sqs.test.js +++ b/test/instrumentation/modules/aws-sdk/sqs.test.js @@ -5,6 +5,12 @@ */ 'use strict' + +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + const agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', diff --git a/test/instrumentation/modules/bluebird/bluebird.test.js b/test/instrumentation/modules/bluebird/bluebird.test.js index b516df996d..6ea15b7292 100644 --- a/test/instrumentation/modules/bluebird/bluebird.test.js +++ b/test/instrumentation/modules/bluebird/bluebird.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + // The unhandledRejection will be fired by our bluebird tests, which is to be // expected. require('../../../_promise_rejection').remove() diff --git a/test/instrumentation/modules/bluebird/cancel.test.js b/test/instrumentation/modules/bluebird/cancel.test.js index dfc1d7559f..861495e0c8 100644 --- a/test/instrumentation/modules/bluebird/cancel.test.js +++ b/test/instrumentation/modules/bluebird/cancel.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', diff --git a/test/instrumentation/modules/cassandra-driver/index.test.js b/test/instrumentation/modules/cassandra-driver/index.test.js index 5ff13471b9..4c74b98cf4 100644 --- a/test/instrumentation/modules/cassandra-driver/index.test.js +++ b/test/instrumentation/modules/cassandra-driver/index.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + const agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', diff --git a/test/instrumentation/modules/elasticsearch.test.js b/test/instrumentation/modules/elasticsearch.test.js index 2440f3a958..4236521840 100644 --- a/test/instrumentation/modules/elasticsearch.test.js +++ b/test/instrumentation/modules/elasticsearch.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + process.env.ELASTIC_APM_TEST = true var host = (process.env.ES_HOST || 'localhost') + ':9200' diff --git a/test/instrumentation/modules/express-graphql.test.js b/test/instrumentation/modules/express-graphql.test.js index b79128eaa4..53b01fe874 100644 --- a/test/instrumentation/modules/express-graphql.test.js +++ b/test/instrumentation/modules/express-graphql.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../..').start({ serviceName: 'test', secretToken: 'test', diff --git a/test/instrumentation/modules/express-queue.test.js b/test/instrumentation/modules/express-queue.test.js index 84ed9768c3..d4a77e4949 100644 --- a/test/instrumentation/modules/express-queue.test.js +++ b/test/instrumentation/modules/express-queue.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../..').start({ serviceName: 'test', secretToken: 'test', diff --git a/test/instrumentation/modules/express/basic.test.js b/test/instrumentation/modules/express/basic.test.js index 2ff9bda0b9..81fd9f35f1 100644 --- a/test/instrumentation/modules/express/basic.test.js +++ b/test/instrumentation/modules/express/basic.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', diff --git a/test/instrumentation/modules/express/capture-exceptions-off.test.js b/test/instrumentation/modules/express/capture-exceptions-off.test.js index 9ce8065733..f450cf7d93 100644 --- a/test/instrumentation/modules/express/capture-exceptions-off.test.js +++ b/test/instrumentation/modules/express/capture-exceptions-off.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + const agent = require('../../../..').start({ captureExceptions: false, metricsInterval: 0, diff --git a/test/instrumentation/modules/express/capture-exceptions-on.test.js b/test/instrumentation/modules/express/capture-exceptions-on.test.js index e306c9cb42..d8b8b712e0 100644 --- a/test/instrumentation/modules/express/capture-exceptions-on.test.js +++ b/test/instrumentation/modules/express/capture-exceptions-on.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + const agent = require('../../../..').start({ captureExceptions: true, metricsInterval: 0, diff --git a/test/instrumentation/modules/express/set-framework.test.js b/test/instrumentation/modules/express/set-framework.test.js index eab44bc789..ce2836d552 100644 --- a/test/instrumentation/modules/express/set-framework.test.js +++ b/test/instrumentation/modules/express/set-framework.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + const agent = require('../../../..').start({ captureExceptions: true, metricsInterval: 0, diff --git a/test/instrumentation/modules/fastify/async-await.test.js b/test/instrumentation/modules/fastify/async-await.test.js index 8dd1b85b6a..3055342ba1 100644 --- a/test/instrumentation/modules/fastify/async-await.test.js +++ b/test/instrumentation/modules/fastify/async-await.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + require('../../../..').start({ captureExceptions: false, metricsInterval: 0, diff --git a/test/instrumentation/modules/fastify/fastify.test.js b/test/instrumentation/modules/fastify/fastify.test.js index cde6f52495..9427c4889c 100644 --- a/test/instrumentation/modules/fastify/fastify.test.js +++ b/test/instrumentation/modules/fastify/fastify.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + const agent = require('../../../..').start({ captureExceptions: false, metricsInterval: 0, diff --git a/test/instrumentation/modules/fastify/set-framework.test.js b/test/instrumentation/modules/fastify/set-framework.test.js index b4487b618a..f59276e583 100644 --- a/test/instrumentation/modules/fastify/set-framework.test.js +++ b/test/instrumentation/modules/fastify/set-framework.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + const agent = require('../../../..').start({ captureExceptions: true, metricsInterval: 0, diff --git a/test/instrumentation/modules/finalhandler.test.js b/test/instrumentation/modules/finalhandler.test.js index 940f6f2813..a34c7a221b 100644 --- a/test/instrumentation/modules/finalhandler.test.js +++ b/test/instrumentation/modules/finalhandler.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../..').start({ serviceName: 'test', secretToken: 'test', diff --git a/test/instrumentation/modules/generic-pool.test.js b/test/instrumentation/modules/generic-pool.test.js index 93e92e02e2..4e1377825e 100644 --- a/test/instrumentation/modules/generic-pool.test.js +++ b/test/instrumentation/modules/generic-pool.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../..').start({ serviceName: 'test', secretToken: 'test', diff --git a/test/instrumentation/modules/graphql.test.js b/test/instrumentation/modules/graphql.test.js index a9a71a5c49..8278130438 100644 --- a/test/instrumentation/modules/graphql.test.js +++ b/test/instrumentation/modules/graphql.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../..').start({ serviceName: 'test', secretToken: 'test', diff --git a/test/instrumentation/modules/handlebars.test.js b/test/instrumentation/modules/handlebars.test.js index 8e51f95042..6475545f0c 100644 --- a/test/instrumentation/modules/handlebars.test.js +++ b/test/instrumentation/modules/handlebars.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + process.env.ELASTIC_APM_TEST = true var agent = require('../../..').start({ diff --git a/test/instrumentation/modules/ioredis.test.js b/test/instrumentation/modules/ioredis.test.js index e7d388f4e2..fb8e55313d 100644 --- a/test/instrumentation/modules/ioredis.test.js +++ b/test/instrumentation/modules/ioredis.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../..').start({ serviceName: 'test-ioredis', captureExceptions: false, diff --git a/test/instrumentation/modules/koa-router/new-name.test.js b/test/instrumentation/modules/koa-router/new-name.test.js index de807c3121..f692060574 100644 --- a/test/instrumentation/modules/koa-router/new-name.test.js +++ b/test/instrumentation/modules/koa-router/new-name.test.js @@ -6,4 +6,9 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + require('./shared')('@koa/router') diff --git a/test/instrumentation/modules/koa-router/old-name.test.js b/test/instrumentation/modules/koa-router/old-name.test.js index 03015d529e..8ed884790a 100644 --- a/test/instrumentation/modules/koa-router/old-name.test.js +++ b/test/instrumentation/modules/koa-router/old-name.test.js @@ -6,4 +6,9 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + require('./shared')('koa-router') diff --git a/test/instrumentation/modules/mimic-response.test.js b/test/instrumentation/modules/mimic-response.test.js index 5bc7371459..cf927f76d5 100644 --- a/test/instrumentation/modules/mimic-response.test.js +++ b/test/instrumentation/modules/mimic-response.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../..').start({ serviceName: 'test', captureExceptions: false, diff --git a/test/instrumentation/modules/mongodb-core.test.js b/test/instrumentation/modules/mongodb-core.test.js index 9ec0f0fb3c..685070c309 100644 --- a/test/instrumentation/modules/mongodb-core.test.js +++ b/test/instrumentation/modules/mongodb-core.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../..').start({ serviceName: 'test-mongodb-core', captureExceptions: false, diff --git a/test/instrumentation/modules/mongodb.test.js b/test/instrumentation/modules/mongodb.test.js index 1ff48f1196..488272b32e 100644 --- a/test/instrumentation/modules/mongodb.test.js +++ b/test/instrumentation/modules/mongodb.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + const agent = require('../../..').start({ serviceName: 'test-mongodb', captureExceptions: false, diff --git a/test/instrumentation/modules/mysql/mysql.test.js b/test/instrumentation/modules/mysql/mysql.test.js index e81dfd1a3a..3f5a49548c 100644 --- a/test/instrumentation/modules/mysql/mysql.test.js +++ b/test/instrumentation/modules/mysql/mysql.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', diff --git a/test/instrumentation/modules/mysql/pool-release-1.test.js b/test/instrumentation/modules/mysql/pool-release-1.test.js index e20aed332d..e625c429df 100644 --- a/test/instrumentation/modules/mysql/pool-release-1.test.js +++ b/test/instrumentation/modules/mysql/pool-release-1.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', diff --git a/test/instrumentation/modules/mysql2/mysql.test.js b/test/instrumentation/modules/mysql2/mysql.test.js index 9dff1ae63f..fa4379b227 100644 --- a/test/instrumentation/modules/mysql2/mysql.test.js +++ b/test/instrumentation/modules/mysql2/mysql.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', diff --git a/test/instrumentation/modules/mysql2/pool-release-1.test.js b/test/instrumentation/modules/mysql2/pool-release-1.test.js index bc11c80f6c..c1c768e16a 100644 --- a/test/instrumentation/modules/mysql2/pool-release-1.test.js +++ b/test/instrumentation/modules/mysql2/pool-release-1.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../../..').start({ serviceName: 'test', secretToken: 'test', diff --git a/test/instrumentation/modules/next/next.test.js b/test/instrumentation/modules/next/next.test.js index cc867ad0f3..24ace91ace 100644 --- a/test/instrumentation/modules/next/next.test.js +++ b/test/instrumentation/modules/next/next.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + // Test Next.js instrumentation. // // This test roughly does the following: diff --git a/test/instrumentation/modules/pg/knex-no-span-stack-traces.test.js b/test/instrumentation/modules/pg/knex-no-span-stack-traces.test.js index 3e5f9b1a22..0bd0756e05 100644 --- a/test/instrumentation/modules/pg/knex-no-span-stack-traces.test.js +++ b/test/instrumentation/modules/pg/knex-no-span-stack-traces.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../../..').start({ serviceName: 'test-knex-no-span-stack-traces', secretToken: 'test', diff --git a/test/instrumentation/modules/pg/knex.test.js b/test/instrumentation/modules/pg/knex.test.js index 0612c4864a..e51e98b33d 100644 --- a/test/instrumentation/modules/pg/knex.test.js +++ b/test/instrumentation/modules/pg/knex.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + process.env.ELASTIC_APM_TEST = true var agent = require('../../../..').start({ diff --git a/test/instrumentation/modules/pg/pg.test.js b/test/instrumentation/modules/pg/pg.test.js index 6b3e64de61..40451fca1c 100644 --- a/test/instrumentation/modules/pg/pg.test.js +++ b/test/instrumentation/modules/pg/pg.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../../..').start({ serviceName: 'test-pg', captureExceptions: false, diff --git a/test/instrumentation/modules/pug.test.js b/test/instrumentation/modules/pug.test.js index 7b4f97fb5d..b83ef83781 100644 --- a/test/instrumentation/modules/pug.test.js +++ b/test/instrumentation/modules/pug.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + process.env.ELASTIC_APM_TEST = true var agent = require('../../..').start({ diff --git a/test/instrumentation/modules/redis-2-3.test.js b/test/instrumentation/modules/redis-2-3.test.js index 725ea63fa7..a08e0737df 100644 --- a/test/instrumentation/modules/redis-2-3.test.js +++ b/test/instrumentation/modules/redis-2-3.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var redisVersion = require('redis/package.json').version var semver = require('semver') if (semver.gte(redisVersion, '4.0.0')) { diff --git a/test/instrumentation/modules/redis.test.js b/test/instrumentation/modules/redis.test.js index 73d0962ec9..33f5fb5449 100644 --- a/test/instrumentation/modules/redis.test.js +++ b/test/instrumentation/modules/redis.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + const redisVersion = require('redis/package.json').version const semver = require('semver') diff --git a/test/instrumentation/modules/redis4-legacy.test.js b/test/instrumentation/modules/redis4-legacy.test.js index e790fe36fe..032c9915aa 100644 --- a/test/instrumentation/modules/redis4-legacy.test.js +++ b/test/instrumentation/modules/redis4-legacy.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + // this test file is about testing `legacyMode` // https://github.com/redis/node-redis/blob/HEAD/docs/v3-to-v4.md#legacy-mode const redisVersion = require('redis/package.json').version diff --git a/test/instrumentation/modules/restify/basic.test.js b/test/instrumentation/modules/restify/basic.test.js index 426efe306c..22ab6d023e 100644 --- a/test/instrumentation/modules/restify/basic.test.js +++ b/test/instrumentation/modules/restify/basic.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + const isRestifyIncompat = require('../../../_is_restify_incompat')() if (isRestifyIncompat) { console.log(`# SKIP ${isRestifyIncompat}`) diff --git a/test/instrumentation/modules/restify/set-framework.test.js b/test/instrumentation/modules/restify/set-framework.test.js index 8403732eab..6644992ecd 100644 --- a/test/instrumentation/modules/restify/set-framework.test.js +++ b/test/instrumentation/modules/restify/set-framework.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + const isRestifyIncompat = require('../../../_is_restify_incompat')() if (isRestifyIncompat) { console.log(`# SKIP ${isRestifyIncompat}`) diff --git a/test/instrumentation/modules/tedious.test.js b/test/instrumentation/modules/tedious.test.js index a3403937b1..b054462e3c 100644 --- a/test/instrumentation/modules/tedious.test.js +++ b/test/instrumentation/modules/tedious.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + const agent = require('../../../').start({ serviceName: 'test-tedious', captureExceptions: false, diff --git a/test/instrumentation/modules/undici/fetch.test.js b/test/instrumentation/modules/undici/fetch.test.js index 8377e4d428..552777cb12 100644 --- a/test/instrumentation/modules/undici/fetch.test.js +++ b/test/instrumentation/modules/undici/fetch.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + // Test node v18's `fetch` implementation (based on undici). // // Importantly, this test must not `require('undici')` because part of the diff --git a/test/instrumentation/modules/undici/undici.test.js b/test/instrumentation/modules/undici/undici.test.js index a65902fcfd..8f14f6f8ab 100644 --- a/test/instrumentation/modules/undici/undici.test.js +++ b/test/instrumentation/modules/undici/undici.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + process.env.ELASTIC_APM_TEST = true const { CapturingTransport } = require('../../../_capturing_transport') const apm = require('../../../..').start({ diff --git a/test/instrumentation/modules/ws.test.js b/test/instrumentation/modules/ws.test.js index d212a79806..cbcec4f371 100644 --- a/test/instrumentation/modules/ws.test.js +++ b/test/instrumentation/modules/ws.test.js @@ -6,6 +6,11 @@ 'use strict' +if (process.env.GITHUB_ACTIONS === 'true' && process.platform === 'win32') { + console.log('# SKIP: GH Actions do not support docker services on Windows') + process.exit(0) +} + var agent = require('../../..').start({ serviceName: 'test-ws', captureExceptions: false, From 011bec6a9dd79f39dc8a39e94ea89829802a8dfd Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 30 Mar 2023 10:15:42 +0200 Subject: [PATCH 06/13] action: otherwise it will fail on windows with ". is not recognized as an internal or external command" --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a73fdd7129..81eb5df30f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -163,4 +163,4 @@ jobs: node-version: 14 - run: npm install - run: npm ls --all || true - - run: npm test + - run: node test/test.js From c44ca29ace00bf0b92ddd0f63dfac989c4a30e57 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 30 Mar 2023 10:38:51 +0200 Subject: [PATCH 07/13] trying to solve the test failure on windows with \r\n versus \n --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index a298e8004f..ddf4e13e4a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ CHANGELOG.asciidoc merge=union +* -text From d8834af5c9c6ca902cf7ac7f52a5f5dbf64f716a Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 30 Mar 2023 19:58:45 +0200 Subject: [PATCH 08/13] Update .ci/Jenkinsfile --- .ci/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index cfeb57a4f6..d29c333d2e 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -19,7 +19,7 @@ pipeline { quietPeriod(10) } triggers { - issueCommentTrigger("(^run benchmark tests.*)") + issueCommentTrigger("^run benchmark tests.*") } parameters { booleanParam(name: 'bench_ci', defaultValue: true, description: 'Enable benchmarks.') From dddb87328dbc1d641247559cae7095aef43c36f6 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Thu, 30 Mar 2023 11:17:31 -0700 Subject: [PATCH 09/13] alternative fix for the 'github-423.test.js' test failure: don't depend on line ending type for this test --- .gitattributes | 1 - test/instrumentation/modules/http/github-423.test.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index ddf4e13e4a..a298e8004f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1 @@ CHANGELOG.asciidoc merge=union -* -text diff --git a/test/instrumentation/modules/http/github-423.test.js b/test/instrumentation/modules/http/github-423.test.js index a00bebfbfa..e74e2fe50f 100644 --- a/test/instrumentation/modules/http/github-423.test.js +++ b/test/instrumentation/modules/http/github-423.test.js @@ -54,7 +54,7 @@ test('https://github.com/elastic/apm-agent-nodejs/issues/423', function (t) { var server = http.createServer(function (req, res) { got(url).then(function (response) { t.strictEqual(response.body.length, fileSize, 'body should be expected size') - t.strictEqual(response.body.slice(0, 12), '/*\n * Copyri', 'body should be uncompressed') + t.ok(response.body.includes('Copyright Elasticsearch'), 'body should be uncompressed') res.end() }) }) From db50a1c7a8d09a1cbc5827672b5fee26ecb8f74e Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Thu, 30 Mar 2023 11:18:35 -0700 Subject: [PATCH 10/13] debug output to attempt to understand this test failure --- test/opentelemetry-bridge/fixtures.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/opentelemetry-bridge/fixtures.test.js b/test/opentelemetry-bridge/fixtures.test.js index c32657a846..8a4982b0a5 100644 --- a/test/opentelemetry-bridge/fixtures.test.js +++ b/test/opentelemetry-bridge/fixtures.test.js @@ -104,6 +104,7 @@ const cases = [ // All the transactions and spans, in timestamp order. const tas = events.slice(1) .sort((a, b) => (a.transaction || a.span).timestamp - (b.transaction || b.span).timestamp) + console.log('XXX tas:'); console.dir(tas, { depth: 5 }) // transaction "callServiceA" t.equal(tas[0].transaction.name, 'callServiceA') // `- span "GET localhost:$portA" (context.http.url=http://localhost:$portA/a-ping) From 6f7f9f2938973cd9b618b6d9e284af613665d675 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Thu, 30 Mar 2023 13:22:04 -0700 Subject: [PATCH 11/13] avoid 'timestamp'-based event ordering for this test, because that is apparently unreliable on the GH Actions Windows runners --- test/opentelemetry-bridge/fixtures.test.js | 44 +++++++++++----------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/test/opentelemetry-bridge/fixtures.test.js b/test/opentelemetry-bridge/fixtures.test.js index 8a4982b0a5..b5468694bf 100644 --- a/test/opentelemetry-bridge/fixtures.test.js +++ b/test/opentelemetry-bridge/fixtures.test.js @@ -97,36 +97,38 @@ const cases = [ // `- transaction "GET unknown route" (context.request.headers.{traceparent,tracestate}) // `- span "GET localhost:$portB" (context.http.url=http://localhost:$portB/b-ping) // `- transaction "GET unknown route" (context.request.headers.{traceparent,tracestate}) + // + // Dev Note: On Windows GitHub Actions runners the timestamp ordering of + // the transaction and span events is not reliable. script: 'distributed-trace.js', check: (t, events) => { + let e + t.equal(events.length, 6, 'exactly 6 events') t.ok(events[0].metadata, 'APM server got event metadata object') - // All the transactions and spans, in timestamp order. - const tas = events.slice(1) - .sort((a, b) => (a.transaction || a.span).timestamp - (b.transaction || b.span).timestamp) - console.log('XXX tas:'); console.dir(tas, { depth: 5 }) // transaction "callServiceA" - t.equal(tas[0].transaction.name, 'callServiceA') + e = findObjInArray(events, 'transaction.name', 'callServiceA') + t.equal(e.transaction.parent_id, undefined, 'trans "callServiceA" has no parent_id') // `- span "GET localhost:$portA" (context.http.url=http://localhost:$portA/a-ping) - const portA = tas[1].span.context.destination.port - t.equal(tas[1].span.parent_id, tas[0].transaction.id) - t.equal(tas[1].span.name, `GET localhost:${portA}`) - t.ok(tas[1].span.context.http.url, `http://localhost:${portA}/a-ping`) + e = findObjInArray(events, 'span.parent_id', e.transaction.id) + const portA = e.span.context.destination.port + t.equal(e.span.name, `GET localhost:${portA}`) + t.ok(e.span.context.http.url, `http://localhost:${portA}/a-ping`) // `- transaction "GET unknown route" (context.request.headers.{traceparent,tracestate}) - t.equal(tas[2].transaction.parent_id, tas[1].span.id) - t.equal(tas[2].transaction.name, 'GET unknown route') - t.ok(tas[2].transaction.context.request.headers.traceparent) - t.equal(tas[2].transaction.context.request.headers.tracestate, 'es=s:1') + e = findObjInArray(events, 'transaction.parent_id', e.span.id) + t.equal(e.transaction.name, 'GET unknown route') + t.ok(e.transaction.context.request.headers.traceparent) + t.equal(e.transaction.context.request.headers.tracestate, 'es=s:1') // `- span "GET localhost:$portB" (context.http.url=http://localhost:$portB/b-ping) - const portB = tas[3].span.context.destination.port - t.equal(tas[3].span.parent_id, tas[2].transaction.id) - t.equal(tas[3].span.name, `GET localhost:${portB}`) - t.ok(tas[3].span.context.http.url, `http://localhost:${portB}/b-ping`) + e = findObjInArray(events, 'span.parent_id', e.transaction.id) + const portB = e.span.context.destination.port + t.equal(e.span.name, `GET localhost:${portB}`) + t.ok(e.span.context.http.url, `http://localhost:${portB}/b-ping`) // `- transaction "GET unknown route" (context.request.headers.{traceparent,tracestate}) - t.equal(tas[4].transaction.parent_id, tas[3].span.id) - t.equal(tas[4].transaction.name, 'GET unknown route') - t.ok(tas[4].transaction.context.request.headers.traceparent) - t.equal(tas[4].transaction.context.request.headers.tracestate, 'es=s:1') + e = findObjInArray(events, 'transaction.parent_id', e.span.id) + t.equal(e.transaction.name, 'GET unknown route') + t.ok(e.transaction.context.request.headers.traceparent) + t.equal(e.transaction.context.request.headers.tracestate, 'es=s:1') } }, From 007fe710fd7c0510613870636dfe955e8f5783d4 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Thu, 30 Mar 2023 14:18:57 -0700 Subject: [PATCH 12/13] comment tweaks in the workflow file --- .github/workflows/test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 81eb5df30f..f8de4647aa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,3 @@ -# Run a significant subset of tests on GitHub Actions. - name: Test # https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662/2 @@ -32,7 +30,6 @@ jobs: # These services and their configuration should match test/docker-compose.yml. services: - redis: image: redis ports: @@ -163,4 +160,5 @@ jobs: node-version: 14 - run: npm install - run: npm ls --all || true + # Run a subset of tests that we can reasonably get running on Windows CI. - run: node test/test.js From 8b8dad476a0d4893db42929a46a088a05f2dd903 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 31 Mar 2023 10:52:01 +0200 Subject: [PATCH 13/13] Update .github/workflows/test.yml Co-authored-by: Ivan Fernandez Calvo --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f8de4647aa..da1df16474 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -158,6 +158,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 14 + cache: 'npm' - run: npm install - run: npm ls --all || true # Run a subset of tests that we can reasonably get running on Windows CI.