masamune 0.18.3 → 0.18.4

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: fc35b976d3a3db9e1c607ed58c09e38dadbf2928
4
- data.tar.gz: 79d7c83267acf6faed9ada08768f515dc927782a
3
+ metadata.gz: 74acb711585f7828067e24f3598a32ea3a60e9d9
4
+ data.tar.gz: a65eb2509f2b91f10b2819c64603496d41bde2d8
5
5
  SHA512:
6
- metadata.gz: ee73bba553255b67aa74bf852cc36a1d7a345cf9d1f586f85c115ac384e044c7e658e4c40d4f32707647ab846030c4635ac8dab5aa962f6e7525a619cd8effca
7
- data.tar.gz: a428ee198c1e77a39f8a3ea362fd525c09dbda6efba3ef9ac6d4688c8a7860d2584dc747485872e080224bf182b16ed44923f50af223410436ecbd785b32ca0e
6
+ metadata.gz: f1be2f3708efa65705e0ff2745027d564f9e8035b034764c062e04d19fb089ffc03d7383104fa7b3773fa658d8d11f237ef18694243d941a6f74ec3491467c50
7
+ data.tar.gz: fd906239e801f5b6f72b675f93e6ff48bcb004827f2f14da6be7be870d8f5fed4bfd177c5c28629e4f14a41b95bb67655d3d7e254b709bd4f69e3e8b340419b2
@@ -26,9 +26,16 @@ module Masamune::Actions
26
26
  opts = opts.to_hash.symbolize_keys
27
27
 
28
28
  command = Masamune::Commands::PostgresAdmin.new(environment, opts)
29
+ command = Masamune::Commands::RetryWithBackoff.new(command, postgres_admin_retry_with_backoff_options.merge(opts))
29
30
  command = Masamune::Commands::Shell.new(command, opts)
30
31
 
31
32
  command.execute
32
33
  end
34
+
35
+ private
36
+
37
+ def postgres_admin_retry_with_backoff_options
38
+ configuration.commands.postgres.merge(configuration.commands.postgres_admin).slice(:retries, :backoff)
39
+ end
33
40
  end
34
41
  end
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Masamune
24
- VERSION = '0.18.3'.freeze
24
+ VERSION = '0.18.4'.freeze
25
25
  end
@@ -30,6 +30,28 @@ describe Masamune::Actions::PostgresAdmin do
30
30
 
31
31
  let(:instance) { klass.new }
32
32
 
33
+ shared_context 'retries and backoff' do
34
+ context 'with retries and backoff configured via postgres_admin command' do
35
+ before do
36
+ allow(instance).to receive_message_chain(:configuration, :commands, :postgres).and_return(retries: 1, backoff: 10)
37
+ allow(instance).to receive_message_chain(:configuration, :commands, :postgres_admin).and_return(retries: 3, backoff: 1)
38
+ expect(Masamune::Commands::RetryWithBackoff).to receive(:new).with(anything, hash_including(retries: 3, backoff: 1)).once.and_call_original
39
+ end
40
+
41
+ it { is_expected.to be_success }
42
+ end
43
+
44
+ context 'with retries and backoff configured via postgres command' do
45
+ before do
46
+ allow(instance).to receive_message_chain(:configuration, :commands, :postgres).and_return(retries: 1, backoff: 10)
47
+ allow(instance).to receive_message_chain(:configuration, :commands, :postgres_admin).and_return({})
48
+ expect(Masamune::Commands::RetryWithBackoff).to receive(:new).with(anything, hash_including(retries: 1, backoff: 10)).once.and_call_original
49
+ end
50
+
51
+ it { is_expected.to be_success }
52
+ end
53
+ end
54
+
33
55
  describe '.postgres_admin' do
34
56
  subject { instance.postgres_admin(action: action, database: 'zombo') }
35
57
 
@@ -41,6 +63,8 @@ describe Masamune::Actions::PostgresAdmin do
41
63
  end
42
64
 
43
65
  it { is_expected.to be_success }
66
+
67
+ include_context 'retries and backoff'
44
68
  end
45
69
 
46
70
  context 'with :action :drop' do
@@ -51,6 +75,8 @@ describe Masamune::Actions::PostgresAdmin do
51
75
  end
52
76
 
53
77
  it { is_expected.to be_success }
78
+
79
+ include_context 'retries and backoff'
54
80
  end
55
81
  end
56
82
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: masamune
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.3
4
+ version: 0.18.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Andrews
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-24 00:00:00.000000000 Z
11
+ date: 2016-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor