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

ENT-2740 | Flaky tests due to UNIQUE constraint failed on enterprise_enterprisecourseenrollment.id #23592

Merged
merged 1 commit into from
Apr 3, 2020

Conversation

HammadAhmadWaqas
Copy link
Member

fixing flakiness of tests due to redundant id created by faker.

@HammadAhmadWaqas HammadAhmadWaqas requested a review from a team April 3, 2020 07:55
@edx-status-bot
Copy link

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
Copy link
Member Author

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)
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

@ziafazal ziafazal left a comment

Choose a reason for hiding this comment

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

👍

@HammadAhmadWaqas HammadAhmadWaqas merged commit 7bd3900 into master Apr 3, 2020
@HammadAhmadWaqas HammadAhmadWaqas deleted the hammad/ENT-2740 branch April 3, 2020 09:22
@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants