automan 2.3.6 → 2.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/Rakefile +5 -0
- data/automan.gemspec +3 -3
- data/lib/automan/base.rb +7 -3
- data/lib/automan/beanstalk/deployer.rb +1 -1
- data/lib/automan/beanstalk/package.rb +1 -1
- data/lib/automan/beanstalk/router.rb +1 -1
- data/lib/automan/cli/snapper.rb +29 -29
- data/lib/automan/cli/stacker.rb +19 -0
- data/lib/automan/cloudformation/launcher.rb +6 -3
- data/lib/automan/cloudformation/replacer.rb +1 -1
- data/lib/automan/cloudformation/terminator.rb +1 -1
- data/lib/automan/ec2/image.rb +3 -3
- data/lib/automan/elasticache/router.rb +79 -0
- data/lib/automan/mixins/aws_caller.rb +21 -7
- data/lib/automan/rds/snapshot.rb +35 -14
- data/lib/automan/s3/downloader.rb +10 -1
- data/lib/automan/version.rb +1 -1
- data/lib/automan.rb +1 -0
- data/spec/beanstalk/application_spec.rb +17 -17
- data/spec/beanstalk/configuration_spec.rb +24 -24
- data/spec/beanstalk/deployer_spec.rb +65 -65
- data/spec/beanstalk/router_spec.rb +18 -19
- data/spec/beanstalk/terminator_spec.rb +16 -16
- data/spec/beanstalk/uploader_spec.rb +13 -13
- data/spec/beanstalk/version_spec.rb +8 -10
- data/spec/cloudformation/launcher_spec.rb +63 -65
- data/spec/cloudformation/replacer_spec.rb +10 -10
- data/spec/cloudformation/terminator_spec.rb +23 -23
- data/spec/cloudformation/uploader_spec.rb +13 -13
- data/spec/ec2/image_spec.rb +55 -55
- data/spec/ec2/instance_spec.rb +17 -17
- data/spec/elasticache/router_spec.rb +29 -0
- data/spec/mixins/aws_caller_spec.rb +9 -9
- data/spec/mixins/utils_spec.rb +27 -28
- data/spec/rds/snapshot_spec.rb +44 -46
- data/templates/stacker/.env.example +14 -0
- data/templates/stacker/.gitignore +2 -0
- data/templates/stacker/.ruby-gemset.tt +1 -0
- data/templates/stacker/.ruby-version +1 -0
- data/templates/stacker/Gemfile +4 -0
- data/templates/stacker/bin/%app_name%.tt +62 -0
- data/templates/stacker/bin/launch_%app_name%.sh.tt +12 -0
- metadata +20 -7
@@ -23,10 +23,10 @@ describe Automan::Beanstalk::Configuration do
|
|
23
23
|
describe '#config_template_exists?' do
|
24
24
|
|
25
25
|
it 'returns false if raises InvalidParameterValue with missing config template message' do
|
26
|
-
c.eb = double(:eb)
|
27
26
|
error = AWS::ElasticBeanstalk::Errors::InvalidParameterValue.new('No Configuration Template named')
|
28
|
-
|
29
|
-
|
27
|
+
subject.eb = double()
|
28
|
+
allow(subject.eb).to receive(:describe_configuration_settings).and_raise(error)
|
29
|
+
expect(subject.config_template_exists?).to be_falsey
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -48,51 +48,51 @@ describe Automan::Beanstalk::Configuration do
|
|
48
48
|
}
|
49
49
|
]
|
50
50
|
|
51
|
-
|
51
|
+
expect(subject.fix_config_keys(config_before)).to eq(config_after)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
describe '#create' do
|
56
56
|
it 'does not create if configuration exists' do
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
allow(subject).to receive(:config_template_exists?).and_return(true)
|
58
|
+
expect(subject).to_not receive(:create_config_template)
|
59
|
+
subject.create
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'does create if configuration does not exist' do
|
63
|
-
|
64
|
-
|
65
|
-
|
63
|
+
allow(subject).to receive(:config_template_exists?).and_return(false)
|
64
|
+
expect(subject).to receive(:create_config_template)
|
65
|
+
subject.create
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
describe '#delete' do
|
70
70
|
it 'does delete if configuration exists' do
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
allow(subject).to receive(:config_template_exists?).and_return(true)
|
72
|
+
expect(subject).to receive(:delete_config_template)
|
73
|
+
subject.delete
|
74
74
|
end
|
75
75
|
|
76
76
|
it 'does not delete if configuration does not exist' do
|
77
|
-
|
78
|
-
|
79
|
-
|
77
|
+
allow(subject).to receive(:config_template_exists?).and_return(false)
|
78
|
+
expect(subject).to_not receive(:delete_config_template)
|
79
|
+
subject.delete
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
83
|
describe '#update' do
|
84
84
|
it 'deletes configuration and recreates it if it exists' do
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
85
|
+
allow(subject).to receive(:config_template_exists?).and_return(true)
|
86
|
+
expect(subject).to receive(:delete_config_template)
|
87
|
+
expect(subject).to receive(:create_config_template)
|
88
|
+
subject.update
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'does not try to delete configuration if it does not exist' do
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
92
|
+
allow(subject).to receive(:config_template_exists?).and_return(false)
|
93
|
+
expect(subject).to_not receive(:delete_config_template)
|
94
|
+
expect(subject).to receive(:create_config_template)
|
95
|
+
subject.update
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
@@ -2,59 +2,59 @@ require "automan"
|
|
2
2
|
|
3
3
|
describe Automan::Beanstalk::Deployer do
|
4
4
|
|
5
|
-
it {
|
6
|
-
it {
|
7
|
-
it {
|
8
|
-
it {
|
9
|
-
it {
|
10
|
-
it {
|
11
|
-
it {
|
12
|
-
it {
|
13
|
-
it {
|
14
|
-
it {
|
15
|
-
it {
|
16
|
-
it {
|
17
|
-
it {
|
5
|
+
it { is_expected.to respond_to :name }
|
6
|
+
it { is_expected.to respond_to :version_label }
|
7
|
+
it { is_expected.to respond_to :package }
|
8
|
+
it { is_expected.to respond_to :environment }
|
9
|
+
it { is_expected.to respond_to :manifest }
|
10
|
+
it { is_expected.to respond_to :read_manifest }
|
11
|
+
it { is_expected.to respond_to :manifest_exists? }
|
12
|
+
it { is_expected.to respond_to :package_exists? }
|
13
|
+
it { is_expected.to respond_to :environment_status }
|
14
|
+
it { is_expected.to respond_to :configuration_template }
|
15
|
+
it { is_expected.to respond_to :deploy }
|
16
|
+
it { is_expected.to respond_to :update_environment }
|
17
|
+
it { is_expected.to respond_to :create_environment }
|
18
18
|
|
19
19
|
# Constraint: Must be from 4 to 23 characters in length.
|
20
20
|
# The name can contain only letters, numbers, and hyphens.
|
21
21
|
# It cannot start or end with a hyphen.
|
22
22
|
describe '#eb_environment_name' do
|
23
|
-
subject(
|
23
|
+
subject() { Automan::Beanstalk::Deployer.new }
|
24
24
|
|
25
25
|
it "is at least 4 characters" do
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
subject.name = "a"
|
27
|
+
subject.environment = "a"
|
28
|
+
expect(subject.eb_environment_name.length).to be >= 4
|
29
29
|
end
|
30
30
|
|
31
31
|
it "is no more than 23 characters" do
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
subject.name = "a" * 23
|
33
|
+
subject.environment = "dev"
|
34
|
+
expect(subject.eb_environment_name.length).to be <= 23
|
35
35
|
end
|
36
36
|
|
37
37
|
it "contains only letters, numbers, and hyphens" do
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
subject.name = '@#$%^foo_bar!$%&&E.'
|
39
|
+
subject.environment = 'prod.baz'
|
40
|
+
expect(subject.eb_environment_name).to match(/[a-z0-9-]+/)
|
41
41
|
end
|
42
42
|
|
43
43
|
it "cannot start or end with a hyphen" do
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
subject.name = '--foo'
|
45
|
+
subject.environment = 'bar--'
|
46
|
+
expect(subject.eb_environment_name).to match(/^[^-].*[^-]$/)
|
47
47
|
end
|
48
48
|
|
49
49
|
it "is still at least 4 characters even after removing restricted strings" do
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
subject.name = '--f'
|
51
|
+
subject.environment = '-'
|
52
|
+
expect(subject.eb_environment_name.length).to be >= 4
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
describe '#read_manifest' do
|
57
|
-
subject(
|
57
|
+
subject() do
|
58
58
|
AWS.stub!
|
59
59
|
d = Automan::Beanstalk::Deployer.new
|
60
60
|
d.logger = Logger.new('/dev/null')
|
@@ -62,23 +62,23 @@ describe Automan::Beanstalk::Deployer do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'raises MissingManifestError if the manifest is missing' do
|
65
|
-
|
65
|
+
expect(subject).to receive(:manifest_exists?).and_return(false)
|
66
66
|
expect {
|
67
|
-
|
67
|
+
subject.read_manifest
|
68
68
|
}.to raise_error(Automan::Beanstalk::MissingManifestError)
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'sets version_label and package properly' do
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
72
|
+
allow(subject).to receive(:manifest_exists?).and_return(true)
|
73
|
+
allow(subject).to receive(:s3_read).and_return('{"version_label": "foo", "package": "bar"}')
|
74
|
+
subject.read_manifest
|
75
|
+
expect(subject.version_label).to eq('foo')
|
76
|
+
expect(subject.package).to eq('bar')
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
80
|
describe '#deploy' do
|
81
|
-
subject(
|
81
|
+
subject() do
|
82
82
|
AWS.stub!
|
83
83
|
d = Automan::Beanstalk::Deployer.new
|
84
84
|
d.logger = Logger.new('/dev/null')
|
@@ -86,22 +86,22 @@ describe Automan::Beanstalk::Deployer do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
it 'raises MissingPackageError if the package does not exist' do
|
89
|
-
|
89
|
+
allow(subject).to receive(:package_exists?).and_return(false)
|
90
90
|
expect {
|
91
|
-
|
91
|
+
subject.deploy
|
92
92
|
}.to raise_error(Automan::Beanstalk::MissingPackageFileError)
|
93
93
|
end
|
94
94
|
|
95
95
|
it 'makes sure the application version and environment exists' do
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
96
|
+
allow(subject).to receive(:package_exists?).and_return(true)
|
97
|
+
expect(subject).to receive(:ensure_version_exists)
|
98
|
+
expect(subject).to receive(:create_or_update_environment)
|
99
|
+
subject.deploy
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
103
|
describe '#ensure_version_exists' do
|
104
|
-
subject(
|
104
|
+
subject() do
|
105
105
|
AWS.stub!
|
106
106
|
d = Automan::Beanstalk::Deployer.new
|
107
107
|
d.logger = Logger.new('/dev/null')
|
@@ -109,51 +109,51 @@ describe Automan::Beanstalk::Deployer do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
it 'creates version if it does not exist' do
|
112
|
-
version = double(
|
113
|
-
version.
|
114
|
-
version.
|
115
|
-
|
116
|
-
|
112
|
+
version = double()
|
113
|
+
allow(version).to receive(:exists?).and_return(false)
|
114
|
+
expect(version).to receive(:create)
|
115
|
+
allow(subject).to receive(:get_version).and_return(version)
|
116
|
+
subject.ensure_version_exists
|
117
117
|
end
|
118
118
|
|
119
119
|
it 'does not create version if it exists' do
|
120
|
-
version = double(
|
121
|
-
version.
|
122
|
-
version.
|
123
|
-
|
124
|
-
|
120
|
+
version = double()
|
121
|
+
allow(version).to receive(:exists?).and_return(true)
|
122
|
+
expect(version).to_not receive(:create)
|
123
|
+
allow(subject).to receive(:get_version).and_return(version)
|
124
|
+
subject.ensure_version_exists
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
128
|
describe '#create_or_update_environment' do
|
129
|
-
subject(
|
129
|
+
subject() do
|
130
130
|
AWS.stub!
|
131
131
|
d = Automan::Beanstalk::Deployer.new
|
132
132
|
d.logger = Logger.new('/dev/null')
|
133
|
-
d.
|
133
|
+
allow(d).to receive(:ensure_version_exists)
|
134
134
|
d
|
135
135
|
end
|
136
136
|
|
137
137
|
[nil, 'Terminated'].each do |state|
|
138
138
|
it "creates environment if state is #{state.nil? ? 'nil' : state}" do
|
139
|
-
|
140
|
-
|
141
|
-
|
139
|
+
allow(subject).to receive(:environment_status).and_return(state)
|
140
|
+
expect(subject).to receive(:create_environment)
|
141
|
+
subject.create_or_update_environment
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
145
|
['Ready'].each do |state|
|
146
146
|
it "updates environment if state is #{state.nil? ? 'nil' : state}" do
|
147
|
-
|
148
|
-
|
149
|
-
|
147
|
+
allow(subject).to receive(:environment_status).and_return(state)
|
148
|
+
expect(subject).to receive(:update_environment)
|
149
|
+
subject.create_or_update_environment
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
153
153
|
it 'raises error if environment state is anything else' do
|
154
|
-
|
154
|
+
allow(subject).to receive(:environment_status).and_return('foo')
|
155
155
|
expect {
|
156
|
-
|
156
|
+
subject.create_or_update_environment
|
157
157
|
}.to raise_error(Automan::Beanstalk::InvalidEnvironmentStatusError)
|
158
158
|
end
|
159
159
|
end
|
@@ -2,14 +2,14 @@ require 'automan'
|
|
2
2
|
require 'wait'
|
3
3
|
|
4
4
|
describe Automan::Beanstalk::Router do
|
5
|
-
it {
|
6
|
-
it {
|
7
|
-
it {
|
8
|
-
it {
|
5
|
+
it { is_expected.to respond_to :run }
|
6
|
+
it { is_expected.to respond_to :environment_name }
|
7
|
+
it { is_expected.to respond_to :hosted_zone_name }
|
8
|
+
it { is_expected.to respond_to :hostname }
|
9
9
|
|
10
10
|
describe '#run' do
|
11
11
|
context 'waiting' do
|
12
|
-
subject(
|
12
|
+
subject() do
|
13
13
|
AWS.stub!
|
14
14
|
r = Automan::Beanstalk::Router.new
|
15
15
|
r.eb = AWS::ElasticBeanstalk::Client.new
|
@@ -17,48 +17,47 @@ describe Automan::Beanstalk::Router do
|
|
17
17
|
r.environment_name = 'foo'
|
18
18
|
r.hosted_zone_name = 'foo.com'
|
19
19
|
r.hostname = 'www.foo.com'
|
20
|
-
r.log_aws_calls = false
|
21
20
|
r.logger = Logger.new('/dev/null')
|
22
21
|
r.wait = Wait.new(delay: 0.01, rescuer: WaitRescuer.new(AWS::Route53::Errors::InvalidChangeBatch))
|
23
22
|
r
|
24
23
|
end
|
25
24
|
|
26
25
|
it "raises error if it never finds a name" do
|
27
|
-
|
26
|
+
allow(subject).to receive(:elb_cname_from_beanstalk_environment).and_return(nil)
|
28
27
|
expect {
|
29
|
-
|
28
|
+
subject.run
|
30
29
|
}.to raise_error Wait::ResultInvalid
|
31
30
|
end
|
32
31
|
|
33
32
|
it "calls #update_dns_alias if it finds a name" do
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
allow(subject).to receive(:elb_cname_from_beanstalk_environment).and_return('foo')
|
34
|
+
expect(subject).to receive(:update_dns_alias)
|
35
|
+
subject.run
|
37
36
|
end
|
38
37
|
|
39
38
|
it "ignores InvalidChangeBatch until last attempt" do
|
40
|
-
|
41
|
-
|
39
|
+
allow(subject).to receive(:elb_cname_from_beanstalk_environment).and_return('foo')
|
40
|
+
allow(subject).to receive(:update_dns_alias).and_raise AWS::Route53::Errors::InvalidChangeBatch
|
42
41
|
expect {
|
43
|
-
|
42
|
+
subject.run
|
44
43
|
}.to raise_error AWS::Route53::Errors::InvalidChangeBatch
|
45
|
-
|
44
|
+
expect(subject.attempts_made).to eq 5
|
46
45
|
end
|
47
46
|
|
48
47
|
it "ignores InvalidChangeBatch until it succeeds" do
|
49
|
-
|
48
|
+
allow(subject).to receive(:elb_cname_from_beanstalk_environment).and_return('foo')
|
50
49
|
|
51
50
|
@attempts = 0
|
52
|
-
|
51
|
+
allow(subject).to receive(:update_dns_alias) do
|
53
52
|
@attempts += 1
|
54
53
|
raise AWS::Route53::Errors::InvalidChangeBatch if @attempts < 3
|
55
54
|
end
|
56
55
|
|
57
56
|
expect {
|
58
|
-
|
57
|
+
subject.run
|
59
58
|
}.not_to raise_error
|
60
59
|
|
61
|
-
|
60
|
+
expect(subject.attempts_made).to eq 3
|
62
61
|
end
|
63
62
|
end
|
64
63
|
end
|
@@ -14,33 +14,33 @@ describe Automan::Beanstalk::Terminator do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "returns false if environment does not exist" do
|
17
|
-
resp =
|
17
|
+
resp = subject.eb.stub_for :describe_environments
|
18
18
|
resp.data[:environments] = [{}]
|
19
|
-
|
19
|
+
expect(subject.environment_exists?('foo')).to be_falsey
|
20
20
|
end
|
21
21
|
|
22
22
|
it "returns false if environment is in Terminated state" do
|
23
|
-
resp =
|
23
|
+
resp = subject.eb.stub_for :describe_environments
|
24
24
|
resp.data[:environments] = [{environment_name: 'foo', status: 'Terminated'}]
|
25
|
-
|
25
|
+
expect(subject.environment_exists?('foo')).to be_falsey
|
26
26
|
end
|
27
27
|
|
28
28
|
it "returns false if environment is in Terminating state" do
|
29
|
-
resp =
|
29
|
+
resp = subject.eb.stub_for :describe_environments
|
30
30
|
resp.data[:environments] = [{environment_name: 'foo', status: 'Terminating'}]
|
31
|
-
|
31
|
+
expect(subject.environment_exists?('foo')).to be_falsey
|
32
32
|
end
|
33
33
|
|
34
34
|
it "returns true if environment does exist" do
|
35
|
-
resp =
|
35
|
+
resp = subject.eb.stub_for :describe_environments
|
36
36
|
resp.data[:environments] = [{environment_name: 'foo'}]
|
37
|
-
|
37
|
+
expect(subject.environment_exists?('foo')).to be_truthy
|
38
38
|
end
|
39
39
|
|
40
40
|
it "returns true if environment is in Ready state" do
|
41
|
-
resp =
|
41
|
+
resp = subject.eb.stub_for :describe_environments
|
42
42
|
resp.data[:environments] = [{environment_name: 'foo', status: 'Ready'}]
|
43
|
-
|
43
|
+
expect(subject.environment_exists?('foo')).to be_truthy
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -53,15 +53,15 @@ describe Automan::Beanstalk::Terminator do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'should call #terminate_environment if the environment exists' do
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
allow(subject).to receive(:environment_exists?).and_return(true)
|
57
|
+
expect(subject).to receive :terminate_environment
|
58
|
+
subject.terminate
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'should not call #terminate_environment if the environment does not exist' do
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
allow(subject).to receive(:environment_exists?).and_return(false)
|
63
|
+
expect(subject).to_not receive :terminate_environment
|
64
|
+
subject.terminate
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
@@ -6,7 +6,7 @@ describe Automan::Beanstalk::Uploader do
|
|
6
6
|
u = Automan::Beanstalk::Uploader.new
|
7
7
|
u.logger = Logger.new('/dev/null')
|
8
8
|
u.template_files = 'foo'
|
9
|
-
u.
|
9
|
+
allow(u).to receive(:config_templates).and_return(['foo'])
|
10
10
|
u
|
11
11
|
end
|
12
12
|
|
@@ -18,36 +18,36 @@ describe Automan::Beanstalk::Uploader do
|
|
18
18
|
describe '#config_templates_valid?' do
|
19
19
|
|
20
20
|
it 'raises error if config templates do not exist' do
|
21
|
-
|
21
|
+
allow(subject).to receive(:config_templates).and_return([])
|
22
22
|
expect {
|
23
|
-
|
23
|
+
subject.config_templates_valid?
|
24
24
|
}.to raise_error(Automan::Beanstalk::NoConfigurationTemplatesError)
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'returns true if config templates are valid json' do
|
28
|
-
|
29
|
-
|
28
|
+
allow(subject).to receive(:read_config_template).and_return('[{}]')
|
29
|
+
expect(subject.config_templates_valid?).to be_truthy
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'returns false if config templates are invalid json' do
|
33
|
-
|
34
|
-
|
33
|
+
allow(subject).to receive(:read_config_template).and_return('@#$%#')
|
34
|
+
expect(subject.config_templates_valid?).to be_falsey
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
describe '#upload_config_templates' do
|
39
39
|
it 'raises error if any config template fails validation' do
|
40
|
-
|
40
|
+
allow(subject).to receive(:config_templates_valid?).and_return(false)
|
41
41
|
expect {
|
42
|
-
|
42
|
+
subject.upload_config_templates
|
43
43
|
}.to raise_error(Automan::Beanstalk::InvalidConfigurationTemplateError)
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'uploads files if they are valid' do
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
allow(subject).to receive(:config_templates).and_return(%w[a b c])
|
48
|
+
allow(subject).to receive(:config_templates_valid?).and_return(true)
|
49
|
+
expect(subject).to receive(:upload_file).exactly(3).times
|
50
|
+
subject.upload_config_templates
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -16,25 +16,24 @@ describe Automan::Beanstalk::Version do
|
|
16
16
|
v.eb = AWS::ElasticBeanstalk::Client.new
|
17
17
|
v.application = 'foo'
|
18
18
|
v.label = 'v4'
|
19
|
-
v.log_aws_calls = false
|
20
19
|
v.logger = Logger.new('/dev/null')
|
21
20
|
v
|
22
21
|
end
|
23
22
|
|
24
23
|
it "is true when version exists in response" do
|
25
|
-
resp =
|
24
|
+
resp = subject.eb.stub_for :describe_application_versions
|
26
25
|
resp.data[:application_versions] = [
|
27
|
-
{application_name:
|
26
|
+
{application_name: subject.application, version_label: subject.label}
|
28
27
|
]
|
29
|
-
|
28
|
+
expect(subject.exists?).to be_truthy
|
30
29
|
end
|
31
30
|
|
32
31
|
it "is false when version is not in response" do
|
33
|
-
resp =
|
32
|
+
resp = subject.eb.stub_for :describe_application_versions
|
34
33
|
resp.data[:application_versions] = [
|
35
34
|
{application_name: '', version_label: ''}
|
36
35
|
]
|
37
|
-
|
36
|
+
expect(subject.exists?).to be_falsey
|
38
37
|
end
|
39
38
|
end
|
40
39
|
|
@@ -47,11 +46,10 @@ describe Automan::Beanstalk::Version do
|
|
47
46
|
end
|
48
47
|
|
49
48
|
it 'ignores AWS::ElasticBeanstalk::Errors::SourceBundleDeletionFailure' do
|
50
|
-
eb = double(
|
51
|
-
eb.
|
52
|
-
v.eb = eb
|
49
|
+
subject.eb = double()
|
50
|
+
allow(subject.eb).to receive(:delete_application_version).and_raise(AWS::ElasticBeanstalk::Errors::SourceBundleDeletionFailure)
|
53
51
|
expect {
|
54
|
-
|
52
|
+
subject.delete_by_label('foo')
|
55
53
|
}.not_to raise_error
|
56
54
|
end
|
57
55
|
|