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

chore: cleanup resources at startup#1741

Merged
chalmerlowe merged 9 commits intogoogleapis:mainfrom
kiraksi:cleanup-resources-at-startup
Jan 17, 2024
Merged

chore: cleanup resources at startup#1741
chalmerlowe merged 9 commits intogoogleapis:mainfrom
kiraksi:cleanup-resources-at-startup

Conversation

@kiraksi
Copy link
Copy Markdown
Contributor

@kiraksi kiraksi commented Dec 4, 2023

This PR:

  • Uses prefixer function in conftest from python-test-utils to assign IDs to datasets in samples/snippets
  • If dataset IDs already exist with the same name, those get deleted at start time
  • Primarily, this ensures that any tests that are stopped or crash do not leave dataset resources behind

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 #590 🦕

@product-auto-label product-auto-label Bot added size: s Pull request size is small. api: bigquery Issues related to the googleapis/python-bigquery API. labels Dec 4, 2023
@kiraksi kiraksi changed the title Cleanup resources at startup chore: cleanup resources at startup Dec 4, 2023
Comment thread samples/snippets/authorized_view_tutorial_test.py Outdated
@kiraksi kiraksi marked this pull request as ready for review December 13, 2023 18:55
@kiraksi kiraksi requested a review from a team December 13, 2023 18:55
@kiraksi kiraksi requested a review from a team as a code owner December 13, 2023 18:55
@kiraksi kiraksi requested review from a team, alvarowolfx, engelke and tswast and removed request for alvarowolfx and engelke December 13, 2023 18:55
@chalmerlowe
Copy link
Copy Markdown
Collaborator

@kiraksi Per our discussion:

  • please figure out whether we need individual mechanisms to create prefixes in our tests OR if we can rely upon the mechanisms in conftest to do it globally.

Comment thread samples/snippets/authorized_view_tutorial_test.py Outdated
Comment thread samples/snippets/dataset_access_test.py Outdated
Comment thread samples/snippets/natality_tutorial_test.py Outdated
@chalmerlowe chalmerlowe added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 8, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 8, 2024
@kiraksi kiraksi force-pushed the cleanup-resources-at-startup branch from 4704e7a to 1a9dbe6 Compare January 10, 2024 18:29
Copy link
Copy Markdown
Collaborator

@chalmerlowe chalmerlowe left a comment

Choose a reason for hiding this comment

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

LGTM

@chalmerlowe chalmerlowe merged commit ffe8059 into googleapis:main Jan 17, 2024
@kiraksi kiraksi deleted the cleanup-resources-at-startup branch January 17, 2024 20:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: bigquery Issues related to the googleapis/python-bigquery API. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: cleanup resources at startup time in system and sample tests

3 participants