Run Setting.clear_cache after each test in order to decrease the number of random failing tests (#43130).

Patch by Katsuya HIDAKA (user:hidakatsuya).

git-svn-id: https://svn.redmine.org/redmine/trunk@23915 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2025-08-13 05:31:26 +00:00
parent 686c04dd85
commit 30880b861f
8 changed files with 5 additions and 34 deletions

View File

@@ -26,10 +26,6 @@ class ReactionsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = users(:users_002).id
end
teardown do
Setting.clear_cache
end
test 'create for issue' do
issue = issues(:issues_002)

View File

@@ -25,11 +25,6 @@ class SettingsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1 # admin
end
def teardown
Setting.delete_all
Setting.clear_cache
end
def test_index
get :index
assert_response :success

View File

@@ -25,10 +25,6 @@ class SysControllerTest < Redmine::ControllerTest
Setting.enabled_scm = %w(Subversion Git)
end
def teardown
Setting.clear_cache
end
def test_projects_with_repository_enabled
get :projects
assert_response :success

View File

@@ -27,10 +27,6 @@ class ReactionsHelperTest < ActionView::TestCase
Setting.reactions_enabled = '1'
end
teardown do
Setting.clear_cache
end
test 'reaction_id_for generates a DOM id' do
assert_equal "reaction_issue_1", reaction_id_for(issues(:issues_001))
end

View File

@@ -61,6 +61,11 @@ class ActiveSupport::TestCase
self.use_transactional_tests = true
self.use_instantiated_fixtures = false
# Clear Settings cache after each test to prevent test interference
teardown do
Setting.clear_cache
end
def uploaded_test_file(name, mime)
fixture_file_upload(name.to_s, mime, true)
end

View File

@@ -26,10 +26,6 @@ class Redmine::ReactionTest < ActiveSupport::TestCase
Setting.reactions_enabled = '1'
end
teardown do
Setting.clear_cache
end
test 'preload_reaction_details preloads ReactionDetail for all objects in the collection' do
User.current = users(:users_002)

View File

@@ -28,10 +28,6 @@ class MailHandlerTest < ActiveSupport::TestCase
User.current = nil
end
def teardown
Setting.clear_cache
end
def test_add_issue_with_specific_overrides
issue =
submit_email(

View File

@@ -24,15 +24,7 @@ class SettingTest < ActiveSupport::TestCase
User.current = nil
end
def teardown
Setting.delete_all
Setting.clear_cache
end
def test_read_default
Setting.delete_all
Setting.clear_cache
assert_equal "Redmine", Setting.app_title
assert Setting.self_registration?
assert !Setting.login_required?
@@ -127,7 +119,6 @@ class SettingTest < ActiveSupport::TestCase
assert_equal 'UTF-8', Setting.commit_update_keywords.first['keywords'].encoding.name
ensure
Setting.where(:name => 'commit_update_keywords').delete_all
Setting.clear_cache
end
def test_mail_from_format_should_be_validated