discourse/spec/integration
Alan Guo Xiang Tan 6bf0ac730f
FIX: Rescue ActiveRecord::ReadOnlyError when baking theme field (#29776)
Firstly, we need to understand that ActiveRecord can be
connected to a role which prevent writes and this happens in Discourse when a
replica database has been setup for failover purposes. When a role
prevent writes from happening, ActiveRecord will raise the
`ActiveRecord::ReadOnlyError` if a write query is attempted.

Secondly, theme fields are baked at runtime within GET requests. The
baking process involves writing the baked value to the
`ThemeField#baked_value` column in the database.

If we combine the two points above, we can see how the writing of the
baked value to the database will trigger a `ActiveRecord::ReadOnlyError`
in a GET requests when the database is connected to a role preventing
writes. However, failing to bake a theme is not the end of the world and
should not cause GET requests to fail. Therefore, this commit adds a rescue
for `ActiveRecord::ReadOnlyError` in the `ThemeField#ensure_baked!`
method.
2024-11-15 10:19:10 +08:00
..
activerecord_preventing_writes_spec.rb FIX: Rescue ActiveRecord::ReadOnlyError when baking theme field (#29776) 2024-11-15 10:19:10 +08:00
api_keys_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
auto_reject_reviewable_users_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
blocked_hotlinked_media_spec.rb DEV: Prevent videos from preloading metadata (#23807) 2023-10-12 13:47:48 -06:00
category_tag_spec.rb DEV: Convert min_trust_level_to_tag_topics to groups (#25273) 2024-01-26 13:25:03 +08:00
content_security_policy_spec.rb DEV: remove legacy CSP implementation to make strict-dynamic only accepted behaviour (#27486) 2024-06-18 16:40:53 +08:00
discord_omniauth_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
email_outbound_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
email_style_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
facebook_omniauth_spec.rb DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
flags_spec.rb DEV: Automatically update groups for test users with explicit TL (#25415) 2024-01-29 17:52:02 +08:00
github_omniauth_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
group_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
invalid_request_spec.rb DEV: Enable Rails 7.1 defaults 2024-08-12 10:41:13 +02:00
invite_only_registration_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
message_bus_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
multisite_cookies_spec.rb Revert "DEV: Migrate existing cookies to Rails 7 format" 2023-01-12 12:07:49 +01:00
multisite_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
rate_limiting_spec.rb DEV: Call Discourse.redis.flushdb after the end of each test (#29117) 2024-10-09 07:19:31 +08:00
request_tracker_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
same_ip_spammers_spec.rb DEV: Automatically update groups for test users with explicit TL (#25415) 2024-01-29 17:52:02 +08:00
secure_uploads_spec.rb Revert "FIX: Post uploads setting access_control_post_id unnecessarily (#26627)" (#26643) 2024-04-16 14:10:25 +10:00
smtp_spec.rb DEV: Attempt to fix a flaky spec (#29155) 2024-10-10 17:19:53 +08:00
spam_rules_spec.rb DEV: Automatically update groups for test users with explicit TL (#25415) 2024-01-29 17:52:02 +08:00
tag_counts_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
topic_auto_close_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
topic_thumbnail_spec.rb DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
twitter_omniauth_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
watched_words_spec.rb DEV: Automatically update groups for test users with explicit TL (#25415) 2024-01-29 17:52:02 +08:00