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

fix flaky test ordering #2427

Merged
merged 6 commits into from
Oct 24, 2024
Merged

fix flaky test ordering #2427

merged 6 commits into from
Oct 24, 2024

Conversation

cp-at-mit
Copy link
Contributor

What are the relevant tickets?

NA

Description (What does it do?)

Fixes a flaky test that has delayed deployments. The fix is done by ordering the items in the unit test to ensure that the lists are compared equally.

How can this be tested?

Tests should pass.

@cp-at-mit cp-at-mit marked this pull request as ready for review October 23, 2024 17:28
assert set(Product.objects.all().order_by("id")) == set(active_products)
assert set(Product.all_objects.all().order_by("id")) == set(
inactive_products + active_products
)
Copy link
Contributor

Choose a reason for hiding this comment

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

This works but I think if we are ordering the Product.objects.all().order_by("id") then the list makes sense. Take it or leave it

assert list(Product.objects.all().order_by("id")) == list(active_products)
assert list(Product.all_objects.all().order_by("id")) == list(
      inactive_products + active_products
 )

@cp-at-mit cp-at-mit merged commit 367adc9 into main Oct 24, 2024
7 checks passed
@cp-at-mit cp-at-mit deleted the fix-flaky-test-ordering branch October 24, 2024 17:08
This was referenced Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants