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 dual_run command #112

Closed
wants to merge 1 commit into from
Closed

Add dual_run command #112

wants to merge 1 commit into from

Conversation

arielj
Copy link

@arielj arielj commented Oct 5, 2023

Description

This PR fixes #111

We can now run the same command in the two versions in parallel, like: dual_run bundle exec rspec spec/models.

The output of that in a project would be this for example:

Running in parallel:
BUNDLE_GEMFILE=Gemfile.next bundle exec rspec spec/models/
bundle exec rspec spec/models/

next results
================================================================================

Randomized with seed 41263
...................

Finished in 0.25773 seconds (files took 4.02 seconds to load)
19 examples, 0 failures

Randomized with seed 41263




(waiting for current command to finish)
current results
================================================================================

Randomized with seed 40666
...................

Finished in 0.23505 seconds (files took 3.96 seconds to load)
19 examples, 0 failures

Randomized with seed 40666

Motivation and Context

This command solves 2 problems:

  • we can run the same test for example in parallel instead of sequentially, to save time
  • we can run them in the same terminal

How Has This Been Tested?

To test this, you can add this branch as a gem in the Gemfile:

gem "next_rails", github: "fastruby/next_rails", branch: "add-dual-run-command"

Then bundle both:

bundle update next_rails
BUNDLE_GEMFILE=Gemfile.next bundle update next_rails

Now, in the root of the project, the dual_run command should be available:

dual_run bundle exec rspec spec/models

I'm not really sure how would I test this with automated tests.

I will abide by the code of conduct

@arielj arielj requested a review from etagwerker October 5, 2023 14:47
@arielj arielj changed the title Add dual_run executable Add dual_run command Oct 5, 2023

puts "Running in parallel:"
puts "BUNDLE_GEMFILE=Gemfile.next #{command}"
puts command
Copy link
Member

@JuanVqz JuanVqz Nov 29, 2023

Choose a reason for hiding this comment

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

@arielj Probably we don't need to print the command twice, it was printed in the line before, what about to print it on each block.

Like so:

Running in parallel:

next results
BUNDLE_GEMFILE=Gemfile.next bundle exec rspec spec/models/
================================================================================

Randomized with seed 41263
...................

Finished in 0.25773 seconds (files took 4.02 seconds to load)
19 examples, 0 failures

Randomized with seed 41263




(waiting for current command to finish)
current results
BUNDLE_GEMFILE=Gemfile bundle exec rspec spec/models/
================================================================================

Randomized with seed 40666
...................

Finished in 0.23505 seconds (files took 3.96 seconds to load)
19 examples, 0 failures

Randomized with seed 40666

@JuanVqz
Copy link
Member

JuanVqz commented Nov 29, 2023

This seems useful, I'll have a look soon, thanks for contributing 🚀

Should we modify the changelog?

@JuanVqz
Copy link
Member

JuanVqz commented Nov 30, 2023

@arielj, I followed How Has This Been Tested? steps to set it up but I got the following:

(venv) ➜  fastruby.io git:(BLOG-283) ✗ dual_run bundle exec rspec spec/models
zsh: command not found: dual_run

@etagwerker
Copy link
Member

Closing it due to inactivity

@etagwerker etagwerker closed this Sep 24, 2024
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.

[REQUEST] Add a dual-run command to run a single command with both versions
3 participants