discourse/spec/services/problem_check
Ted Johansson d446cc7318
FIX: Fix scheduled targeted problem checks (#35696)
Scheduled problem checks with multiple targets are not honouring the
`run_every` configuration.

For checks with multiple targets, all targets are checked in a single
instance of the problem check. However, we have one problem check
tracker per target.

This mismatch results in the `#ready_to_run?` method always creating a
tracker with no target when being checked.

This commit fixes that by:

**Expect checks to operate on a single target.**

This change makes it so that instances of a `ProblemCheck` class are
initialized with a target. So instead of 1-N we now have an N-N
relationship between checks and trackers.

Each instance can access their `target` through an attribute of the same
name.

This also means problem checks are back to returning a singular
`Problem` or `nil`, instead of `[Problem]` or `[]`.

For scheduled checks, this means that `ScheduleProblemChecks` now
enqueues `N` jobs (where `N` is the number of targets) per check instead
of `1` job per check.

**Update existing targeted checks to operate on a single target.**

This is essentially just removing the loop inside the check.
2025-11-10 10:09:14 +08:00
..
email_polling_errored_recently_spec.rb
facebook_config_spec.rb
failing_emails_spec.rb
force_https_spec.rb FIX: Fix scheduled targeted problem checks (#35696) 2025-11-10 10:09:14 +08:00
github_config_spec.rb
google_analytics_version_spec.rb
google_oauth2_config_spec.rb
group_email_credentials_spec.rb FIX: Fix scheduled targeted problem checks (#35696) 2025-11-10 10:09:14 +08:00
host_names_spec.rb
image_magick_spec.rb
maxmind_db_configuration_spec.rb DEV: Database backed admin notices (#26192) 2024-05-23 09:29:08 +08:00
missing_mailgun_api_key_spec.rb FIX: Amend broken Mailgun API key check (#26206) 2024-03-18 09:10:30 +10:00
out_of_date_themes_spec.rb
rails_env_spec.rb
ram_spec.rb
s3_backup_config_spec.rb
s3_cdn_spec.rb
s3_upload_config_spec.rb
sidekiq_check_spec.rb DEV: Promote block problem checks to ProblemCheck (#26193) 2024-03-20 08:52:25 +08:00
starttls_disabled_spec.rb FIX: actually disable SMTP starttls if the user is attempting to disable it 2025-11-04 23:42:14 -05:00
subfolder_ends_in_slash_spec.rb
translation_overrides_spec.rb DEV: Catch missing translations during test runs (#26258) 2024-05-24 22:15:53 +08:00
twitter_config_spec.rb
twitter_login_spec.rb
unreachable_themes_spec.rb
upcoming_change_stable_opted_out_spec.rb FIX: Fix scheduled targeted problem checks (#35696) 2025-11-10 10:09:14 +08:00
watched_words_spec.rb