Randomization seed not resetting with `--drb` #633

Closed
justinko opened this Issue Jun 12, 2012 · 7 comments

Projects

None yet

4 participants

@justinko
Contributor

No description provided.

@justinko
Contributor

This issue has also been reported in Spork: sporkrb/spork#173

Basically, the "seed" needs to get reset/changed between each run. This can happen in Spork if you do something like this:

# in spec_helper.rb
Spork.each_run do
  RSpec.configuration.seed = srand && srand % 0xFFFF # the double `srand` is because of this[1]
end

If we provide a method to reset the seed (RSpec.configuration.reset_seed), should Spork automatically do this for the user? If not, Spork would need to document this.

Thoughts? @fabn @mat813 @timcharper @nixme @dchelimsky @alindeman @myronmarston


1.) http://numbers.brighterplanet.com/2011/03/30/resque-the-rand-method-and-kernel-fork/

@justinko
Contributor

There is the option of being explicit and passing the --seed to DRb, but that smells a bit from a user perspective. If the user enters rspec --drb, they would see this in the "spork console":

Running tests with args ["--order", "rand:123"]...
Done.
@dchelimsky
Member

@justinko why do you find that smelly?

@justinko
Contributor

why do you find that smelly?

Because the user did not pass a seed; RSpec is doing it for them. It diverges from the behavior of RSpec when DRb is not in use - something we should try not to do, IMO.

If you think that is the right approach, I'll take it.

@dchelimsky
Member

I don't know that it's the right approach, but so far it's the simplest one.

@JonRowe
Member
JonRowe commented Apr 7, 2013

To me, Spork should be resetting the seed each run for the user if thats the desired behaviour, it's not RSpec's fault it's being held nailed up?

@myronmarston
Member

Closing as this is stale, the description has been lost and it's not clear if it's a bug in rspec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment