Skip to content

Add tests for Sidekiq top-level public API and Config#logger=#7037

Merged
mperham merged 1 commit into
sidekiq:mainfrom
hammadxcm:test-sidekiq-top-level-api
Jun 12, 2026
Merged

Add tests for Sidekiq top-level public API and Config#logger=#7037
mperham merged 1 commit into
sidekiq:mainfrom
hammadxcm:test-sidekiq-top-level-api

Conversation

@hammadxcm

Copy link
Copy Markdown
Contributor

Summary

Four cohesive tests for top-level Sidekiq / Config public API contracts, spanning two test files since the contract spans the two corresponding lib files:

test/sidekiq_test.rb:

  • Sidekiq.testing!(:bogus) raises with "Unknown testing mode: bogus" before requiring sidekiq/test_api (the mode-validation contract that gives users a useful error rather than a cryptic load failure).
  • Sidekiq.strict_args! updates Sidekiq::Config::DEFAULTS[:on_complex_arguments] through false / :warn / :raise (the default), restoring the original in ensure.
  • Sidekiq.pro? / .ent? / .server? are defined?-checks: nil in the OSS test suite; defining a stub Sidekiq::Pro makes .pro? truthy.

test/config_test.rb:

  • Config#logger= with nil keeps the existing logger instance but raises its level to FATAL — the documented "silence the logger" contract (so cfg.logger = nil doesn't blow up downstream code that calls logger.info).

Test-only, no lib/ changes.

Testing

bundle exec rake is green (standard + lint:herb + full suite).

Four cohesive tests for top-level Sidekiq / Config public API
contracts, naturally spanning two files since the contract spans the
two:

test/sidekiq_test.rb:
- Sidekiq.testing!(:bogus) raises with 'Unknown testing mode: bogus'
  before requiring sidekiq/test_api (the mode-validation contract).
- Sidekiq.strict_args! updates Sidekiq::Config::DEFAULTS[:on_complex_arguments]
  through false / :warn / :raise (the default), restoring the original
  value in ensure.
- Sidekiq.pro? / .ent? / .server? are defined-checks: nil in OSS test
  suite; defining a stub Sidekiq::Pro makes .pro? truthy.

test/config_test.rb:
- Config#logger= nil keeps the existing logger instance but raises its
  level to FATAL (the documented 'silence the logger' contract).
@hammadxcm hammadxcm force-pushed the test-sidekiq-top-level-api branch from 32dca36 to b25775d Compare June 12, 2026 11:28
@mperham mperham merged commit b9e9fc1 into sidekiq:main Jun 12, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants