Skip to content

Commit 71e8d51

Browse files
committed
spec: gracefully handle sharding not initializing in specs
also bumps switchman for similar error handling refs CNVS-21900 Change-Id: I5c4f8d91bc5b6d3d0e6dc01ef3388fcc4d9b6c36 Reviewed-on: https://gerrit.instructure.com/65924 Tested-by: Jenkins Reviewed-by: Jon Jensen <jon@instructure.com> Product-Review: Jon Jensen <jon@instructure.com> QA-Review: Jon Jensen <jon@instructure.com>
1 parent 5bfc62f commit 71e8d51

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Gemfile.d/app.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
gem 'active_model-better_errors', '1.6.7', require: 'active_model/better_errors'
2020
gem 'dynamic_form', '1.1.4', require: false
2121
gem 'rails-patch-json-encode', '0.0.1'
22-
gem 'switchman', '1.3.8'
22+
gem 'switchman', '1.3.9'
2323
gem 'folio-pagination', '0.0.9', require: 'folio/rails'
2424
# for folio, see the folio README
2525
gem 'will_paginate', '3.0.7', require: false

spec/support/onceler/sharding.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module Onceler
22
module Sharding
33
def self.included(klass)
44
klass.onceler_connections = ->(_) do
5+
next [] if Switchman::RSpecHelper.class_variable_get(:@@sharding_failed)
56
shard1 = Switchman::RSpecHelper.class_variable_get(:@@shard1)
67
shard2 = Switchman::RSpecHelper.class_variable_get(:@@shard2)
78
# mirror logic of https://github.com/instructure/switchman/blob/61f2e9d/lib/switchman/r_spec_helper.rb#L94
@@ -12,6 +13,8 @@ def self.included(klass)
1213
end
1314

1415
klass.before :record do
16+
sharding_failed = Switchman::RSpecHelper.class_variable_get(:@@sharding_failed)
17+
raise "Sharding did not set up correctly" if sharding_failed
1518
@shard1 = Shard.find(Switchman::RSpecHelper.class_variable_get(:@@shard1))
1619
@shard2 = Shard.find(Switchman::RSpecHelper.class_variable_get(:@@shard2))
1720
end

0 commit comments

Comments
 (0)