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

Testing race condition #438

Closed
cmeiklejohn opened this Issue Jul 6, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@cmeiklejohn
Contributor

cmeiklejohn commented Jul 6, 2012

Downloads are created in the database with a particular count, but the sort on output is based off of the redis download key, which returns zero, this leads to an array of zeros being sorted, which leads to unpredictable results.

 1) Failure:
test: when logged in on GET to show should assign the extra gems you own. (ProfilesControllerTest) [/Users/cmeiklejohn/Repositories/rubygems.org/test/functional/profiles_controller_test.rb:41]:
<[#<Rubygem id: 697, name: "RubyGem267", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 0, slug: nil>]> expected but was
<[#<Rubygem id: 707, name: "RubyGem277", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 1000, slug: nil>]>.

  2) Failure:
test: when logged in on GET to show should assign the last 10 most downloaded gems. (ProfilesControllerTest) [/Users/cmeiklejohn/Repositories/rubygems.org/test/functional/profiles_controller_test.rb:38]:
<[#<Rubygem id: 718, name: "RubyGem288", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 1000, slug: nil>,
 #<Rubygem id: 717, name: "RubyGem287", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 900, slug: nil>,
 #<Rubygem id: 716, name: "RubyGem286", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 800, slug: nil>,
 #<Rubygem id: 715, name: "RubyGem285", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 700, slug: nil>,
 #<Rubygem id: 714, name: "RubyGem284", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 600, slug: nil>,
 #<Rubygem id: 713, name: "RubyGem283", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 500, slug: nil>,
 #<Rubygem id: 712, name: "RubyGem282", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 400, slug: nil>,
 #<Rubygem id: 711, name: "RubyGem281", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 300, slug: nil>,
 #<Rubygem id: 710, name: "RubyGem280", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 200, slug: nil>,
 #<Rubygem id: 709, name: "RubyGem279", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 100, slug: nil>]> expected but was
<[#<Rubygem id: 708, name: "RubyGem278", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 0, slug: nil>,
 #<Rubygem id: 709, name: "RubyGem279", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 100, slug: nil>,
 #<Rubygem id: 710, name: "RubyGem280", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 200, slug: nil>,
 #<Rubygem id: 711, name: "RubyGem281", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 300, slug: nil>,
 #<Rubygem id: 712, name: "RubyGem282", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 400, slug: nil>,
 #<Rubygem id: 713, name: "RubyGem283", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 500, slug: nil>,
 #<Rubygem id: 714, name: "RubyGem284", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 600, slug: nil>,
 #<Rubygem id: 715, name: "RubyGem285", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 700, slug: nil>,
 #<Rubygem id: 716, name: "RubyGem286", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 800, slug: nil>,
 #<Rubygem id: 717, name: "RubyGem287", created_at: "2012-07-06 02:44:33", updated_at: "2012-07-06 02:44:33", downloads: 900, slug: nil>]>.

457 tests, 739 assertions, 2 failures, 0 errors, 0 skips
@jaredonline

This comment has been minimized.

Show comment
Hide comment
@jaredonline

jaredonline Nov 4, 2012

Contributor

@mildmojo and @jaredmcfarland are gonna work on this atm.

Contributor

jaredonline commented Nov 4, 2012

@mildmojo and @jaredmcfarland are gonna work on this atm.

@cmeiklejohn

This comment has been minimized.

Show comment
Hide comment
@cmeiklejohn

cmeiklejohn Nov 4, 2012

Contributor

Closed by #474.

Contributor

cmeiklejohn commented Nov 4, 2012

Closed by #474.

@cmeiklejohn cmeiklejohn closed this Nov 4, 2012

arthurnn pushed a commit that referenced this issue Jan 29, 2015

Issue #438
There wasn't actually a real race condition, the test just wasn't using
the proper factory. Worked with @mildmojo on the ID and fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment