automan 2.3.1 → 2.3.2

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: e7edc999dc7f9d16861752be4e638d3a38d83a0b
4
- data.tar.gz: 41de5287e9f7400481c7448316db256612460c60
3
+ metadata.gz: 3d5223742567c1e2f6a4d8d4acce6b217b5274b4
4
+ data.tar.gz: ee52d65bf8bc91b45e6252ecc1c166f214182c35
5
5
  SHA512:
6
- metadata.gz: 41686b788d734907ead2919efec9c69fbe3e062fddf8a5ce2efab1fcaac92341450e9179bc3f405fbcfdea868df6362c930acb0ee4645c87c93d6c1a969b7ed2
7
- data.tar.gz: 82ff62c8fc0f0ce9415b8a9f05ff6f8e749bb1b2833de5527dff1499b41d0cd0427af085a0cacbfba34a2868a5d8b574b15badbff93e869c913b5f8383437cd2
6
+ metadata.gz: 8243eb955f0b5c3d4fd01c029767454dc4964cc3eb47cd805237e12ebd02bdfecf6a9329cbf5c38d07bfe40aecda27c5f5ea6160e1f11748588208e11b08a4e1
7
+ data.tar.gz: 406c82dd210f316967ae942c17b6151c57aeb2c372944612632a5e4f851b412e91b9ecf966255d4ff6c6fd56ba343a447889701ea777074d6a1638543f3a73bb
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ automan
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.1.2
data/automan.gemspec CHANGED
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_development_dependency "bundler", "~> 1.3"
21
21
  spec.add_development_dependency "rake"
22
- spec.add_development_dependency "rspec-core", "~> 2.12.2"
23
- spec.add_development_dependency "rspec-mocks", "~> 2.12.2"
24
- spec.add_development_dependency "rspec-expectations", "~> 2.12.1"
22
+ spec.add_development_dependency "rspec-core", "~> 3"
23
+ spec.add_development_dependency "rspec-mocks", "~> 3"
24
+ spec.add_development_dependency "rspec-expectations", "~> 3"
25
25
  spec.add_dependency "aws-sdk", "< 2.0"
26
26
  spec.add_dependency "thor"
27
27
  spec.add_dependency "json"
@@ -1,3 +1,3 @@
1
1
  module Automan
2
- VERSION = "2.3.1"
2
+ VERSION = "2.3.2"
3
3
  end
@@ -1,12 +1,12 @@
1
1
  require "automan"
2
2
 
3
3
  describe Automan::Beanstalk::Application do
4
- it { should respond_to :name }
5
- it { should respond_to :create }
6
- it { should respond_to :delete }
4
+ it { is_expected.to respond_to :name }
5
+ it { is_expected.to respond_to :create }
6
+ it { is_expected.to respond_to :delete }
7
7
 
8
8
  describe '#create' do
9
- subject(:a) do
9
+ subject() do
10
10
  AWS.stub!
11
11
  a = Automan::Beanstalk::Application.new
12
12
  a.logger = Logger.new('/dev/null')
@@ -14,20 +14,20 @@ describe Automan::Beanstalk::Application do
14
14
  end
15
15
 
16
16
  it "does not create if the application already exists" do
17
- a.stub(:application_exists?).and_return(true)
18
- a.should_not_receive(:create_application)
19
- a.create
17
+ allow(subject).to receive(:application_exists?).and_return(true)
18
+ expect(subject).to_not receive(:create_application)
19
+ subject.create
20
20
  end
21
21
 
22
22
  it "does create if the application doesn't exist" do
23
- a.stub(:application_exists?).and_return(false)
24
- a.should_receive(:create_application)
25
- a.create
23
+ allow(subject).to receive(:application_exists?).and_return(false)
24
+ expect(subject).to receive(:create_application)
25
+ subject.create
26
26
  end
27
27
  end
28
28
 
29
29
  describe '#delete' do
30
- subject(:a) do
30
+ subject() do
31
31
  AWS.stub!
32
32
  a = Automan::Beanstalk::Application.new
