Project

General

Profile

Actions

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 3 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
-
Target version:
Story points:
-
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>'

Subtasks 1 (0 open1 closed)

Task #16815: Review 16791-api-flaky-test-fixResolvedLucas Di Pentima09/18/2020Actions
Actions #1

Updated by Lucas Di Pentima over 3 years ago

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

Updated by Lucas Di Pentima over 3 years ago

  • Status changed from New to In Progress
Actions #3

Updated by Lucas Di Pentima over 3 years 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.

Actions #4

Updated by Lucas Di Pentima over 3 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.

Actions #5

Updated by Tom Clegg over 3 years ago

LGTM, thanks!

Actions #6

Updated by Anonymous over 3 years ago

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

Updated by Peter Amstutz over 3 years ago

  • Release set to 25
Actions

Also available in: Atom PDF