[API] flaky test case use_ownership_and_permission_links_to_determine_which_logs_a_user_can_see
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>'
#3 Updated by Lucas Di Pentima over 1 year ago
Updates at 8503c026e - branch
- 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.
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
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.