Skip to content
This repository was archived by the owner on Mar 2, 2026. It is now read-only.

feat: Multi db test parametrization - #717

Merged
kolea2 merged 14 commits into
mainfrom
feat-multidb-test-parametrization
Jul 18, 2023
Merged

feat: Multi db test parametrization#717
kolea2 merged 14 commits into
mainfrom
feat-multidb-test-parametrization

Conversation

@Mariatta

Copy link
Copy Markdown
Contributor

The changes are:

  • adding test parametrization wherever the client is used. It will run the test against the default db, and a named db named db can only be passed to the Client, and the underlying queries and aggregation queries will retrieve the database id from the Client.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

The changes are:

- adding test parametrization wherever the client is used. It will run the test against the default db, and a named db
named db can only be passed to the Client, and the underlying queries and aggregation queries will retrieve the database id from the Client.
@product-auto-label product-auto-label Bot added size: xl Pull request size is extra large. api: firestore Issues related to the googleapis/python-firestore API. labels May 11, 2023

@kolea2 kolea2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I dont think the ITs were run since this is a draft PR - can we convert to ready for review?

Comment thread tests/system/test__helpers.py Outdated
@parthea parthea added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. owlbot:run Add this label to trigger the Owlbot post processor. labels Jul 5, 2023
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jul 5, 2023
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Jul 5, 2023
@vishwarajanand
vishwarajanand marked this pull request as ready for review July 10, 2023 18:07
@vishwarajanand
vishwarajanand requested review from a team July 10, 2023 18:07
@@ -36,26 +37,42 @@ def _make_credentials():

def _make_default_client(*args, **kwargs):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it would be great to add one additional test without parameterization testing client initialization with:

  1. not setting the database
  2. setting the database
  3. setting the database to None

and asserting the database is set correctly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@kolea2 there are 2 approaches to tackle this:

  1. (current - neater approach but tests only client initialization) Adds test_client_constructor_without_db where DB isn't set and the database is asserted to equal DEFAULT_DATABASE

  2. (Code become less readable, but tests are more exhaustive) we can add a check in _make_default_client to not use database param when it's an empty string during the client initialization.

I choose the first approach for readability, but I have no qualms with the second one too. Leaving this comment open for now for Python reviewers.

@kolea2 kolea2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm, will defer to @googleapis/yoshi-python for the remaining review!

Comment thread tests/system/test__helpers.py
@kolea2
kolea2 merged commit 91fc8bb into main Jul 18, 2023
@kolea2
kolea2 deleted the feat-multidb-test-parametrization branch July 18, 2023 18:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: firestore Issues related to the googleapis/python-firestore API. size: xl Pull request size is extra large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants