Skip to content
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

test(NODE-6626): implement integration tests for improved client.close() - server-side #4367

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

aditi-khare-mongoDB
Copy link
Contributor

@aditi-khare-mongoDB aditi-khare-mongoDB commented Jan 10, 2025

Description

Add server-side resource integration tests for client.close(). These tests will remain skipped until improved client.close() is implemented.

What is changing?

  • Assert server-side resource creation and clean-up upon client.close()
Is there new documentation needed for these changes?

No

What is the motivation for this change?

Improved client.close()

Release Highlight

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@aditi-khare-mongoDB aditi-khare-mongoDB changed the base branch from main to NODE-6620/sockets January 10, 2025 22:21
@aditi-khare-mongoDB aditi-khare-mongoDB changed the title test(NODE-6626): Server Resource Integration Tests test(NODE-6626): Implement integration tests for improved client.close() - server-side Jan 10, 2025
@aditi-khare-mongoDB aditi-khare-mongoDB changed the title test(NODE-6626): Implement integration tests for improved client.close() - server-side test(NODE-6626): implement integration tests for improved client.close() - server-side Jan 10, 2025
@aditi-khare-mongoDB aditi-khare-mongoDB force-pushed the NODE-6626/server-side branch 3 times, most recently from 34ccf67 to 804c464 Compare January 10, 2025 23:00
@aditi-khare-mongoDB aditi-khare-mongoDB marked this pull request as ready for review January 13, 2025 20:01
@baileympearson baileympearson self-assigned this Jan 13, 2025
@baileympearson baileympearson added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Jan 13, 2025
Copy link
Contributor

@baileympearson baileympearson left a comment

Choose a reason for hiding this comment

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

One comment about unskipping tests that pass, and some optional comments. Otherwise LGTM

test/integration/node-specific/client_close.test.ts Outdated Show resolved Hide resolved
test/integration/node-specific/client_close.test.ts Outdated Show resolved Hide resolved
test/integration/node-specific/client_close.test.ts Outdated Show resolved Hide resolved
baileympearson
baileympearson previously approved these changes Jan 23, 2025
@baileympearson baileympearson added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Jan 23, 2025
Base automatically changed from NODE-6620/sockets to main January 23, 2025 17:04
@nbbeeken nbbeeken dismissed baileympearson’s stale review January 23, 2025 17:04

The base branch was changed.

author Aditi Khare <aditi.khare@mongodb.com> 1734376794 -0500
committer Aditi Khare <aditi.khare@mongodb.com> 1737656635 -0500

parent 70d476a
author Aditi Khare <aditi.khare@mongodb.com> 1734376794 -0500
committer Aditi Khare <aditi.khare@mongodb.com> 1737656626 -0500

parent 70d476a
author Aditi Khare <aditi.khare@mongodb.com> 1734376794 -0500
committer Aditi Khare <aditi.khare@mongodb.com> 1737656617 -0500

parent 70d476a
author Aditi Khare <aditi.khare@mongodb.com> 1734376794 -0500
committer Aditi Khare <aditi.khare@mongodb.com> 1737656617 -0500

parent 70d476a
author Aditi Khare <aditi.khare@mongodb.com> 1734376794 -0500
committer Aditi Khare <aditi.khare@mongodb.com> 1737656613 -0500

parent 70d476a
author Aditi Khare <aditi.khare@mongodb.com> 1734376794 -0500
committer Aditi Khare <aditi.khare@mongodb.com> 1737656583 -0500

parent 70d476a
author Aditi Khare <aditi.khare@mongodb.com> 1734376794 -0500
committer Aditi Khare <aditi.khare@mongodb.com> 1737656581 -0500

skeleton

skeleton updates

refactor for table

fix

remove misc file

clean up

Delete logs.txt

requested changes: additional expectation

remove extra file

ready for review

server selection test fix
@aditi-khare-mongoDB aditi-khare-mongoDB force-pushed the NODE-6626/server-side branch 3 times, most recently from e34d285 to d36e661 Compare January 23, 2025 18:29
clean up 2

clean up 2

clean up
@nbbeeken nbbeeken self-requested a review January 23, 2025 21:49
txn test fix 2

lint
Copy link
Contributor

@nbbeeken nbbeeken left a comment

Choose a reason for hiding this comment

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

"the server-side ServerSession is cleaned up by client.close():"

test is failing, this one we can unskip but I think the issue is something with the namespace already/not existing?

@aditi-khare-mongoDB
Copy link
Contributor Author

aditi-khare-mongoDB commented Jan 29, 2025

@nbbeeken Error should be gone now but I'll wait for tests to pass on full CI before re-requesting review.

I'm skipping the sessions tests on versions < 4.2 since that's what the $currentOp API requires to detect idleSessions

test/integration/node-specific/client_close.test.ts Outdated Show resolved Hide resolved
test/integration/node-specific/client_close.test.ts Outdated Show resolved Hide resolved
test/integration/node-specific/client_close.test.ts Outdated Show resolved Hide resolved
test/integration/node-specific/client_close.test.ts Outdated Show resolved Hide resolved
test/integration/node-specific/client_close.test.ts Outdated Show resolved Hide resolved
test/integration/node-specific/client_close.test.ts Outdated Show resolved Hide resolved
nbbeeken
nbbeeken previously approved these changes Jan 30, 2025
Copy link
Contributor

@nbbeeken nbbeeken left a comment

Choose a reason for hiding this comment

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

If CI is green, LGTM!

);
const isCursor = (r) => ((r.type === 'idleCursor') || (r.type === 'op' && r.desc === 'getMore'));
return res.cursor.firstBatch.filter(r => isCursor(r) && r.ns === 'close.cursorCleanUp');
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we address the outstanding cursors this found? seems like client.close() isn't doing what it promises to if we are seeing cursors from other tests here.

Copy link
Contributor Author

@aditi-khare-mongoDB aditi-khare-mongoDB Jan 30, 2025

Choose a reason for hiding this comment

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

Yep, I reverted the changes, and I'll look into the outstanding cursors

@aditi-khare-mongoDB aditi-khare-mongoDB force-pushed the NODE-6626/server-side branch 2 times, most recently from f11de93 to f53ecc6 Compare January 30, 2025 17:58
@nbbeeken nbbeeken added the wip label Jan 31, 2025
@aditi-khare-mongoDB aditi-khare-mongoDB requested a review from a team as a code owner January 31, 2025 17:42
bug fixed
@@ -1061,6 +1059,8 @@ export abstract class AbstractCursor<
if (!this.cursorSession?.inTransaction()) {
maybeClearPinnedConnection(this.cursorSession, { error });
}
this.cursorId = Long.ZERO;
this.isKilled = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting that this related to fixing the server side issue. We've changed the meaning of killed include cursors that didn't actually run kill cursors

  /**
   * A `killCursors` command was attempted on this cursor.
   * This is performed if the cursor id is non zero.
   */

I'm not sure that's a change we can make here, maybe there's another approach to whatever moving this variable addressed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team wip
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants