From 4a2dd1c623b59a696d11c00542f847982d49618d Mon Sep 17 00:00:00 2001 From: AinaMerch Date: Fri, 28 Jun 2024 14:10:48 -0400 Subject: [PATCH 1/4] fixed flaky test --- spec/controllers/groups_controller_spec.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb index 6797251a96..be535b9650 100644 --- a/spec/controllers/groups_controller_spec.rb +++ b/spec/controllers/groups_controller_spec.rb @@ -444,7 +444,13 @@ params: { course_id: course.id, assignment_id: assignment.id }, format: 'js' - assert_enqueued_with(job: CreateGroupsJob, args: [assignment, data]) + expected_args = ->(job_args) do + assignment_arg, data_arg = job_args + expect(assignment_arg).to eq(assignment) + expect(data_arg).to match_array(data) + end + + assert_enqueued_with(job: CreateGroupsJob, args: expected_args) expect(flash[:error]).to be_blank end From 0426272b419d026110a7e181e5e461f43da81dfe Mon Sep 17 00:00:00 2001 From: AinaMerch Date: Thu, 11 Jul 2024 02:06:51 -0400 Subject: [PATCH 2/4] Testing attempt --- run_flaky_test.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 run_flaky_test.sh diff --git a/run_flaky_test.sh b/run_flaky_test.sh new file mode 100755 index 0000000000..ed9104a04a --- /dev/null +++ b/run_flaky_test.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Number of times to run the test +count=100 + +# Path to the test file and specific test +test_file="spec/controllers/groups_controller_spec.rb" +test_name="#create_groups_when_students_work_alone when assignment.group_max = 1 creates groups for individual students" + +for i in $(seq 1 $count) +do + echo "Running test iteration $i" + docker compose run --rm app bundle exec rspec $test_file -e "$test_name" + if [ $? -ne 0 ]; then + echo "Test failed on iteration $i" + exit 1 + fi +done + +echo "All $count iterations passed!" From a00161b0883c1a7622f02ff25f7cc14e74431070 Mon Sep 17 00:00:00 2001 From: AinaMerch Date: Fri, 12 Jul 2024 01:36:26 -0400 Subject: [PATCH 3/4] Removed bash script --- run_flaky_test.sh | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100755 run_flaky_test.sh diff --git a/run_flaky_test.sh b/run_flaky_test.sh deleted file mode 100755 index ed9104a04a..0000000000 --- a/run_flaky_test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# Number of times to run the test -count=100 - -# Path to the test file and specific test -test_file="spec/controllers/groups_controller_spec.rb" -test_name="#create_groups_when_students_work_alone when assignment.group_max = 1 creates groups for individual students" - -for i in $(seq 1 $count) -do - echo "Running test iteration $i" - docker compose run --rm app bundle exec rspec $test_file -e "$test_name" - if [ $? -ne 0 ]; then - echo "Test failed on iteration $i" - exit 1 - fi -done - -echo "All $count iterations passed!" From a25d3c3db04e29e037973bf189beba30b0c30bf0 Mon Sep 17 00:00:00 2001 From: AinaMerch Date: Fri, 12 Jul 2024 01:45:17 -0400 Subject: [PATCH 4/4] Updated Changelog --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index cf10b07602..d68d31e74a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -41,6 +41,7 @@ - Fix flaky `Assignment#summary_json` test (#7111) - Upgrade pdfjs-dist to v4.3.136 (#7113) - Switch from rails-sassc to cssbundling-rails for CSS asset management (#7121) +- Fixed flaky test #creates groups for individual students in groups_controller_spec (#7145) ## [v2.4.11]