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

ci(NODE-6712): fix broken tests against latest driver #66

Merged
merged 11 commits into from
Feb 5, 2025

Conversation

baileympearson
Copy link
Collaborator

@baileympearson baileympearson commented Feb 4, 2025

Description

What is changing?

See https://jira.mongodb.org/browse/NODE-6712 for a full description of the issue.

This PR restructures the unit tests so that no actual driver instances are constructed until we are executing tests.

Is there new documentation needed for these changes?

What is the motivation for this change?

Release Highlight

Fill in title or leave empty for no 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

@baileympearson baileympearson changed the title No story broken tests ci: fix broken tests against latest driver Feb 4, 2025
@baileympearson baileympearson marked this pull request as ready for review February 4, 2025 18:07
@baileympearson baileympearson requested a review from a team as a code owner February 4, 2025 18:07
@@ -21,6 +21,8 @@ updates:
versions: [">=16.0.0"]
# we ignore TS as a part of quarterly dependency updates.
- dependency-name: "typescript"

- dependency-name: "mongodb"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can revert but we don't update the driver quarterly, so I added it to the ignore list.

Copy link
Collaborator

Choose a reason for hiding this comment

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

no, please keep! ty!

@nbbeeken nbbeeken self-assigned this Feb 5, 2025
@nbbeeken nbbeeken changed the title ci: fix broken tests against latest driver ci(NODE-6712): fix broken tests against latest driver Feb 5, 2025
@nbbeeken nbbeeken self-requested a review February 5, 2025 16:16
Copy link
Collaborator

@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.

just the prettier thing, and a quick question

This originally was the quick fix but now seems like we tackled the full issue correct? so I put the ticket in the title

@@ -145,3 +145,844 @@ module.exports.classNames = new Set(api.map(({ className }) => className))
module.exports.classNameToMethodList = new Map(api.map((api, _, array) =>
[api.className, sorted(Array.from(new Set(Array.from(array.filter(v => v.className === api.className), method => method))), (a, b) => byStrings(a.method, b.method))]
));

/**
* Generated from `api`, this is an exhaustive list of all methods we can unit test.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Generated how? would we need to regen it ever? (prob not but just wanna capture the history of how at least)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's non-trivial to re-generate. I generated it using the old test setup, which was problematic for the reasons listed in the ticket, but the functionLength specifically requires an instance of the function to calculate.

I think it's okay to leave this without a script to generate it, we'll likely never touch this again (this is the 4.x compatible methods to test, and 4.x will never change again). If we do modify it, it would just be to add or remove callback positions

Copy link
Collaborator

Choose a reason for hiding this comment

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

works for me, and I agree, low traffic here

module.exports.unitTestableAPI = [
{
"className": "Admin",
"method": "buildInfo",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm surprised this isn't getting reformatted, wanna run prettier to spare the next person a big reformat diff if they have to run it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I though we ran prettier through eslint. I guess not

@@ -21,6 +21,8 @@ updates:
versions: [">=16.0.0"]
# we ignore TS as a part of quarterly dependency updates.
- dependency-name: "typescript"

- dependency-name: "mongodb"
Copy link
Collaborator

Choose a reason for hiding this comment

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

no, please keep! ty!

@nbbeeken nbbeeken merged commit fa0bb06 into main Feb 5, 2025
10 checks passed
@nbbeeken nbbeeken deleted the no-story-broken-tests branch February 5, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants