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

feat(NODE-3191): backport versioned api #2850

Merged
merged 8 commits into from Jun 25, 2021

Conversation

emadum
Copy link
Contributor

@emadum emadum commented Jun 16, 2021

NODE-3191

Includes backports for the following 4.0 PRs:

@emadum emadum added the wip label Jun 16, 2021
@emadum emadum changed the base branch from 3.7 to 3.6 June 16, 2021 20:02
@emadum emadum changed the base branch from 3.6 to 3.7 June 16, 2021 20:02
@emadum emadum force-pushed the NODE-3191/3.7/versioned-api-backport branch from 0d7f8ac to 2862914 Compare June 17, 2021 16:20
@emadum emadum requested a review from nbbeeken June 17, 2021 20:27
@emadum emadum marked this pull request as ready for review June 17, 2021 20:27
@emadum emadum removed the wip label Jun 17, 2021
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.

Despite the size, a majority of this is accepting hello and legacy hello in the tests, most of what I callout here is minor requests.

lib/collection.js Outdated Show resolved Hide resolved
test/functional/unified-spec-runner/entities.ts Outdated Show resolved Hide resolved
test/functional/buffering_proxy.test.js Show resolved Hide resolved
test/functional/collations.test.js Outdated Show resolved Hide resolved
test/functional/cursor.test.js Outdated Show resolved Hide resolved
test/unit/core/single/sessions.test.js Outdated Show resolved Hide resolved
test/unit/sessions/collection.test.js Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
@emadum emadum force-pushed the NODE-3191/3.7/versioned-api-backport branch from f2a987d to 8fd0886 Compare June 21, 2021 15:04
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.

LGTM

@nbbeeken nbbeeken requested review from dariakp and durran June 21, 2021 21:29
@nbbeeken nbbeeken added the Team Review Needs review from team label Jun 21, 2021
@@ -1,6 +1,6 @@
stepback: true
command_type: system
exec_timeout_secs: 1200
Copy link
Contributor Author

@emadum emadum Jun 22, 2021

Choose a reason for hiding this comment

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

Note: this change is unrelated to the versioned API, we've just been experiencing some premature timeouts on our longer running tasks; this gives them another 5 minutes to complete.

@emadum emadum force-pushed the NODE-3191/3.7/versioned-api-backport branch from 9cade0d to 7e5b14a Compare June 22, 2021 14:41
Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

@emadum @nbbeeken The PR looks fine to me, minus the couple of questions I had around the test changes

@@ -58,6 +58,7 @@ describe('Views', function() {
) {
expect(r).to.exist;
expect(err).to.not.exist;
delete commandResult.apiVersion;
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we want to delete this key instead of checking for it? just for the sake of the deep equal comparison? it could be misleading in terms of the expected behavior

Copy link
Contributor Author

@emadum emadum Jun 23, 2021

Choose a reason for hiding this comment

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

I wasn't sure about the best approach to take here. Below we currently use a deep equal check on the commandResult, which may or may not contain apiVersion depending on how the test is run, e.g. the presence of the MONGODB_API_VERSION environment variable.

We could use containsSubset instead of doing a deep equal check, but that allows the presence of extraneous keys we don't actually want to be there. Deleting the apiVersion key (which is otherwise irrelevant to this test) seemed like a reasonable compromise, but I'm open to better ideas! Or perhaps just adding a comment would suffice.

Copy link
Contributor

Choose a reason for hiding this comment

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

so there's a couple of different approaches possible here:

  1. if it is possible to know what the expected apiVersion is based on the test context, then we can optionally assert on it by pulling the expected object out into its own const expectedResult = { create, viewOn, pipeline } and then assigning the apiVersion with the expected value if we expect there to be one;
  2. if it is possible to know whether or not the apiVersion is set at all, but not what it's set to, we could use the keys assertion (expect(obj).to.have.all.keys([...])) to check that all expected keys are present and then assert on the 3 that we know one at a time;
  3. if it is not possible to know whether the apiVersion is even set, then just a comment to that end would be fine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Went with option 1 👍

test/functional/crud_spec.test.js Show resolved Hide resolved
@@ -4117,59 +4119,6 @@ describe('Cursor', function() {
}
});

it('Correctly decorate the collection cursor count command with skip, limit, hint, readConcern', {
Copy link
Contributor

Choose a reason for hiding this comment

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

why was this test deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently taking another look at this test actually, deleting it may have been a mistake.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it was a bug that was causing this test to fail, fixed now.

@emadum emadum requested a review from dariakp June 24, 2021 23:53
Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

Thanks for all the test updates!

@emadum emadum merged commit 93a47fd into 3.7 Jun 25, 2021
@emadum emadum deleted the NODE-3191/3.7/versioned-api-backport branch June 25, 2021 16:07
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
Projects
None yet
5 participants