switchman 1.3.8 → 1.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8f9aba599d3ef529a78c94fd5e94c2f204b7ccc
4
- data.tar.gz: 5bf0f3c88787aec47ed93c41069cc7ad06054423
3
+ metadata.gz: c73ebcdb49c218c7550f44ec2087c7feb091ef45
4
+ data.tar.gz: e3e8e34ff693c05204617ba9e2c747db0a5fbc39
5
5
  SHA512:
6
- metadata.gz: b44289cf27c475ffacc928e691c6e0698b771ebc840d742ffab6e7e926bf728ebff2c574bb403df221cbf51bfc46eeea18b2a62bde62e1a847972228eefb9b65
7
- data.tar.gz: bb774752360b5b84cfa665b8c13f1dd3bba7fe5a4bd09007d453309d8003699c8e0917e17e3452222410746aaee6088d95b1d9cbc3aa2e5bcdf76ffd260afafd
6
+ metadata.gz: 86b7f9cc5f2453465a963bf13c9252556e12750f91ee2a9474eea826a13bde2f7c04c271ad91d2fc3f97b0046deb5ce38c285914f62d3fa4bf9e94d617889076
7
+ data.tar.gz: e365daa2f0fe7ba8de97d29a44d832200b7256dca79378bca1d341ea1696c32320ae06390c486bd25030081e8fe966f76115518a33a031a8c721c33b3d420d1d
@@ -12,6 +12,7 @@ module Switchman
12
12
  module RSpecHelper
13
13
  @@keep_the_shards = false
14
14
  @@shard1 = nil
15
+ @@sharding_failed = false
15
16
 
16
17
  def self.included_in?(klass)
17
18
  klass.parent_groups.any? { |group| group.included_modules.include?(self) }
@@ -27,6 +28,7 @@ module Switchman
27
28
  root_group = klass.parent_groups.last
28
29
  root_group.prepend_before(:all) do |group|
29
30
  next if @@shard1
31
+ next if @@sharding_failed
30
32
  # if we aren't actually going to run a sharding group/example,
31
33
  # don't set it up after all
32
34
  groups = group.class.descendant_filtered_examples.map(&:example_group).uniq
@@ -49,9 +51,21 @@ module Switchman
49
51
  else
50
52
  @@shard3 = @@shard1.database_server.create_new_shard
51
53
  end
52
- rescue
54
+ rescue => e
55
+ $stderr.puts "Sharding setup FAILED!:"
56
+ while e
57
+ $stderr.puts "\n#{e}\n"
58
+ $stderr.puts e.backtrace
59
+ e = e.respond_to?(:cause) ? e.cause : nil
60
+ end
61
+ @@sharding_failed = true
62
+ (@@shard1.drop_database if @@shard1) rescue nil
63
+ (@@shard2.drop_database if @@shard3) rescue nil
64
+ (@@shard3.drop_database if @@shard3) rescue nil
53
65
  @@shard1 = @@shard2 = @@shard3 = nil
54
- raise
66
+ Shard.delete_all
67
+ Shard.default(true)
68
+ next
55
69
  end
56
70
  end
57
71
  # we'll re-persist in the group's `before :all`; we don't want them to exist
@@ -81,6 +95,7 @@ module Switchman
81
95
  end
82
96
 
83
97
  klass.before(:all) do
98
+ next if @@sharding_failed
84
99
  dup = @@default_shard.dup
85
100
  dup.id = @@default_shard.id
86
101
  dup.save!
@@ -101,6 +116,7 @@ module Switchman
101
116
  end
102
117
 
103
118
  klass.before do
119
+ raise "Sharding did not set up correctly" if @@sharding_failed
104
120
  Shard.clear_cache
105
121
  if use_transactional_fixtures
106
122
  Shard.default(true)
@@ -130,6 +146,7 @@ module Switchman
130
146
  end
131
147
 
132
148
  klass.after do
149
+ next if @@sharding_failed
133
150
  if use_transactional_fixtures
134
151
  shards = [@shard2]
135
152
  shards << @shard1 unless @shard1.database_server == Shard.default.database_server
@@ -1,3 +1,3 @@
1
1
  module Switchman
2
- VERSION = "1.3.8"
2
+ VERSION = "1.3.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switchman
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.8
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-10-26 00:00:00.000000000 Z
13
+ date: 2015-10-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties