Skip to content

test(NODE-5929): convert txn legacy spec tests #3987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 28, 2024
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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import * as path from 'path';

import { loadSpecTests } from '../../spec';
import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner';

const SKIPPED_TESTS = [
'callback succeeds after multiple connection errors',
'callback is not retried after non-transient error',
'callback is not retried after non-transient error (DuplicateKeyError)',
'withTransaction succeeds if callback aborts',
'unpin after transient error within a transaction',
'withTransaction succeeds if callback commits',
'withTransaction still succeeds if callback aborts and runs extra op',
'withTransaction still succeeds if callback commits and runs extra op',
'withTransaction commits after callback returns (second transaction)',
'withTransaction commits after callback returns',
'withTransaction and no transaction options set',
'withTransaction inherits transaction options from defaultTransactionOptions',
'withTransaction explicit transaction options override defaultTransactionOptions',
'withTransaction explicit transaction options'
];

describe('Transactions Convenient API Spec Unified Tests', function () {
beforeEach(function () {
if (this.configuration.topologyType === 'LoadBalanced') {
if (this.currentTest) {
this.currentTest.skipReason =
'TODO(NODE-5931) - Fix socket leaks in load balancer transaction tests.';
}
this.skip();
}
});

runUnifiedSuite(loadSpecTests(path.join('transactions-convenient-api', 'unified')), test => {
return SKIPPED_TESTS.includes(test.description)
? 'TODO(NODE-5855/DRIVERS-2816): Skipping failing transaction tests'
: false;
});
});
137 changes: 0 additions & 137 deletions test/integration/transactions/transactions.spec.test.js

This file was deleted.

34 changes: 34 additions & 0 deletions test/integration/transactions/transactions.spec.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import * as path from 'path';
Copy link
Member Author

Choose a reason for hiding this comment

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

I converted the tests to typescript. Unskipped everything and re-verified everything was was getting skipped and filed 2 new tickets (NODE-5925 and NODE-5924) for 2 new bugs these tests exposed in the driver.


import { loadSpecTests } from '../../spec';
import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner';

const SKIPPED_TESTS = [
// TODO(NODE-5925) - secondary read preference not allowed in transactions.
'readPreference inherited from defaultTransactionOptions',
// TODO(NODE-5924) - Fix modification of readConcern object post message send.
'readConcern local in defaultTransactionOptions',
'defaultTransactionOptions override client options',
'transaction options inherited from defaultTransactionOptions',
'transaction options inherited from client',
'causal consistency disabled'
// TODO(NODE-5855) - Gone away after NODE-5929
Copy link
Member Author

Choose a reason for hiding this comment

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

The unified tests that are related to NODE-5855 are automatically skipped by the unified tests due to the fact that targetedFailPoint will not work with multiple mongoses in load balancer mode. So those tests only run on sharded clusters.

];

describe('Transactions Spec Unified Tests', function () {
this.beforeEach(function () {
if (this.configuration.topologyType === 'LoadBalanced') {
if (this.currentTest) {
this.currentTest.skipReason =
'TODO(NODE-5931) - Fix socket leaks in load balancer transaction tests.';
}
}
this.skip();
});

runUnifiedSuite(loadSpecTests(path.join('transactions', 'unified')), test => {
return SKIPPED_TESTS.includes(test.description)
? 'TODO(NODE-5924/NODE-5925): Skipping failing transaction tests'
: false;
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ const filter: TestFilter = ({ description }) => {
return 'TODO(NODE-3308): failures due unnecessary getMore and killCursors calls in 5.0';
}

if (
[
'withTransaction and no transaction options set',
'withTransaction inherits transaction options from client',
'withTransaction inherits transaction options from defaultTransactionOptions',
'withTransaction explicit transaction options',
'remain pinned after non-transient Interrupted error on insertOne',
'unpin after transient error within a transaction',
'remain pinned after non-transient Interrupted error on insertOne'
].includes(description)
) {
return 'TODO(DRIVERS-2816): fix migration conflict in transaction tests';
}

if (
process.env.AUTH === 'auth' &&
[
Expand Down
Loading