Bug #16791
closed
[API] flaky test case use_ownership_and_permission_links_to_determine_which_logs_a_user_can_see
Added by Tom Clegg over 4 years ago.
Updated about 4 years ago.
Estimated time:
(Total: 0.00 h)
Release relationship:
Auto
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>'
- Assigned To set to Lucas Di Pentima
- Target version changed from 2020-09-09 Sprint to 2020-09-23 Sprint
- Status changed from New to In Progress
Updates at 8503c026e - branch 16791-api-flaky-test-fix
Test runs:
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.
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.
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
Also available in: Atom
PDF