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

tests: refactor systests into separate modules w/ pytest fixtures #393

Merged
merged 10 commits into from
Sep 15, 2021

Conversation

tseaver
Copy link
Contributor

@tseaver tseaver commented Jul 22, 2021

Closes #391.

@tseaver tseaver requested review from crwilcox and kolea2 July 22, 2021 16:04
@tseaver tseaver requested review from a team as code owners July 22, 2021 16:05
@product-auto-label product-auto-label bot added the api: bigtable Issues related to the googleapis/python-bigtable API. label Jul 22, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 22, 2021
@tseaver
Copy link
Contributor Author

tseaver commented Jul 22, 2021

Flaky sample error reported as #394.

@tseaver
Copy link
Contributor Author

tseaver commented Jul 23, 2021

#394 strikes again. I'll retry here after getting #395 merged.

@tseaver tseaver force-pushed the 391-refactor-systests branch from b73793c to de1f8a0 Compare September 14, 2021 21:25
tests/system/conftest.py Show resolved Hide resolved
serve_nodes,
in_emulator,
):
if not in_emulator:
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, maybe a comment explaining the difference in setup for emulated vs non-emulated environments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tests/system/test_data_api.py Show resolved Hide resolved
timestamp_range = row_filters.TimestampRange(start=start, end=end)
timefilter = row_filters.TimestampRangeFilter(timestamp_range)
row_data = data_table.read_rows(filter_=timefilter)
row_data.consume_all()
Copy link
Contributor

Choose a reason for hiding this comment

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

No data written first? No asserts? What is this testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test is added in googleapis/google-cloud-python#5002. It feels like a "smoke test" for the expectation that timestamps passed in as filters get rounded down / up to the nearest millisecond (the back-end would barf when passed microsecond values (googleapis/google-cloud-python#4932).


data_table.truncate(timeout=200)

for row in data_table.read_rows():
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you expecting there to be rows?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That test was originally added in googleapis/google-cloud-python#5360: I just ported it.

Assuming we don't have race conditions with other CI runs, I would expect there to be no rows in the table after a call to truncate. 4b11ce8 changes the assertion accordingly.

]

rows = []
for row_key in row_keys:
Copy link
Contributor

Choose a reason for hiding this comment

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

This is repeated so often, I wonder if a helper function or fixture is in order for DRY reasons.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tseaver tseaver requested a review from chrisrossi September 15, 2021 18:22
Copy link
Contributor

@chrisrossi chrisrossi left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@tseaver tseaver merged commit 83958df into main Sep 15, 2021
@tseaver tseaver deleted the 391-refactor-systests branch September 15, 2021 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the googleapis/python-bigtable API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split tests/system.py into separate modules, refactor to use pytest fixtures.
2 participants