spec: fix flaky past_lti_id user merge spec
load the context's shard before looking up past_lti_ids test plan: • specs pass • verify in splunk after merge the test is no longer flaky Change-Id: I5ee1967f17b5396254c6ea5567742eaaf57ad8b4 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261169 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Simon Williams <simon@instructure.com> QA-Review: August Thornton <august@instructure.com> Product-Review: August Thornton <august@instructure.com>
This commit is contained in:
parent
9ee501d831
commit
f3822b817b
|
@ -705,16 +705,23 @@ describe UserMerge do
|
||||||
context "sharding" do
|
context "sharding" do
|
||||||
specs_require_sharding
|
specs_require_sharding
|
||||||
|
|
||||||
it "should move past_lti_id to the new user on other shard" do
|
it 'should move past_lti_id to the new user on other shard' do
|
||||||
course1 = course_factory(active_all: true)
|
|
||||||
user1 = user_with_pseudonym(:username => 'user1@example.com', :active_all => 1)
|
|
||||||
UserPastLtiId.create!(user: user1, context: course1, user_uuid: 'fake_uuid', user_lti_id: 'fake_lti_id_from_old_merge')
|
|
||||||
@shard1.activate do
|
@shard1.activate do
|
||||||
account = Account.create!
|
account = Account.create!
|
||||||
@user2 = user_with_pseudonym(:username => 'user2@example.com', :active_all => 1, :account => account)
|
@user1 = user_with_pseudonym(username: 'user1@example.com', active_all: 1, account: account)
|
||||||
UserMerge.from(user1).into(@user2)
|
|
||||||
expect(@user2.reload.past_lti_ids.shard(@user2).take.user_lti_id).to eq 'fake_lti_id_from_old_merge'
|
|
||||||
end
|
end
|
||||||
|
course = course_factory(active_all: true)
|
||||||
|
user2 = user_with_pseudonym(username: 'user2@example.com', active_all: 1)
|
||||||
|
UserPastLtiId.create!(
|
||||||
|
user: user2,
|
||||||
|
context: course,
|
||||||
|
user_uuid: 'fake_uuid',
|
||||||
|
user_lti_id: 'fake_lti_id_from_old_merge'
|
||||||
|
)
|
||||||
|
UserMerge.from(user2).into(@user1)
|
||||||
|
expect(
|
||||||
|
UserPastLtiId.shard(course).where(user_id: @user1).take.user_lti_id
|
||||||
|
).to eq 'fake_lti_id_from_old_merge'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should move prefs over with old format' do
|
it 'should move prefs over with old format' do
|
||||||
|
|
Loading…
Reference in New Issue