Project

General

Profile

Actions

Patch #43130

closed

Fix random test failures by calling Setting.clear_cache after all tests

Added by Katsuya HIDAKA 1 day ago. Updated about 5 hours ago.

Status:
Closed
Priority:
Normal
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

This patch fixes random test failures that happen because Settings state is not consistent when tests start.

It's likely that random test failures like the ones below are caused by a Settings cache from previous tests affecting the current test.

https://github.com/redmine/redmine/actions/runs/16861987913/job/47763524042

Failure:
MenuManagerTest#test_cross_project_menu_should_hide_item_if_module_is_not_enabled_for_any_project [test/integration/lib/redmine/menu_manager_test.rb:144]:
Expected at least 1 element matching "#projects-index", found 0.
Expected 0 to be >= 1.

bin/rails test test/integration/lib/redmine/menu_manager_test.rb:123

https://github.com/hidakatsuya/redmine/actions/runs/16886193502/job/47834442073

ailure:
NewsControllerTest#test_show [test/functional/news_controller_test.rb:78]:
Expected: "JS eCookbook first release !" 
Actual: "eCookbook first release !".
Expected 0 to be >= 1.

bin/rails test test/functional/news_controller_test.rb:74

This patch ensures Setting.clear_cache is run after every test completes. It's believed that no tests require the previous setting state.

I have verified that all tests are passing consistently over at least three runs.


Files

Actions #1

Updated by Marius BĂLTEANU about 20 hours ago

  • Status changed from New to Resolved
  • Assignee set to Marius BĂLTEANU
  • Target version set to 6.1.0

Committed, thanks!

Actions #2

Updated by Marius BĂLTEANU about 5 hours ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF