-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix: Transient IT test_snapshot_listing fails in anvilbox (#5096) #6919
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6919 +/- ##
===========================================
- Coverage 85.68% 85.66% -0.02%
===========================================
Files 148 148
Lines 21562 21566 +4
===========================================
Hits 18475 18475
- Misses 3087 3091 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d651b26
to
0efb3eb
Compare
test/integration_test.py
Outdated
paged_snapshots = self._public_tdr_client.snapshot_names_by_id() | ||
snapshots = self._public_tdr_client.snapshot_names_by_id() | ||
self.assertEqual(snapshots, paged_snapshots) | ||
deployment_specific_prefix_filter = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a substring filter, not a prefix filter.
deployment_specific_prefix_filter = { | |
# Without a filter, the test takes so long that there's a real risk of | |
# failure due to new snapshots being added mid-test | |
snapshot_filters_by_deployment = { |
test/integration_test.py
Outdated
Test with minimal page sizes (1, 2) and a subset of deployment-specific | ||
snapshots (obtain via a filtered request). To make sure paging works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too much detail IMO. I moved the 2nd half to an inline comment.
Test with minimal page sizes (1, 2) and a subset of deployment-specific | |
snapshots (obtain via a filtered request). To make sure paging works. | |
Test with small page sizes to make sure paging works. |
0efb3eb
to
e812d4b
Compare
6cb51b3
to
ef62937
Compare
56c0316
to
0184141
Compare
Security design review
|
6fb1b84
to
3624370
Compare
Previous code owner approval is now ineffective. Assigned active code owner for re-approval. |
test/integration_test.py
Outdated
with self.subTest(page_size=page_size): | ||
with mock.patch.object(TDRClient, 'page_size', page_size): | ||
paged_snapshots = self._public_tdr_client.snapshot_names_by_id() | ||
self.assertGreater(1, self._public_tdr_client.page_size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test does not pass when I check out this commit. We just patched the page size to be 1
, so it makes no sense to assert that it's greater than 1:
2025-03-03 20:53:55,622 INFO MainThread test.integration_test: Failed sub-test [None] {'page_size': 1}
SubTest failure: Traceback (most recent call last):
File "/home/nadove/.pyenv/versions/3.12.9/lib/python3.12/unittest/case.py", line 58, in testPartExecutor
yield
File "/home/nadove/.pyenv/versions/3.12.9/lib/python3.12/unittest/case.py", line 539, in subTest
yield
File "/home/nadove/PycharmProjects/azul-sc/test/integration_test.py", line 363, in subTest
yield
File "/home/nadove/PycharmProjects/azul-sc/test/integration_test.py", line 395, in test_snapshot_listing
self.assertGreater(1, self._public_tdr_client.page_size)
AssertionError: 1 not greater than 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @hannes-ucsc's feedback
I also think we should assert the number of pages to be greater than 1
has not been implemented here. I think this code erroneously asserts that the page size is > 1 instead of asserting that the page count is > 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To that end:
Subject: [PATCH] REVIEW
---
Index: test/integration_test.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/test/integration_test.py b/test/integration_test.py
--- a/test/integration_test.py (revision b829c3bc23a76f05f0a123bb5e0771d3f42af607)
+++ b/test/integration_test.py (date 1741064353322)
@@ -392,7 +392,7 @@
with self.subTest(page_size=page_size):
with mock.patch.object(TDRClient, 'page_size', page_size):
paged_snapshots = self._public_tdr_client.snapshot_names_by_id()
- self.assertGreater(1, self._public_tdr_client.page_size)
+ self.assertGreater(len(paged_snapshots), page_size)
snapshots = self._public_tdr_client.snapshot_names_by_id()
self.assertEqual(snapshots, paged_snapshots)
We can't directly observe the page count from outside the method, but this assertion proves that multiple pages were fetched via the pigeonhole principle.
test/integration_test.py
Outdated
self.assertGreater(len(paged_snapshots), 0) | ||
snapshots = self._tdr_client.snapshot_names_by_id(filter=filter) | ||
self.assertLess(len(snapshots), 20) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we assert that the lists are equal, it's a bit confusing to make separate assertions about their sizes. I believe this simplifies to:
self.assertGreater(len(paged_snapshots), 0) | |
snapshots = self._tdr_client.snapshot_names_by_id(filter=filter) | |
self.assertLess(len(snapshots), 20) | |
snapshots = self._tdr_client.snapshot_names_by_id(filter=filter) | |
self.assertIn(len(snapshots), range(1, 20)) |
3624370
to
752353d
Compare
with mock.patch.object(TDRClient, 'page_size', page_size): | ||
paged_snapshots = self._tdr_client.snapshot_names_by_id(filter=filter) | ||
snapshots = self._tdr_client.snapshot_names_by_id(filter=filter) | ||
self.assertIn(len(snapshots), range(1, 20)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed my mind about using range
for this check, because I think the lower bound should be higher:
self.assertIn(len(snapshots), range(1, 20)) | |
self.assertLess(len(snapshots), 20) | |
# This proves that multiple pages were fetched via the pigeonhole principle | |
self.assertGreater(len(snapshots), page_size) |
Connected issues: #5096
Checklist
Author
develop
issues/<GitHub handle of author>/<issue#>-<slug>
1 when the issue title describes a problem, the corresponding PR
title is
Fix:
followed by the issue titleAuthor (partiality)
p
tag to titles of partial commitspartial
or completely resolves all connected issuespartial
labelAuthor (chains)
base
or this PR is not chained to another PRchained
or is not chained to another PRAuthor (reindex, API changes)
r
tag to commit title or the changes introduced by this PR will not require reindexing of any deploymentreindex:dev
or the changes introduced by it will not require reindexing ofdev
reindex:anvildev
or the changes introduced by it will not require reindexing ofanvildev
reindex:anvilprod
or the changes introduced by it will not require reindexing ofanvilprod
reindex:prod
or the changes introduced by it will not require reindexing ofprod
reindex:partial
and its description documents the specific reindexing procedure fordev
,anvildev
,anvilprod
andprod
or requires a full reindex or carries none of the labelsreindex:dev
,reindex:anvildev
,reindex:anvilprod
andreindex:prod
API
or this PR does not modify a REST APIa
(A
) tag to commit title for backwards (in)compatible changes or this PR does not modify a REST APIapp.py
or this PR does not modify a REST APIAuthor (upgrading deployments)
make docker_images.json
and committed the resulting changes or this PR does not modifyazul_docker_images
, or any other variables referenced in the definition of that variableu
tag to commit title or this PR does not require upgrading deploymentsupgrade
or does not require upgrading deploymentsdeploy:shared
or does not modifydocker_images.json
, and does not require deploying theshared
component for any other reasondeploy:gitlab
or does not require deploying thegitlab
componentdeploy:runner
or does not require deploying therunner
imageAuthor (hotfixes)
F
tag to main commit title or this PR does not include permanent fix for a temporary hotfixanvilprod
andprod
) have temporary hotfixes for any of the issues connected to this PRAuthor (before every review)
develop
, squashed old fixupsmake requirements_update
or this PR does not modifyrequirements*.txt
,common.mk
,Makefile
andDockerfile
R
tag to commit title or this PR does not modifyrequirements*.txt
reqs
or does not modifyrequirements*.txt
make integration_test
passes in personal deployment or this PR does not modify functionality that could affect the IT outcomePeer reviewer (after approval)
System administrator (after approval)
demo
orno demo
no demo
no sandbox
N reviews
label is accurateOperator (before pushing merge the commit)
reindex:…
labels andr
commit title tagno demo
develop
_select dev.shared && CI_COMMIT_REF_NAME=develop make -C terraform/shared apply_keep_unused
or this PR is not labeleddeploy:shared
_select dev.gitlab && CI_COMMIT_REF_NAME=develop make -C terraform/gitlab apply
or this PR is not labeleddeploy:gitlab
_select anvildev.shared && CI_COMMIT_REF_NAME=develop make -C terraform/shared apply_keep_unused
or this PR is not labeleddeploy:shared
_select anvildev.gitlab && CI_COMMIT_REF_NAME=develop make -C terraform/gitlab apply
or this PR is not labeleddeploy:gitlab
deploy:gitlab
deploy:gitlab
System administrator
dev.gitlab
are complete or this PR is not labeleddeploy:gitlab
anvildev.gitlab
are complete or this PR is not labeleddeploy:gitlab
Operator (before pushing merge the commit)
_select dev.gitlab && make -C terraform/gitlab/runner
or this PR is not labeleddeploy:runner
_select anvildev.gitlab && make -C terraform/gitlab/runner
or this PR is not labeleddeploy:runner
sandbox
label or PR is labeledno sandbox
dev
or PR is labeledno sandbox
anvildev
or PR is labeledno sandbox
sandbox
deployment or PR is labeledno sandbox
anvilbox
deployment or PR is labeledno sandbox
sandbox
deployment or PR is labeledno sandbox
anvilbox
deployment or PR is labeledno sandbox
sandbox
or this PR does not remove catalogs or otherwise causes unreferenced indices indev
anvilbox
or this PR does not remove catalogs or otherwise causes unreferenced indices inanvildev
sandbox
or this PR is not labeledreindex:dev
anvilbox
or this PR is not labeledreindex:anvildev
sandbox
or this PR is not labeledreindex:dev
anvilbox
or this PR is not labeledreindex:anvildev
p
if the PR is also labeledpartial
Operator (chain shortening)
develop
or this PR is not labeledbase
chained
label from the blocked PR or this PR is not labeledbase
base
base
label from this PR or this PR is not labeledbase
Operator (after pushing the merge commit)
dev
anvildev
dev
dev
anvildev
anvildev
_select dev.shared && make -C terraform/shared apply
or this PR is not labeleddeploy:shared
_select anvildev.shared && make -C terraform/shared apply
or this PR is not labeleddeploy:shared
dev
anvildev
Operator (reindex)
dev
or this PR is neither labeledreindex:partial
norreindex:dev
anvildev
or this PR is neither labeledreindex:partial
norreindex:anvildev
dev
or this PR is neither labeledreindex:partial
norreindex:dev
anvildev
or this PR is neither labeledreindex:partial
norreindex:anvildev
dev
or this PR is neither labeledreindex:partial
norreindex:dev
anvildev
or this PR is neither labeledreindex:partial
norreindex:anvildev
dev
or this PR does not require reindexingdev
anvildev
or this PR does not require reindexinganvildev
dev
or this PR does not require reindexingdev
anvildev
or this PR does not require reindexinganvildev
dev
or this PR does not require reindexingdev
anvildev
or this PR does not require reindexinganvildev
dev
or this PR does not require reindexingdev
dev
or this PR does not require reindexingdev
deploy_browser
job in the GitLab pipeline for this PR indev
or this PR does not require reindexingdev
anvildev
or this PR does not require reindexinganvildev
deploy_browser
job in the GitLab pipeline for this PR inanvildev
or this PR does not require reindexinganvildev
Operator
deploy:shared
,deploy:gitlab
,deploy:runner
,API
,reindex:partial
,reindex:anvilprod
andreindex:prod
labels to the next promotion PRs or this PR carries none of these labelsdeploy:shared
,deploy:gitlab
,deploy:runner
,API
,reindex:partial
,reindex:anvilprod
andreindex:prod
labels, from the description of this PR to that of the next promotion PRs or this PR carries none of these labelsShorthand for review comments
L
line is too longW
line wrapping is wrongQ
bad quotesF
other formatting problem