Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 29 additions & 2 deletions test/functional/apm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {
const { loadSpecTests } = require('../spec');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we rename this to command_monitoring.test.js to match the directory name change? Or would you rather do that as part of the greater test cleanup? I'm fine either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about doing it, but (1) I wasn't sure if we had in progress work touching this file and what potential merge conflict issues that might cause and (2) there are a lot of references to APM throughout and as you pointed out, the greater test refactor later is likely going to change a lot of things around, so not sure it's worth doing it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think it's fine to wait. LGTM.

const { expect } = require('chai');
const { ReadPreference } = require('../../src/read_preference');
const { runUnifiedTest } = require('./unified-spec-runner/runner');

describe('APM', function () {
before(function () {
Expand Down Expand Up @@ -695,7 +696,7 @@ describe('APM', function () {
});
});

describe('spec tests', function () {
describe('command monitoring spec tests', function () {
before(function () {
return setupDatabase(this.configuration);
});
Expand Down Expand Up @@ -926,7 +927,7 @@ describe('APM', function () {
});
}

loadSpecTests('apm').forEach(scenario => {
loadSpecTests('command-monitoring/legacy').forEach(scenario => {
if (scenario.name === 'command') return; // FIXME(NODE-3074): remove when `count` spec tests have been fixed
describe(scenario.name, function () {
scenario.tests.forEach(test => {
Expand Down Expand Up @@ -964,4 +965,30 @@ describe('APM', function () {
});
});
});

describe('command monitoring unified spec tests', () => {
for (const loadedSpec of loadSpecTests('command-monitoring/unified')) {
expect(loadedSpec).to.include.all.keys(['description', 'tests']);
// TODO: NODE-3356 unskip redaction tests
const testsToSkip =
loadedSpec.description === 'redacted-commands'
? loadedSpec.tests
.map(test => test.description)
.filter(
description =>
description !== 'hello without speculative authenticate is not redacted'
)
: [];
context(String(loadedSpec.description), function () {
for (const test of loadedSpec.tests) {
it(String(test.description), {
metadata: { sessions: { skipLeakTests: true } },
test: async function () {
await runUnifiedTest(this, loadedSpec, test, testsToSkip);
}
});
}
});
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Command Monitoring
Testing
=======

Tests in ``unified`` are implemented in the `Unified Test Format <../../unified-test-format/unified-test-format.rst>`__ and require
schema version 1.0. Tests in ``legacy`` should be run as described below.

Tests are provided in YML and JSON format to assert proper upconversion of commands.

Database and Collection Names
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading