-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
ENT-2740 | Flaky tests due to UNIQUE constraint failed on enterprise_enterprisecourseenrollment.id #23592
Conversation
Your PR has finished running tests. There were no failures. |
@@ -71,6 +71,5 @@ class Meta(object): | |||
|
|||
model = EnterpriseCourseEnrollment | |||
|
|||
id = factory.LazyAttribute(lambda x: FAKER.random_int(min=1)) # pylint: disable=no-member |
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.
FAKER.random_int(min=1)
can generate redundant numbers.
we do not need to fake id
as it is an auto-generated field.
@@ -74,7 +73,10 @@ def test_command(self, mock_create_manual_enrollment_orders): | |||
output | |||
) | |||
) | |||
self.assertEqual(mock_create_manual_enrollment_orders.call_count, 4) # batch of 4 (10, 10, 10, 2) |
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.
@HammadAhmadWaqas why this assertion was not failing earlier?
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.
@ziafazal
we were generating id's for the enterprise_course_enrollment with random numbers so invalid enrollments were mixed some other batches.
Now we are not generating Ids randomly so Ids are already sorted and the last 2 records will be always invalid one.
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.
👍
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
EdX Release Notice: This PR has been deployed to the production environment. |
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
EdX Release Notice: This PR has been deployed to the production environment. |
fixing flakiness of tests due to redundant id created by
faker
.