33
33
  a.logger = Logger.new('/dev/null')
@@ -35,15 +35,15 @@ describe Automan::Beanstalk::Application do
35
35
  end
36
36
 
37
37
  it "does delete if the application already exists" do
38
- a.stub(:application_exists?).and_return(true)
39
- a.should_receive(:delete_application)
40
- a.delete
38
+ allow(subject).to receive(:application_exists?).and_return(true)
39
+ expect(subject).to receive(:delete_application)
40
+ subject.delete
41
41
  end
42
42
 
43
43
  it "does not delete if the application doesn't exist" do
44
- a.stub(:application_exists?).and_return(false)
45
- a.should_not_receive(:delete_application)
46
- a.delete
44
+ allow(subject).to receive(:application_exists?).and_return(false)
45
+ expect(subject).to_not receive(:delete_application)
46
+ subject.delete
47
47
  end
48
48
  end
49
49
  end
@@ -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
- c.eb.stub(:describe_configuration_settings).and_raise(error)
29
- c.config_template_exists?.should be_false
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
- c.fix_config_keys(config_before).should eq(config_after)
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
- c.stub(:config_template_exists?).and_return(true)
58
- c.should_not_receive(:create_config_template)
59
- c.create
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
- c.stub(:config_template_exists?).and_return(false)
64
- c.should_receive(:create_config_template)
65
- c.create
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
- c.stub(:config_template_exists?).and_return(true)
72
- c.should_receive(:delete_config_template)
73
- c.delete
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
- c.stub(:config_template_exists?).and_return(false)
78
- c.should_not_receive(:delete_config_template)
79
- c.delete
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
- c.stub(:config_template_exists?).and_return(true)
86
- c.should_receive(:delete_config_template)
87
- c.should_receive(:create_config_template)
88
- c.update
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
- c.stub(:config_template_exists?).and_return(false)
93
- c.should_not_receive(:delete_config_template)
94
- c.should_receive(:create_config_template)
95
- c.update
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 { should respond_to :name }
6
- it { should respond_to :version_label }
7
- it { should respond_to :package }
8
- it { should respond_to :environment }
9
- it { should respond_to :manifest }
10
- it { should respond_to :read_manifest }
11
- it { should respond_to :manifest_exists? }
12
- it { should respond_to :package_exists? }
13
- it { should respond_to :environment_status }
14
- it { should respond_to :configuration_template }
15
- it { should respond_to :deploy }
16
- it { should respond_to :update_environment }
17
- it { should respond_to :create_environment }
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(:bd) { Automan::Beanstalk::Deployer.new }
23
+ subject() { Automan::Beanstalk::Deployer.new }
24
24
 
25
25
  it "is at least 4 characters" do
