Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLI Run Test - Write Pid, System Boot, Print Banner #4039

Merged
merged 5 commits into from Dec 7, 2018

Conversation

Tensho
Copy link
Contributor

@Tensho Tensho commented Dec 5, 2018

I tried to cover as much as I can in #run method with these changes. I'm still thinking how to test daemonized version...

Refactgoring

  • Extract Sidekiq::CLI#launch method to detach actual launcher start from the system preparations (write pid, boot system, print banner) to test in isolation
  • Cleanup test helper

Improvements

  • Add ultra-simple Rails application to spec/dummy for the Sidekiq::Rails engine integration test
  • Add appraisal to test sidekiq integration with different rails versions (ATM 4 and 5). Appraisals may be used to test either different versions of the sidekiq dependencies in the future.
  • Add minitest-focus
  • Add minitest-reporters for convenient work with the tests in RubyMine
  • Group gems in bundle

Related PRs

@Tensho Tensho force-pushed the sidekiq-cli-test-run branch 4 times, most recently from 5b39f09 to a15fb94 Compare December 5, 2018 16:43
@mperham
Copy link
Collaborator

mperham commented Dec 5, 2018

Don't got overboard on test coverage. The code doesn't change often and it's far easier to test manually once than to construct and maintain some really complicated test harness.

@Tensho
Copy link
Contributor Author

Tensho commented Dec 5, 2018

I just try to understand the code and learn that way, but generally I agree ^_^

@Tensho
Copy link
Contributor Author

Tensho commented Dec 5, 2018

@mperham Are you comfortable with "appraisals" presence?

@mperham
Copy link
Collaborator

mperham commented Dec 5, 2018

For now, sure. I will remove it if it becomes a problem.

@Tensho
Copy link
Contributor Author

Tensho commented Dec 6, 2018

@mperham Please let me know if you are fine with the current changes and commits history 🙇

lib/sidekiq/cli.rb Show resolved Hide resolved
lib/sidekiq/cli.rb Show resolved Hide resolved
test/helper.rb Show resolved Hide resolved
Sidekiq.logger.level = Logger::ERROR

REDIS_URL = ENV['REDIS_URL'] || 'redis://localhost/15'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want the test suite to use the default Redis localhost:6379/0

Copy link
Contributor Author

@Tensho Tensho Dec 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I may return back

ENV['REDIS_URL'] ||= 'redis://localhost/15'

or without customisation oportunity

ENV['REDIS_URL'] = 'redis://localhost/15'

That should be enough I guess. BTW, why 15? Is it kind of virtual host in RabbitMQ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, yeah, I want people's default redis database to be untouched by Sidekiq's test suite. We'll need to fix those tests (or make them read only)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already done this, Mike ^_^

@Tensho
Copy link
Contributor Author

Tensho commented Dec 6, 2018

@mperham Set REDIS_URL env var to redis://localhost/15 in test environment in ea48409

@Tensho
Copy link
Contributor Author

Tensho commented Dec 7, 2018

@mperham Addressed all your concerns I think. Let me know if there's anything else you can think of.

@mperham mperham merged commit ea9b34a into sidekiq:master Dec 7, 2018
@mperham
Copy link
Collaborator

mperham commented Dec 7, 2018

Thank you for this! I will add a changelog entry to give you credit.

@Tensho Tensho deleted the sidekiq-cli-test-run branch December 7, 2018 17:02
mperham added a commit that referenced this pull request Dec 7, 2018
@Tensho
Copy link
Contributor Author

Tensho commented Dec 7, 2018

@mperham Thank you 🙇 It's worth to note about ./test/dummy ultra-simple test Rails app somewhere (README, CONTRIBUTING), so other people don't mess with ./myapp one. It took me a while to understand myapp purpose is for manual testing (it has it's own dependencies declaration in Gemfile), not auto tests.

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.

None yet

2 participants