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 enrollment unit assignment test #34629

Merged
merged 4 commits into from May 6, 2020
Merged

Fix flaky enrollment unit assignment test #34629

merged 4 commits into from May 6, 2020

Conversation

dmcavoy
Copy link
Contributor

@dmcavoy dmcavoy commented May 5, 2020

This test has been flaky since I updated it #34133. I hit it locally and the output was:

==== FAIL["test_Enrolling_user_in_a_course_creates_other_assignment_objects", "Plc::EnrollmentUnitAssignmentTest", 893.7549107875675]
test_Enrolling_user_in_a_course_creates_other_assignment_objects#Plc::EnrollmentUnitAssignmentTest (893.75s)
--- expected
+++ actual
@@ -1 +1 @@
-[{:category=>"Content", :status=>:not_started, :link=>"/s/bogus-script-604#required"}, {:category=>"Content", :status=>:not_started, :link=>"/s/bogus-script-604#content"}, {:category=>"Content", :status=>:not_started, :link=>"/s/bogus-script-604#practice"}, {:category=>"Peer Review", :status=>:not_started, :link=>"/s/bogus-script-604#peer-review"}]
+[{:category=>"Content", :status=>:not_started, :link=>"/s/bogus-script-604#content"}, {:category=>"Content", :status=>:not_started, :link=>"/s/bogus-script-604#practice"}, {:category=>"Content", :status=>:not_started, :link=>"/s/bogus-script-604#required"}, {:category=>"Peer Review", :status=>:not_started, :link=>"/s/bogus-script-604#peer-review"}]
test/models/plc/enrollment_unit_assignment_test.rb:54:in `block in <class:EnrollmentUnitAssignmentTest>'
test/testing/setup_all_and_teardown_all.rb:22:in `run'

It looks like the same hash values just in different orders. So i think the fact that all the categories are the same might be the issue here. So instead I check the other fields individually.

@unit_enrollment.summarize_progress.map {|summary| summary[:link]}.sort

assert_equal [Plc::EnrollmentModuleAssignment::NOT_STARTED].sort,
@unit_enrollment.summarize_progress.map {|summary| summary[:status]}.uniq.sort
Copy link
Member

Choose a reason for hiding this comment

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

no need to sort this second pair of arrays, since the expected value has only one entry.

Copy link
Contributor

@islemaster islemaster left a comment

Choose a reason for hiding this comment

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

👍 Thanks for fixing a flaky test!

@dmcavoy dmcavoy merged commit 7c7f246 into staging May 6, 2020
@dmcavoy dmcavoy deleted the fix-plc-test branch May 6, 2020 19:42
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.

None yet

3 participants