Bug #16791
closed[API] flaky test case use_ownership_and_permission_links_to_determine_which_logs_a_user_can_see
Description
Example from developer-run-tests-services-api: #2148 /console
LogTest#test_use_ownership_and_permission_links_to_determine_which_logs_a_user_can_see = 0.01 s = E ... LogTest#test_use_ownership_and_permission_links_to_determine_which_logs_a_user_can_see: ActiveRecord::RecordNotFound: Couldn't find Log with 'id'=2 test/unit/log_test.rb:277:in `block in assert_log_result' test/unit/log_test.rb:276:in `each' test/unit/log_test.rb:276:in `assert_log_result' test/unit/log_test.rb:255:in `block in <class:LogTest>'
Updated by Lucas Di Pentima over 4 years ago
- Target version changed from 2020-09-09 Sprint to 2020-09-23 Sprint
- Assigned To set to Lucas Di Pentima
Updated by Lucas Di Pentima over 4 years ago
- Status changed from New to In Progress
Updated by Lucas Di Pentima over 4 years ago
Updates at 8503c026e - branch 16791-api-flaky-test-fix
- developer-run-tests-services-api: #2198
- developer-run-tests-services-api: #2199
- developer-run-tests-services-api: #2200
- developer-run-tests-services-api: #2201
- developer-run-tests-services-api: #2202
Log fixtures lacking the created_at
field set in the past in combination with incorrect testing made us believe all tests at LogTest
were working ok.
Specifically, LogTest#test_delete_old_audit_logs_in_thread
was not doing the waiting for the log entries to be eliminated, so there was a race between the AuditLogs
thread cleaning the records and the test teardown doing the rollback, producing the intermittent failure of LogTest#use_ownership_and_permission_links_to_determine_which_logs_a_user_can_see
.
I think this is just a testing bug, unless we should be checking the event_at
field when deleting old logs.
The flaky test wasn't showing up previous to the rails upgrade because we were explicitly rolling back the deletions after finishing the test but now that all threads share the same db connection when running tests, it's already taken care of.
Updated by Lucas Di Pentima over 4 years ago
On an additional note: It never failed when running only the LogTest suite probably because it didn't pass more than 20 seconds between the database is seeded and the test is run, so the logs were never deleted.
Updated by Anonymous about 4 years ago
- % Done changed from 0 to 100
- Status changed from In Progress to Resolved
Applied in changeset arvados|625076c05698e37beb732850dc01248be9dbe7f6.