26
- bd.name = "a"
27
- bd.environment = "a"
28
- bd.eb_environment_name.length.should be >= 4
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
- bd.name = "a" * 23
33
- bd.environment = "dev"
34
- bd.eb_environment_name.length.should be <= 23
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
- bd.name = '@#$%^foo_bar!$%&&E.'
39
- bd.environment = 'prod.baz'
40
- bd.eb_environment_name.should match(/[a-z0-9-]+/)
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
- bd.name = '--foo'
45
- bd.environment = 'bar--'
46
- bd.eb_environment_name.should match(/^[^-].*[^-]$/)
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
- bd.name = '--f'
51
- bd.environment = '-'
52
- bd.eb_environment_name.length.should be >= 4
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(:d) do
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
- d.stub(:manifest_exists?).and_return(false)
65
+ expect(subject).to receive(:manifest_exists?).and_return(false)
66
66
  expect {
67
- d.read_manifest
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
- d.stub(:manifest_exists?).and_return(true)
73
- d.stub(:s3_read).and_return('{"version_label": "foo", "package": "bar"}')
74
- d.read_manifest
75
- d.version_label.should eq('foo')
76
- d.package.should eq('bar')
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(:d) do
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
- d.stub(:package_exists?).and_return(false)
89
+ allow(subject).to receive(:package_exists?).and_return(false)
90
90
  expect {
91
- d.deploy
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
- d.stub(:package_exists?).and_return(true)
97
- d.should_receive(:ensure_version_exists)
98
- d.should_receive(:create_or_update_environment)
99
- d.deploy
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(:d) do
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(:version)
113
- version.stub(:exists?).and_return(false)
114
- version.should_receive(:create)
115
- d.stub(:get_version).and_return(version)
116
- d.ensure_version_exists
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(:version)
121
- version.stub(:exists?).and_return(true)
122
- version.should_not_receive(:create)
123
- d.stub(:get_version).and_return(version)
124
- d.ensure_version_exists
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(:d) do
129
+ subject() do
130
130
  AWS.stub!
131
131
  d = Automan::Beanstalk::Deployer.new
132
132
  d.logger = Logger.new('/dev/null')
133
- d.stub(:ensure_version_exists)
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
- d.stub(:environment_status).and_return(state)
140
- d.should_receive(:create_environment)
141
- d.create_or_update_environment
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
- d.stub(:environment_status).and_return(state)
148
- d.should_receive(:update_environment)
149
- d.create_or_update_environment
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
- d.stub(:environment_status).and_return('foo')
154
+ allow(subject).to receive(:environment_status).and_return('foo')
155
155
  expect {
156
- d.create_or_update_environment
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 { should respond_to :run }
6
- it { should respond_to :environment_name }
7
- it { should respond_to :hosted_zone_name }
8
- it { should respond_to :hostname }
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(:r) do
12
+ subject() do
13
13
  AWS.stub!
14
14
  r = Automan::Beanstalk::Router.new
15
15
  r.eb = AWS::ElasticBeanstalk::Client.new
@@ -23,41 +23,41 @@ describe Automan::Beanstalk::Router do
23
23
  end
24
24
 
25
25
  it "raises error if it never finds a name" do
26
- r.stub(:elb_cname_from_beanstalk_environment).and_return(nil)
26
+ allow(subject).to receive(:elb_cname_from_beanstalk_environment).and_return(nil)
27
27
  expect {
28
- r.run
28
+ subject.run
29
29
  }.to raise_error Wait::ResultInvalid
30
30
  end
31
31
 
32
32
  it "calls #update_dns_alias if it finds a name" do
33
- r.stub(:elb_cname_from_beanstalk_environment).and_return('foo')
34
- r.should_receive(:update_dns_alias)
35
- r.run
33
+ allow(subject).to receive(:elb_cname_from_beanstalk_environment).and_return('foo')
34
+ expect(subject).to receive(:update_dns_alias)
35
+ subject.run
36
36
  end
37
37
 
38
38
  it "ignores InvalidChangeBatch until last attempt" do
39
- r.stub(:elb_cname_from_beanstalk_environment).and_return('foo')
40
- r.stub(:update_dns_alias).and_raise AWS::Route53::Errors::InvalidChangeBatch
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
41
41
  expect {
42
- r.run
42
+ subject.run
43
43
  }.to raise_error AWS::Route53::Errors::InvalidChangeBatch
44
- r.attempts_made.should eq 5
44
+ expect(subject.attempts_made).to eq 5
45
45
  end
46
46
 
47
47
  it "ignores InvalidChangeBatch until it succeeds" do
48
- r.stub(:elb_cname_from_beanstalk_environment).and_return('foo')
48
+ allow(subject).to receive(:elb_cname_from_beanstalk_environment).and_return('foo')
49
49
 
50
50
  @attempts = 0
51
- r.stub(:update_dns_alias) do
51
+ allow(subject).to receive(:update_dns_alias) do
52
52
  @attempts += 1
53
53
  raise AWS::Route53::Errors::InvalidChangeBatch if @attempts < 3
54
54
  end
55
55
 
56
56
  expect {
57
- r.run
57
+ subject.run
58
58
  }.not_to raise_error
59
59
 
60
- r.attempts_made.should eq 3
60
+ expect(subject.attempts_made).to eq 3
61
61
  end
62
62
  end
63
63
  end