Bug #16791

[API] flaky test case use_ownership_and_permission_links_to_determine_which_logs_a_user_can_see

Added by Tom Clegg about 1 year ago. Updated about 1 year ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
-
Target version:
Start date:
09/18/2020
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
Story points:
-
Release relationship:
Auto

Description

Example from https://ci.arvados.org/job/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>'

Subtasks

Task #16815: Review 16791-api-flaky-test-fixResolvedLucas Di Pentima

Associated revisions

Revision 625076c0
Added by Lucas Di Pentima about 1 year ago

Merge branch '16791-api-flaky-test-fix'
Closes #16791

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <>

History

#1 Updated by Lucas Di Pentima about 1 year ago

  • Target version changed from 2020-09-09 Sprint to 2020-09-23 Sprint
  • Assigned To set to Lucas Di Pentima

#2 Updated by Lucas Di Pentima about 1 year ago

  • Status changed from New to In Progress

#3 Updated by Lucas Di Pentima about 1 year ago

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.

#4 Updated by Lucas Di Pentima about 1 year 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.

#5 Updated by Tom Clegg about 1 year ago

LGTM, thanks!

#6 Updated by Anonymous about 1 year ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Resolved

#7 Updated by Peter Amstutz about 1 year ago

  • Release set to 25

Also available in: Atom PDF