Skip to content

Commit abf01fc

Browse files
authored
test(NODE-3288): sync command-monitoring spec tests (#2837)
* refactor: rename apm spec directory to command-monitoring * Sync redacted commands spec tests * Skip failing spec tests * Move legacy command-monitoring spec tests into their own folder
1 parent 2de596b commit abf01fc

24 files changed

+772
-2
lines changed

test/functional/apm.test.js

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const {
99
const { loadSpecTests } = require('../spec');
1010
const { expect } = require('chai');
1111
const { ReadPreference } = require('../../src/read_preference');
12+
const { runUnifiedTest } = require('./unified-spec-runner/runner');
1213

1314
describe('APM', function () {
1415
before(function () {
@@ -695,7 +696,7 @@ describe('APM', function () {
695696
});
696697
});
697698

698-
describe('spec tests', function () {
699+
describe('command monitoring spec tests', function () {
699700
before(function () {
700701
return setupDatabase(this.configuration);
701702
});
@@ -926,7 +927,7 @@ describe('APM', function () {
926927
});
927928
}
928929

929-
loadSpecTests('apm').forEach(scenario => {
930+
loadSpecTests('command-monitoring/legacy').forEach(scenario => {
930931
if (scenario.name === 'command') return; // FIXME(NODE-3074): remove when `count` spec tests have been fixed
931932
describe(scenario.name, function () {
932933
scenario.tests.forEach(test => {
@@ -964,4 +965,30 @@ describe('APM', function () {
964965
});
965966
});
966967
});
968+
969+
describe('command monitoring unified spec tests', () => {
970+
for (const loadedSpec of loadSpecTests('command-monitoring/unified')) {
971+
expect(loadedSpec).to.include.all.keys(['description', 'tests']);
972+
// TODO: NODE-3356 unskip redaction tests
973+
const testsToSkip =
974+
loadedSpec.description === 'redacted-commands'
975+
? loadedSpec.tests
976+
.map(test => test.description)
977+
.filter(
978+
description =>
979+
description !== 'hello without speculative authenticate is not redacted'
980+
)
981+
: [];
982+
context(String(loadedSpec.description), function () {
983+
for (const test of loadedSpec.tests) {
984+
it(String(test.description), {
985+
metadata: { sessions: { skipLeakTests: true } },
986+
test: async function () {
987+
await runUnifiedTest(this, loadedSpec, test, testsToSkip);
988+
}
989+
});
990+
}
991+
});
992+
}
993+
});
967994
});

test/spec/apm/README.rst renamed to test/spec/command-monitoring/README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Command Monitoring
1212
Testing
1313
=======
1414

15+
Tests in ``unified`` are implemented in the `Unified Test Format <../../unified-test-format/unified-test-format.rst>`__ and require
16+
schema version 1.0. Tests in ``legacy`` should be run as described below.
17+
1518
Tests are provided in YML and JSON format to assert proper upconversion of commands.
1619

1720
Database and Collection Names
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)