Skip to content

Commit

Permalink
chore: skipped all tests that are known and failling on node 20
Browse files Browse the repository at this point in the history
  • Loading branch information
bizob2828 committed Jul 24, 2023
1 parent 125f08b commit 17919f3
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 22 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:
name: unit-tests-${{ matrix.node-version }}
path: ./coverage/unit/lcov.info
- name: Run ESM Unit Tests
if: matrix.node-version != '20.x'
run: npm run unit:esm
- name: Archive ESM Unit Test Coverage
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -139,8 +140,8 @@ jobs:
run: npm ci
- name: Run Docker Services
run: npm run services
- name: Run Versioned Tests (npm v7 / Node 16+)
run: TEST_CHILD_TIMEOUT=600000 npm run versioned:npm7
- name: Run Versioned Tests
run: TEST_CHILD_TIMEOUT=600000 npm run versioned
env:
VERSIONED_MODE: ${{ github.ref == 'refs/heads/main' && '--minor' || '--major' }}
JOBS: 4 # 2 per CPU seems to be the sweet spot in GHA (July 2022)
Expand Down
12 changes: 8 additions & 4 deletions test/integration/logger.tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const tap = require('tap')
const rimraf = require('rimraf')
const util = require('util')
const exec = util.promisify(require('child_process').exec)
const { isSupportedVersion } = require('../lib/agent_helper')

const DIRNAME = 'XXXNOCONFTEST'

Expand Down Expand Up @@ -56,10 +57,13 @@ tap.test('logger', function (t) {
tap.test('Logger output', (t) => {
t.autoend()

const execArgs = [
{ opt: '-r', arg: '../../../index.js' },
{ opt: '--experimental-loader', arg: '../../../esm-loader.mjs' }
]
const execArgs = [{ opt: '-r', arg: '../../../index.js' }]

// TODO: add back to array when we fix ESM loader
if (!isSupportedVersion('v19.0.0')) {
execArgs.push({ opt: '--experimental-loader', arg: '../../../esm-loader.mjs' })
}

for (const pair of execArgs) {
const { opt, arg } = pair
t.test(`Check for ${opt} in logger output at debug level`, async (t) => {
Expand Down
9 changes: 9 additions & 0 deletions test/lib/agent_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const Transaction = require('../../lib/transaction')
const symbols = require('../../lib/symbols')
const http = require('http')
const https = require('https')
const semver = require('semver')

const KEYPATH = path.join(__dirname, 'test-key.key')
const CERTPATH = path.join(__dirname, 'self-signed-test-certificate.crt')
Expand Down Expand Up @@ -686,5 +687,13 @@ const helper = (module.exports = {
: original[symbols.original]
}
return original
},
/**
* Util that checks if current node version is supported
* @param {string} version semver version string
* @returns {boolean} if version is supported
*/
isSupportedVersion(version) {
return semver.gt(process.version, version)
}
})
14 changes: 6 additions & 8 deletions test/unit/environment.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const path = require('path')
const fs = require('fs/promises')
const spawn = require('child_process').spawn
const environment = require('../../lib/environment')
const { isSupportedVersion } = require('../lib/agent_helper')

function find(settings, name) {
const items = settings.filter(function (candidate) {
Expand Down Expand Up @@ -136,10 +137,8 @@ tap.test('the environment scraper', (t) => {
t.end()
})

// TODO: expected, waiting for https://github.com/newrelic/node-newrelic/pull/1705
// to merge down before applying to appropriate skip
/*t.test('without process.config', (t) => {
>>>>>>> 573d9fb80 (chore: updated unit tests to get them working with node 20)
// TODO: remove tests when we drop support for node 18
t.test('without process.config', { skip: isSupportedVersion('v19.0.0') }, (t) => {
let conf = null

t.before(() => {
Expand All @@ -149,6 +148,7 @@ tap.test('the environment scraper', (t) => {
* TODO: Augmenting process.config has been deprecated in Node 16.
* When fully disabled we may no-longer be able to test but also may no-longer need to.
* https://nodejs.org/api/deprecations.html#DEP0150
*/
process.config = null
return reloadEnvironment()
})
Expand Down Expand Up @@ -183,7 +183,6 @@ tap.test('the environment scraper', (t) => {
})
t.end()
})
*/

t.test('should have built a flattened package list', (t) => {
const packages = find(settings, 'Packages')
Expand Down Expand Up @@ -219,10 +218,10 @@ tap.test('the environment scraper', (t) => {
t.end()
})

// TODO: this will no longer work in Node 20
/* it('should resolve refresh where deps and deps of deps are symlinked to each other', async function () {
// TODO: remove this test when we drop support for node 18
t.test(
'should resolve refresh where deps and deps of deps are symlinked to each other',
{ skip: isSupportedVersion('v19.0.0') },
async (t) => {
process.config.variables.node_prefix = path.join(__dirname, '../lib/example-deps')
const data = await environment.getJSON()
Expand All @@ -232,7 +231,6 @@ tap.test('the environment scraper', (t) => {
t.end()
}
)
*/

t.test('should not crash when given a file in NODE_PATH', (t) => {
const env = {
Expand Down
2 changes: 0 additions & 2 deletions test/unit/instrumentation/http/synthetics.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ tap.test('synthetics outbound header', (t) => {
})
})

// TODO: The server doesn't seem to be getting closed
// before the test listens on the next
t.test('should be propagated if on tx', (t) => {
helper.runInTransaction(agent, function (transaction) {
transaction.syntheticsData = SYNTHETICS_DATA
Expand Down
2 changes: 1 addition & 1 deletion test/versioned/esm-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"tests": [
{
"engines": {
"node": ">=16.12.0"
"node": ">=16.12.0 <20"
},
"dependencies": {
"parse-json": "6.0.2"
Expand Down
2 changes: 1 addition & 1 deletion test/versioned/express-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"tests": [
{
"engines": {
"node": ">=16.12.0"
"node": ">=16.12.0 <20"
},
"dependencies": {
"express": ">=4.6.0",
Expand Down
2 changes: 1 addition & 1 deletion test/versioned/grpc-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"tests": [
{
"engines": {
"node": ">=16.12.0"
"node": ">=16.12.0 <20"
},
"dependencies": {
"@grpc/grpc-js": ">=1.4.0"
Expand Down
2 changes: 1 addition & 1 deletion test/versioned/mongodb-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"tests": [
{
"engines": {
"node": ">=16.12.0"
"node": ">=16.12.0 <20"
},
"dependencies": {
"mongodb": ">=2.1 < 4.0.0 || >= 4.1.4 < 5"
Expand Down
4 changes: 2 additions & 2 deletions test/versioned/pg-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"tests": [
{
"engines": {
"node": ">=16.12.0"
"node": ">=16.12.0 <20"
},
"dependencies": {
"pg": ">=8.2 <8.8",
Expand All @@ -20,7 +20,7 @@
},
{
"engines": {
"node": ">=16.12.0"
"node": ">=16.12.0 <20"
},
"dependencies": {
"pg": ">=8.8",
Expand Down

0 comments on commit 17919f3

Please sign in to comment.