spec: fix sharding it_should_behave_like for rspec 2
Apparently the fact that a shared example group added its before/after filters to the outer context was a bug, and it's been fixed in rspec 2. So we can't use a shared example group to setup or mark pending sharding specs anymore. test plan: specs Change-Id: I92b022e2e7125214e6bad38bf0a23da547fca984 Reviewed-on: https://gerrit.instructure.com/19182 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Duane Johnson <duane@instructure.com> Reviewed-by: Jacob Fugal <jacob@instructure.com> Product-Review: Brian Palmer <brianp@instructure.com> QA-Review: Brian Palmer <brianp@instructure.com>
This commit is contained in:
parent
ec4673d332
commit
f5b017a259
|
@ -34,7 +34,7 @@ describe "API Authentication", :type => :integration do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should use developer key + basic auth access on the default shard from a different shard" do
|
||||
@shard1.activate do
|
||||
|
@ -319,7 +319,7 @@ describe "API Authentication", :type => :integration do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should create the access token on the same shard as the user" do
|
||||
user_with_pseudonym(:active_user => true, :username => 'test1@example.com', :password => 'test123')
|
||||
|
@ -506,7 +506,7 @@ describe "API Authentication", :type => :integration do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should work for an access token from a different shard with the developer key on the default shard" do
|
||||
@shard1.activate do
|
||||
|
|
|
@ -166,7 +166,7 @@ describe ConversationsController, :type => :integration do
|
|||
end
|
||||
|
||||
context "filtering by tags" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
before do
|
||||
@conversations = []
|
||||
|
@ -713,7 +713,7 @@ describe ConversationsController, :type => :integration do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
def check_conversation
|
||||
json = api_call(:get, "/api/v1/conversations/#{@conversation.conversation_id}",
|
||||
|
|
|
@ -451,7 +451,7 @@ describe SearchController, :type => :integration do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should find top-level groups from any shard" do
|
||||
@me.associate_with_shard(@shard1)
|
||||
|
|
|
@ -58,7 +58,7 @@ describe ContextController do
|
|||
end
|
||||
|
||||
describe 'across shards' do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it 'allows merged users from other shards to be referenced' do
|
||||
user1 = user_model
|
||||
|
|
|
@ -167,7 +167,7 @@ describe FilesController do
|
|||
end
|
||||
|
||||
describe 'across shards' do
|
||||
it_should_behave_like 'sharding'
|
||||
specs_require_sharding
|
||||
|
||||
before do
|
||||
@shard2.activate do
|
||||
|
|
|
@ -163,7 +163,7 @@ describe PseudonymSessionsController do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should login for a user from a different shard" do
|
||||
user_with_pseudonym(:username => 'jt@instructure.com', :active_all => 1, :password => 'qwerty', :account => Account.site_admin)
|
||||
|
|
|
@ -327,7 +327,7 @@ describe PseudonymsController do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
before do
|
||||
user_with_pseudonym(:active_all => 1)
|
||||
|
|
|
@ -503,7 +503,7 @@ describe UsersController do
|
|||
end
|
||||
|
||||
context 'across shards' do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it 'loads courses from all shards' do
|
||||
course_with_teacher_logged_in :active_all => true
|
||||
|
@ -669,7 +669,7 @@ describe UsersController do
|
|||
|
||||
describe "GET 'show'" do
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should include enrollments from all shards" do
|
||||
course_with_teacher(:active_all => 1)
|
||||
|
|
|
@ -35,7 +35,7 @@ describe SearchHelper do
|
|||
end
|
||||
|
||||
describe "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
before do
|
||||
@current_user = @shard1.activate{ user(:active_all => true) }
|
||||
|
|
|
@ -190,7 +190,7 @@ describe Api do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should find users from other shards" do
|
||||
@shard1.activate { @user2 = User.create! }
|
||||
|
|
|
@ -268,7 +268,7 @@ describe BasicLTI do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should roundtrip source ids from mixed shards" do
|
||||
@shard1.activate do
|
||||
|
|
|
@ -361,7 +361,7 @@ describe "MessageableUser::Calculator" do
|
|||
|
||||
describe "shard_cached" do
|
||||
describe "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should yield once for each of the user's associated shards" do
|
||||
@viewing_user.stubs(:associated_shards => [@shard1, @shard2])
|
||||
|
@ -464,7 +464,7 @@ describe "MessageableUser::Calculator" do
|
|||
end
|
||||
|
||||
describe "sharded and cached summaries" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
before do
|
||||
@account1 = @shard1.activate{ Account.create! }
|
||||
|
@ -886,7 +886,7 @@ describe "MessageableUser::Calculator" do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should work if the conversation's on another shard" do
|
||||
@shard1.activate{ conversation(@viewing_user, @bob) }
|
||||
|
@ -1039,7 +1039,7 @@ describe "MessageableUser::Calculator" do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should work with sections on different shards" do
|
||||
Enrollment.limit_privileges_to_course_section!(@course, @viewing_user, true)
|
||||
|
@ -1212,7 +1212,7 @@ describe "MessageableUser::Calculator" do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should properly interpret and translate exclude_ids" do
|
||||
@shard1.activate do
|
||||
|
|
|
@ -180,7 +180,7 @@ describe "MessageableUser" do
|
|||
end
|
||||
|
||||
describe "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should translate keys to the current shard" do
|
||||
user = MessageableUser.prepped(:common_course_column => @shard2.relative_id_for(1), :common_role_column => "'StudentEnrollment'").first
|
||||
|
@ -209,7 +209,7 @@ describe "MessageableUser" do
|
|||
end
|
||||
|
||||
describe "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should translate keys to the current shard" do
|
||||
user = MessageableUser.prepped(:common_group_column => @shard2.relative_id_for(1)).first
|
||||
|
|
|
@ -372,7 +372,7 @@ describe NotificationMessageCreator do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should create the message on the user's shard" do
|
||||
notification_set
|
||||
|
|
|
@ -37,7 +37,7 @@ describe Reporting::CountsReport do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
it_should_behave_like "counts_report"
|
||||
end
|
||||
|
||||
|
|
|
@ -474,7 +474,7 @@ describe UserList do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should find a user from a trusted account in a different shard" do
|
||||
@shard1.activate do
|
||||
|
|
|
@ -243,7 +243,7 @@ describe UserMerge do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should merge a user across shards" do
|
||||
user1 = user_with_pseudonym(:username => 'user1@example.com', :active_all => 1)
|
||||
|
|
|
@ -50,7 +50,7 @@ describe AccountNotification do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should always find notifications for site admin" do
|
||||
@sa_announcement = Account.site_admin.announcements.create!(:message => 'hello')
|
||||
|
|
|
@ -738,7 +738,7 @@ describe Account do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should properly return site admin permissions regardless of active shard" do
|
||||
enable_cache do
|
||||
|
@ -914,7 +914,7 @@ describe Account do
|
|||
|
||||
describe "account_chain" do
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should find parent accounts when not on the correct shard" do
|
||||
@shard1.activate do
|
||||
|
|
|
@ -61,7 +61,7 @@ describe AccountUser do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
it_should_behave_like "touching"
|
||||
|
||||
before do
|
||||
|
|
|
@ -884,7 +884,7 @@ describe Attachment do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should infer scribd mime type regardless of shard" do
|
||||
scribd_mime_type_model(:extension => 'pdf')
|
||||
|
|
|
@ -40,7 +40,7 @@ describe 'CollectionItem' do
|
|||
end
|
||||
|
||||
context "across shards" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should handle user upvotes on another shard" do
|
||||
@shard1.activate { @user1 = user_model }
|
||||
|
|
|
@ -271,7 +271,7 @@ describe CommunicationChannel do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should find a match on another shard" do
|
||||
Enrollment.stubs(:cross_shard_invitations?).returns(true)
|
||||
|
|
|
@ -93,7 +93,7 @@ describe ConversationBatch do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should reuse existing private conversations" do
|
||||
@shard1.activate { @user4 = user }
|
||||
|
|
|
@ -407,7 +407,7 @@ describe ConversationParticipant do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should be able to move to a user on a different shard" do
|
||||
u1 = User.create!
|
||||
|
|
|
@ -45,7 +45,7 @@ describe Conversation do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should create the conversation on the appropriate shard" do
|
||||
users = []
|
||||
|
@ -138,7 +138,7 @@ describe Conversation do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should add participants to the proper shards" do
|
||||
users = []
|
||||
|
@ -198,7 +198,7 @@ describe Conversation do
|
|||
it_should_behave_like "message counts"
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
it_should_behave_like "message counts"
|
||||
end
|
||||
end
|
||||
|
@ -284,7 +284,7 @@ describe Conversation do
|
|||
|
||||
it_should_behave_like "unread counts"
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
it_should_behave_like "unread counts"
|
||||
end
|
||||
end
|
||||
|
@ -482,7 +482,7 @@ describe Conversation do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should re-use conversations from another shard" do
|
||||
u1 = @shard1.activate { user }
|
||||
|
@ -619,7 +619,7 @@ describe Conversation do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should set all tags on the other shard's participants" do
|
||||
course1 = @shard1.activate{ course(:account => Account.create!, :active_all => true) }
|
||||
|
@ -910,7 +910,7 @@ describe Conversation do
|
|||
# non-sharding cases are covered by ConversationParticipant#move_to_user specs
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
before do
|
||||
@sender = User.create!(:name => 'a')
|
||||
|
|
|
@ -3091,7 +3091,7 @@ describe Course do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should properly return site admin permissions from another shard" do
|
||||
enable_cache do
|
||||
|
|
|
@ -135,7 +135,7 @@ describe DelayedMessage do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should create messages on the user's shard" do
|
||||
Canvas::MessageHelper.create_notification(:name => 'Summaries', :category => 'Summaries')
|
||||
|
|
|
@ -21,7 +21,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../sharding_spec_helper.rb')
|
|||
describe DeveloperKey do
|
||||
describe "default" do
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should always create the default key on the default shard" do
|
||||
@shard1.activate do
|
||||
|
|
|
@ -1192,7 +1192,7 @@ describe Enrollment do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
describe "limit_privileges_to_course_section!" do
|
||||
it "should use the right shard to find the enrollments" do
|
||||
|
|
|
@ -293,7 +293,7 @@ describe NotificationPolicy do
|
|||
end
|
||||
|
||||
context "across shards" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should find user categories accross shards" do
|
||||
@shard1.activate {
|
||||
|
|
|
@ -27,7 +27,7 @@ describe PageView do
|
|||
end
|
||||
|
||||
describe "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should not assign the default shard" do
|
||||
PageView.new.shard.should == Shard.default
|
||||
|
@ -55,7 +55,7 @@ describe PageView do
|
|||
end
|
||||
|
||||
describe "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should always assign the default shard" do
|
||||
PageView.new.shard.should == Shard.default
|
||||
|
|
|
@ -375,7 +375,7 @@ describe RoleOverride do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should find role overrides on a non-current shard" do
|
||||
@shard1.activate do
|
||||
|
|
|
@ -55,7 +55,7 @@ describe StreamItem do
|
|||
end
|
||||
|
||||
context "across shards" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should create stream items on the user's shard" do
|
||||
group_with_user
|
||||
|
|
|
@ -38,7 +38,7 @@ describe "UserFollow" do
|
|||
end
|
||||
|
||||
context "across shards" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
before do
|
||||
@user1 = user_model
|
||||
|
|
|
@ -383,7 +383,7 @@ describe User do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should create associations for a user in multiple shards" do
|
||||
user
|
||||
|
@ -490,7 +490,7 @@ describe User do
|
|||
end
|
||||
|
||||
describe 'with cross sharding' do
|
||||
it_should_behave_like 'sharding'
|
||||
specs_require_sharding
|
||||
|
||||
it 'pulls the enrollments that are completed with global ids' do
|
||||
alice = bob = bobs_enrollment = alices_enrollment = nil
|
||||
|
@ -1254,7 +1254,7 @@ describe User do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should include enrollments from all shards" do
|
||||
user = User.create!
|
||||
|
@ -1367,7 +1367,7 @@ describe User do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should find a pseudonym in another shard" do
|
||||
@shard1.activate do
|
||||
|
@ -1469,7 +1469,7 @@ describe User do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like 'sharding'
|
||||
specs_require_sharding
|
||||
|
||||
it "should find a pseudonym on a different shard" do
|
||||
@shard1.activate do
|
||||
|
@ -1993,7 +1993,7 @@ describe User do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
before do
|
||||
@shard1.activate do
|
||||
|
@ -2052,7 +2052,7 @@ describe User do
|
|||
end
|
||||
|
||||
describe "accounts" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should include accounts from multiple shards" do
|
||||
user
|
||||
|
@ -2067,7 +2067,7 @@ describe User do
|
|||
end
|
||||
|
||||
describe "all_pseudonyms" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
it "should include pseudonyms from multiple shards" do
|
||||
user_with_pseudonym(:active_all => 1)
|
||||
|
@ -2215,7 +2215,7 @@ describe User do
|
|||
end
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
|
||||
before do
|
||||
@shard1_account = @shard1.activate{ Account.create! }
|
||||
|
|
|
@ -20,7 +20,7 @@ describe GradeSummaryPresenter do
|
|||
end
|
||||
|
||||
describe 'across shards' do
|
||||
it_should_behave_like 'sharding'
|
||||
specs_require_sharding
|
||||
|
||||
it 'can find courses when the user and course are on the same shard' do
|
||||
user = course = enrollment = nil
|
||||
|
|
|
@ -76,7 +76,7 @@ describe GradesPresenter do
|
|||
end
|
||||
|
||||
context 'across multiple shards' do
|
||||
it_should_behave_like 'sharding'
|
||||
specs_require_sharding
|
||||
|
||||
it 'pulls the student enrollment from the same shard as the observer enrollment' do
|
||||
course = Course.create!
|
||||
|
|
|
@ -21,3 +21,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|||
shared_examples_for "sharding" do
|
||||
include Shard::RSpec
|
||||
end
|
||||
|
||||
def specs_require_sharding
|
||||
include Shard::RSpec
|
||||
end
|
||||
|
|
|
@ -108,7 +108,7 @@ shared_examples_for 'Delayed::Batch' do
|
|||
it_should_behave_like "delayed_jobs_shards"
|
||||
|
||||
context "sharding" do
|
||||
it_should_behave_like "sharding"
|
||||
specs_require_sharding
|
||||
it_should_behave_like "delayed_jobs_shards"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue