Skip to content

test(NODE-2556): add integration testing for listDatabases' authorizedDatabases flag #3101

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 21 commits into from
Jan 24, 2022

Conversation

syz99
Copy link
Contributor

@syz99 syz99 commented Jan 11, 2022

Description

added int tests for the authorizedDatabases option of listDatabases

What is changing?

a new enumerating-databases int test folder with a list_databases test file has been added with appropriate tests

drive-by deletion/cleanup of gitkeep files

Is there new documentation needed for these changes?

n/a

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>
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@syz99 syz99 self-assigned this Jan 11, 2022
@syz99 syz99 requested a review from nbbeeken January 11, 2022 19:59
@syz99 syz99 force-pushed the NODE-2556/support-authorizedDatabses-flag branch from 642c9b0 to cc7f92a Compare January 11, 2022 20:34
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.

Nice work!

@nbbeeken nbbeeken added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Jan 11, 2022
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.

seems like there's a lint check issue and we need the skip back

@nbbeeken nbbeeken 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 11, 2022
nbbeeken
nbbeeken previously approved these changes Jan 12, 2022
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.

In addition to the comments regarding the test structure, please do not delete the .gitkeep files. The idea behind them is to make sure that the spec-related folders exist even if there are no files in them, so even if for the folders with files present we don't want to accidentally delete the folder by moving its contents elsewhere.

@syz99
Copy link
Contributor Author

syz99 commented Jan 18, 2022

Offloading ticket now. PR could be paused since a few new TODO's needed, namely: (1) testing for no duplicates and (2) verifying listDatabases return type is an array (i.e. verifying an "Iterable of Document types" per the spec).

Scope for this PR is to complete Test Case 1 here.

@nbbeeken nbbeeken force-pushed the NODE-2556/support-authorizedDatabses-flag branch from 48cb739 to a367230 Compare January 18, 2022 17:03
@nbbeeken nbbeeken requested a review from dariakp January 18, 2022 17:03
baileympearson
baileympearson previously approved these changes Jan 19, 2022
@nbbeeken nbbeeken requested a review from dariakp January 21, 2022 16:23
baileympearson
baileympearson previously approved these changes Jan 21, 2022

await client.db(DB_NAME).createCollection(DB_NAME);

ENTIRE_DB_LIST = (await client.db('admin').command({ listDatabases: 1 })).databases.map(
Copy link
Contributor

Choose a reason for hiding this comment

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

non-blocking: we could use nameOnly here so we don't have to map ({ name }) => name later on

Copy link
Contributor

Choose a reason for hiding this comment

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

nameOnly: true returns in the shape of:

{
  databases: [ { name: 'admin' }, { name: 'config' }, { name: 'local' } ],
  ok: 1
}

So nothing would change, it omits the metadata from each db description object reducing the BSON transmitted

baileympearson
baileympearson previously approved these changes Jan 24, 2022
@baileympearson
Copy link
Contributor

I left one small comment but it's non-blocking. LGTM

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.

Just one small thing

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.

LGTM, tyvm :)

@baileympearson baileympearson merged commit e61a741 into main Jan 24, 2022
@baileympearson baileympearson deleted the NODE-2556/support-authorizedDatabses-flag branch January 24, 2022 19:41
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
Development

Successfully merging this pull request may close these issues.

4 participants