Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Testing race condition #438

Closed
cmeiklejohn opened this Issue · 2 comments

2 participants

@cmeiklejohn
Collaborator

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

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

@jaredonline jaredonline referenced this issue from a commit in jaredonline/rubygems.org
@jaredonline jaredonline 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.
cc4f726
@cmeiklejohn
Collaborator

Closed by #474.

@cmeiklejohn cmeiklejohn closed this
@arthurnn arthurnn referenced this issue from a commit
@jaredonline jaredonline 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.
fd8584a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.