vagrant-chef-zero 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG.md +9 -0
- data/Makefile +1 -1
- data/README.md +19 -1
- data/Rakefile +8 -9
- data/Vagrantfile +9 -0
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +57 -41
- data/lib/vagrant-chef-zero/action/reconfig.rb +3 -1
- data/lib/vagrant-chef-zero/action/start.rb +3 -1
- data/lib/vagrant-chef-zero/action/stop.rb +3 -1
- data/lib/vagrant-chef-zero/env.rb +2 -0
- data/lib/vagrant-chef-zero/env_helpers.rb +16 -1
- data/lib/vagrant-chef-zero/plugin.rb +2 -0
- data/lib/vagrant-chef-zero/server_helpers.rb +17 -29
- data/lib/vagrant-chef-zero/version.rb +1 -1
- data/spec/lib/config_spec.rb +21 -22
- data/spec/lib/server_helpers_spec.rb +45 -38
- data/spec/spec_helper.rb +1 -13
- data/vagrant-chef-zero.gemspec +1 -3
- metadata +4 -36
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## 0.4.0
|
2
|
+
|
3
|
+
* Always write out a simple Knife configuration file to `.zero-knife.rb` to make it easier to use Knife with the server.
|
4
|
+
|
5
|
+
* Switch to RSpec for tests. Thanks to @tduffield for porting the existing tests.
|
6
|
+
|
7
|
+
* Chef-Zero now uses the Chef-Zero gem to manage starting and stopping of the server. While this may change in the future, it is the simplest solution for now.
|
8
|
+
|
9
|
+
|
1
10
|
## 0.3.0
|
2
11
|
|
3
12
|
* Add support for `chef_repo_path`, graciously provided by @tduffield via pull request, as I was taking too long.
|
data/Makefile
CHANGED
data/README.md
CHANGED
@@ -16,7 +16,7 @@ vagrant plugin install vagrant-chef-zero
|
|
16
16
|
|
17
17
|
### Compatability
|
18
18
|
|
19
|
-
Currently only NIX systems
|
19
|
+
Currently only tested on NIX systems, though I believe most NIX only commands have been removed.
|
20
20
|
|
21
21
|
As for Vagrant providers, it has only been tested with VirtualBox. It should be possible to add support for other providers by changing certain assumptions, such as always running Chef-Zero on the host machine.
|
22
22
|
|
@@ -63,6 +63,18 @@ These are uploaded via the `Ridley` gem. It is the same backend that `Berkshelf
|
|
63
63
|
|
64
64
|
Currently only JSON files are supported as we do not have the Chef libraries to serialize `.rb` files.
|
65
65
|
|
66
|
+
### Knife Configuration
|
67
|
+
|
68
|
+
When Chef-Zero starts, it will write out `zero-knife.rb` to your current directory. This will be a valid Knife configuration file with the following fields
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
chef_server_url "foo:bar"
|
72
|
+
node_name "baz"
|
73
|
+
client_key "/path/to/tmp/key.pem"
|
74
|
+
```
|
75
|
+
|
76
|
+
If you wish to manipulate the Chef Zero server manually, you can pass this config file to Knife with `-c .zero-knife.rb`
|
77
|
+
|
66
78
|
### Lingering Chef-Zero Servers
|
67
79
|
|
68
80
|
If for some reason you are unable to have Vagrant destroy the Chef-Zero server, you can find the PID it by running `lsof -i tcp:#{port}` where `port` is 4000 by default.
|
@@ -81,3 +93,9 @@ You don't need to specify one! If no url is specified, `Vagrant-Chef-Zero` will
|
|
81
93
|
|
82
94
|
Not required. As `Chef-Zero` does no authentication we can fake this. If it is left unspecified we will use a default value of `dummy-validator`.
|
83
95
|
|
96
|
+
# Contributors
|
97
|
+
|
98
|
+
* Tom Duffield (@tduffield)
|
99
|
+
* Ben Dean (@b-dean)
|
100
|
+
* Jesse Nelson (@spheromak)
|
101
|
+
* Mark Cornick (@markcornick)
|
data/Rakefile
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rake/testtask'
|
2
1
|
require 'bundler/setup'
|
3
2
|
require 'bundler/gem_tasks'
|
4
3
|
|
@@ -10,15 +9,14 @@ $stderr.sync = true
|
|
10
9
|
# Change to the directory of this file.
|
11
10
|
Dir.chdir(File.expand_path("../", __FILE__))
|
12
11
|
|
13
|
-
#
|
14
|
-
|
15
|
-
#Bundler::GemHelper.install_tasks
|
12
|
+
# Make testing the default task
|
13
|
+
task :default => "rspec_test"
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
task :rspec_test do |t|
|
16
|
+
test_output = %x[ bundle exec rspec spec ]
|
17
|
+
puts test_output
|
18
|
+
coverage = %x[ cat ./coverage/.last_run.json | grep covered | awk '{print $2}' ]
|
19
|
+
puts "Coverage: #{coverage}"
|
22
20
|
end
|
23
21
|
|
24
22
|
task :clean do |t|
|
@@ -28,4 +26,5 @@ task :clean do |t|
|
|
28
26
|
FileUtils.rm_rf '.vagrant'
|
29
27
|
FileUtils.rm_rf 'coverage'
|
30
28
|
FileUtils.rm_rf 'Gemfile.lock'
|
29
|
+
FileUtils.rm_rf 'zero-knife.rb'
|
31
30
|
end
|
data/Vagrantfile
CHANGED
@@ -10,9 +10,18 @@ Vagrant.configure("2") do |config|
|
|
10
10
|
#config.chef_zero.cookbooks = "spec/vagrant-chef-zero/fixtures/cookbooks"
|
11
11
|
#config.chef_zero.roles = "foobar"
|
12
12
|
|
13
|
+
# Single Box Config
|
13
14
|
config.vm.box = ENV['YIPIT_VAGRANT_BOX']
|
14
15
|
config.vm.provision :chef_client do |chef|
|
15
16
|
chef.run_list = [
|
16
17
|
]
|
17
18
|
end
|
19
|
+
|
20
|
+
# config.vm.define :box1 do |box1|
|
21
|
+
# box1.vm.box = ENV['YIPIT_VAGRANT_BOX']
|
22
|
+
# end
|
23
|
+
|
24
|
+
# config.vm.define :box2 do |box2|
|
25
|
+
# box2.vm.box = ENV['YIPIT_VAGRANT_BOX']
|
26
|
+
# end
|
18
27
|
end
|
data/coverage/.last_run.json
CHANGED
data/coverage/.resultset.json
CHANGED
@@ -65,6 +65,8 @@
|
|
65
65
|
1,
|
66
66
|
null,
|
67
67
|
1,
|
68
|
+
null,
|
69
|
+
1,
|
68
70
|
0,
|
69
71
|
0,
|
70
72
|
null,
|
@@ -79,40 +81,28 @@
|
|
79
81
|
1,
|
80
82
|
null,
|
81
83
|
1,
|
82
|
-
|
83
|
-
0,
|
84
|
-
0,
|
85
|
-
0,
|
86
|
-
0,
|
87
|
-
0,
|
88
|
-
0,
|
89
|
-
null,
|
90
|
-
0,
|
91
|
-
0,
|
92
|
-
0,
|
84
|
+
2,
|
93
85
|
null,
|
86
|
+
2,
|
87
|
+
1,
|
88
|
+
1,
|
94
89
|
null,
|
90
|
+
1,
|
91
|
+
1,
|
92
|
+
1,
|
95
93
|
null,
|
96
94
|
1,
|
97
95
|
0,
|
98
96
|
0,
|
99
|
-
0,
|
100
|
-
0,
|
101
|
-
0,
|
102
97
|
null,
|
103
98
|
null,
|
104
99
|
null,
|
105
|
-
1,
|
106
|
-
2,
|
107
|
-
2,
|
108
100
|
null,
|
109
101
|
null,
|
110
102
|
1,
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
null,
|
115
|
-
null,
|
103
|
+
1,
|
104
|
+
1,
|
105
|
+
1,
|
116
106
|
null,
|
117
107
|
null,
|
118
108
|
null,
|
@@ -120,31 +110,43 @@
|
|
120
110
|
null
|
121
111
|
],
|
122
112
|
"/Users/andrewgross/dev/andrew/vagrant-chef-zero/spec/lib/server_helpers_spec.rb": [
|
113
|
+
1,
|
123
114
|
1,
|
124
115
|
null,
|
125
116
|
1,
|
126
117
|
null,
|
127
118
|
1,
|
128
|
-
|
129
|
-
4,
|
119
|
+
1,
|
130
120
|
null,
|
131
121
|
null,
|
132
|
-
|
122
|
+
1,
|
133
123
|
null,
|
134
124
|
null,
|
135
125
|
1,
|
136
126
|
null,
|
137
|
-
|
138
|
-
1,
|
127
|
+
3,
|
139
128
|
null,
|
140
129
|
null,
|
130
|
+
4,
|
141
131
|
1,
|
132
|
+
3,
|
133
|
+
3,
|
134
|
+
3,
|
135
|
+
3,
|
136
|
+
null,
|
142
137
|
null,
|
143
138
|
1,
|
139
|
+
null,
|
144
140
|
1,
|
141
|
+
3,
|
142
|
+
3,
|
145
143
|
null,
|
146
144
|
null,
|
147
145
|
1,
|
146
|
+
null,
|
147
|
+
1,
|
148
|
+
2,
|
149
|
+
1,
|
148
150
|
1,
|
149
151
|
1,
|
150
152
|
null,
|
@@ -154,10 +156,10 @@
|
|
154
156
|
1,
|
155
157
|
null,
|
156
158
|
1,
|
159
|
+
2,
|
157
160
|
1,
|
161
|
+
2,
|
158
162
|
null,
|
159
|
-
null,
|
160
|
-
1,
|
161
163
|
1,
|
162
164
|
1,
|
163
165
|
null,
|
@@ -165,22 +167,36 @@
|
|
165
167
|
null,
|
166
168
|
null,
|
167
169
|
null,
|
170
|
+
1,
|
168
171
|
null,
|
169
172
|
1,
|
173
|
+
2,
|
170
174
|
null,
|
175
|
+
null,
|
176
|
+
1,
|
177
|
+
1,
|
171
178
|
1,
|
172
179
|
1,
|
173
180
|
null,
|
174
181
|
null,
|
175
|
-
1,
|
176
182
|
null,
|
183
|
+
null,
|
184
|
+
null
|
185
|
+
],
|
186
|
+
"/Users/andrewgross/dev/andrew/vagrant-chef-zero/lib/vagrant-chef-zero/env.rb": [
|
187
|
+
1,
|
177
188
|
1,
|
178
|
-
0,
|
179
|
-
0,
|
180
189
|
null,
|
181
190
|
null,
|
182
191
|
null,
|
192
|
+
1,
|
183
193
|
null,
|
194
|
+
1,
|
195
|
+
null,
|
196
|
+
1,
|
197
|
+
null,
|
198
|
+
1,
|
199
|
+
3,
|
184
200
|
null,
|
185
201
|
null,
|
186
202
|
null,
|
@@ -239,13 +255,13 @@
|
|
239
255
|
null,
|
240
256
|
null,
|
241
257
|
1,
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
258
|
+
5,
|
259
|
+
5,
|
260
|
+
5,
|
261
|
+
5,
|
262
|
+
5,
|
263
|
+
5,
|
264
|
+
5,
|
249
265
|
null,
|
250
266
|
null,
|
251
267
|
1,
|
@@ -253,7 +269,7 @@
|
|
253
269
|
null,
|
254
270
|
null,
|
255
271
|
1,
|
256
|
-
|
272
|
+
10,
|
257
273
|
null,
|
258
274
|
null,
|
259
275
|
1,
|
@@ -272,6 +288,6 @@
|
|
272
288
|
null
|
273
289
|
]
|
274
290
|
},
|
275
|
-
"timestamp":
|
291
|
+
"timestamp": 1376928062
|
276
292
|
}
|
277
293
|
}
|
@@ -19,6 +19,8 @@ module VagrantPlugins
|
|
19
19
|
|
20
20
|
@validation_client_name = get_validation_client_name(env)
|
21
21
|
set_config("@validation_client_name", @validation_client_name, env)
|
22
|
+
|
23
|
+
write_knife_config(env)
|
22
24
|
end
|
23
25
|
|
24
26
|
if berkshelf_enabled?(env)
|
@@ -35,4 +37,4 @@ module VagrantPlugins
|
|
35
37
|
|
36
38
|
end
|
37
39
|
end
|
38
|
-
end
|
40
|
+
end
|
@@ -2,6 +2,21 @@ module VagrantPlugins
|
|
2
2
|
module ChefZero
|
3
3
|
module EnvHelpers
|
4
4
|
|
5
|
+
def write_knife_config(env)
|
6
|
+
File.open("#{env[:root_path]}/.zero-knife.rb", 'w') do |f|
|
7
|
+
f.puts <<-EOF
|
8
|
+
chef_server_url '#{get_chef_server_url(env)}'
|
9
|
+
node_name 'zero-host'
|
10
|
+
client_key '#{get_key_path(env)}'
|
11
|
+
EOF
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def rm_knife_config(env)
|
16
|
+
File.unlink "#{env[:root_path]}/.zero-knife.rb" if File.exists? "#{env[:root_path]}/.zero-knife.rb"
|
17
|
+
File.unlink get_key_path(env) if File.exists? get_key_path(env)
|
18
|
+
end
|
19
|
+
|
5
20
|
def server_info(env)
|
6
21
|
dict = { host: nil, client_name: nil, client_key: nil }
|
7
22
|
provisioners(:chef_client, env).each do |provisioner|
|
@@ -102,4 +117,4 @@ module VagrantPlugins
|
|
102
117
|
|
103
118
|
end
|
104
119
|
end
|
105
|
-
end
|
120
|
+
end
|
@@ -37,6 +37,8 @@ module VagrantPlugins
|
|
37
37
|
|
38
38
|
action_hook(:chef_zero_up, :machine_action_up, &method(:provision))
|
39
39
|
|
40
|
+
action_hook(:chef_zero_reload, :machine_action_reload, &method(:provision))
|
41
|
+
|
40
42
|
action_hook(:chef_zero_provision, :machine_action_provision, &method(:provision))
|
41
43
|
|
42
44
|
action_hook(:chef_zero_provision, :machine_action_reload, &method(:provision))
|
@@ -3,42 +3,30 @@ module VagrantPlugins
|
|
3
3
|
module ServerHelpers
|
4
4
|
|
5
5
|
def start_chef_zero(env)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
require 'chef_zero/server'
|
7
|
+
|
8
|
+
unless env[:chef_zero].server && env[:chef_zero].server.running?
|
9
|
+
port = get_port(env)
|
10
|
+
host = get_host(env)
|
11
|
+
|
12
|
+
env[:chef_zero].server = ::ChefZero::Server.new(host: host, port: port)
|
13
|
+
env[:chef_zero].server.start_background
|
12
14
|
env[:chef_zero].ui.info("Starting Chef Zero at http://#{host}:#{port}")
|
13
|
-
end
|
14
|
-
while ! chef_zero_server_running?(port)
|
15
|
-
sleep 1
|
16
|
-
env[:chef_zero].ui.warn("Waiting for Chef Zero to start")
|
17
|
-
end
|
18
|
-
end
|
19
15
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
env[:chef_zero].ui.info("Stopping Chef Zero")
|
25
|
-
system("kill #{pid}")
|
16
|
+
until env[:chef_zero].server.running?
|
17
|
+
sleep 1
|
18
|
+
env[:chef_zero].ui.warn("Waiting for Chef Zero to start")
|
19
|
+
end
|
26
20
|
end
|
21
|
+
|
27
22
|
end
|
28
23
|
|
29
|
-
def
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
def get_chef_zero_server_pid(port)
|
35
|
-
pid = %x[ lsof -i tcp:#{port} | grep -E 'ruby|chef-zero' | awk '{print $2}' ]
|
36
|
-
if pid && pid != ""
|
37
|
-
return pid
|
24
|
+
def stop_chef_zero(env)
|
25
|
+
if env[:chef_zero].server && env[:chef_zero].server.running?
|
26
|
+
env[:chef_zero].ui.info("Stopping Chef Zero")
|
27
|
+
env[:chef_zero].server.stop
|
38
28
|
end
|
39
|
-
return nil
|
40
29
|
end
|
41
|
-
|
42
30
|
end
|
43
31
|
end
|
44
32
|
end
|
data/spec/lib/config_spec.rb
CHANGED
@@ -12,12 +12,12 @@ describe "VagrantPlugins::ChefZero::Config" do
|
|
12
12
|
it "should set all paths to nil" do
|
13
13
|
d = DummyClass.new
|
14
14
|
d.finalize!
|
15
|
-
d.chef_repo_path.
|
16
|
-
d.roles.
|
17
|
-
d.environments.
|
18
|
-
d.nodes.
|
19
|
-
d.cookbooks.
|
20
|
-
d.data_bags.
|
15
|
+
d.chef_repo_path.should eql nil
|
16
|
+
d.roles.should eql nil
|
17
|
+
d.environments.should eql nil
|
18
|
+
d.nodes.should eql nil
|
19
|
+
d.cookbooks.should eql nil
|
20
|
+
d.data_bags.should eql nil
|
21
21
|
end
|
22
22
|
|
23
23
|
end
|
@@ -28,21 +28,22 @@ describe "VagrantPlugins::ChefZero::Config" do
|
|
28
28
|
d = DummyClass.new
|
29
29
|
d.chef_repo_path = "/foo"
|
30
30
|
d.finalize!
|
31
|
-
d.chef_repo_path.
|
31
|
+
d.chef_repo_path.should eql "/foo"
|
32
32
|
end
|
33
33
|
|
34
34
|
|
35
35
|
it "should use sane defaults and prefix all fixture paths with the chef_repo_path" do
|
36
|
+
DummyClass.any_instance.stub(:path_exists?).and_return(true)
|
36
37
|
d = DummyClass.new
|
37
|
-
d.stubs(:path_exists?).returns(true)
|
38
|
+
#d.stubs(:path_exists?).returns(true)
|
38
39
|
d.chef_repo_path = "/foo"
|
39
40
|
d.finalize!
|
40
41
|
|
41
|
-
d.roles.
|
42
|
-
d.environments.
|
43
|
-
d.nodes.
|
44
|
-
d.cookbooks.
|
45
|
-
d.data_bags.
|
42
|
+
d.roles.should eql "/foo/roles"
|
43
|
+
d.environments.should eql "/foo/environments"
|
44
|
+
d.nodes.should eql "/foo/nodes"
|
45
|
+
d.cookbooks.should eql "/foo/cookbooks"
|
46
|
+
d.data_bags.should eql "/foo/data_bags"
|
46
47
|
end
|
47
48
|
|
48
49
|
|
@@ -54,7 +55,7 @@ describe "VagrantPlugins::ChefZero::Config" do
|
|
54
55
|
d.chef_repo_path = "/foo"
|
55
56
|
d.finalize!
|
56
57
|
|
57
|
-
d.roles.
|
58
|
+
d.roles.should eql nil
|
58
59
|
end
|
59
60
|
end
|
60
61
|
|
@@ -63,22 +64,20 @@ describe "VagrantPlugins::ChefZero::Config" do
|
|
63
64
|
describe "specific fixture path is also defined" do
|
64
65
|
|
65
66
|
it "should use sane defaults for all fixture paths except the overloaded path" do
|
66
|
-
DummyClass.any_instance.
|
67
|
+
DummyClass.any_instance.stub(:path_exists?).and_return(true)
|
67
68
|
d = DummyClass.new
|
68
69
|
d.chef_repo_path = "/foo"
|
69
70
|
d.roles = "/bar/roles"
|
70
71
|
d.finalize!
|
71
72
|
|
72
|
-
d.roles.
|
73
|
-
d.environments.
|
74
|
-
d.nodes.
|
75
|
-
d.cookbooks.
|
76
|
-
d.data_bags.
|
73
|
+
d.roles.should eql "/bar/roles"
|
74
|
+
d.environments.should eql "/foo/environments"
|
75
|
+
d.nodes.should eql "/foo/nodes"
|
76
|
+
d.cookbooks.should eql "/foo/cookbooks"
|
77
|
+
d.data_bags.should eql "/foo/data_bags"
|
77
78
|
end
|
78
79
|
|
79
80
|
end
|
80
81
|
end
|
81
82
|
|
82
|
-
|
83
|
-
|
84
83
|
end
|
@@ -1,65 +1,72 @@
|
|
1
1
|
require_relative '../spec_helper'
|
2
|
+
require 'chef_zero/server'
|
2
3
|
|
3
|
-
describe
|
4
|
-
|
5
|
-
|
6
|
-
class DummyClass
|
4
|
+
describe VagrantPlugins::ChefZero::ServerHelpers do
|
5
|
+
|
6
|
+
class DummyServerHelpers
|
7
7
|
include VagrantPlugins::ChefZero::ServerHelpers
|
8
8
|
end
|
9
9
|
|
10
|
-
|
10
|
+
class DummyChefZeroEnv < VagrantPlugins::ChefZero::Env
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "server is running" do
|
13
|
+
before do
|
14
|
+
# We need to prevent ChefZero::Server from actually binding to any addresses
|
15
|
+
::Puma::Server.any_instance.stub(:add_tcp_listener)
|
16
|
+
end
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
let(:d) { DummyServerHelpers.new }
|
19
|
+
let(:env) {
|
20
|
+
h = Hash.new
|
21
|
+
h[:chef_zero] = DummyChefZeroEnv.new
|
22
|
+
h[:machine] = double('machine')
|
23
|
+
h
|
24
|
+
}
|
24
25
|
|
25
|
-
|
26
|
-
port = "foo"
|
27
|
-
@d.chef_zero_server_running?(port).must_equal true
|
28
|
-
end
|
26
|
+
describe "#start_chef_zero" do
|
29
27
|
|
28
|
+
before do
|
29
|
+
d.stub(:get_port) { "4000" }
|
30
|
+
d.stub(:get_host) { "127.0.0.1" }
|
30
31
|
end
|
31
32
|
|
32
|
-
|
33
|
+
context "when chef-zero server is already running" do
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
port = "foo"
|
40
|
-
@d.chef_zero_server_running?(port).must_equal false
|
35
|
+
it "should take no action" do
|
36
|
+
env[:chef_zero].stub_chain(:server, :running?) { true }
|
37
|
+
env[:chef_zero].stub_chain(:server, :start_background)
|
38
|
+
d.start_chef_zero(env)
|
39
|
+
env[:chef_zero].server.should_not have_received(:start_background)
|
41
40
|
end
|
42
41
|
|
43
42
|
end
|
44
43
|
|
45
|
-
|
44
|
+
context "when chef-zero server is not running" do
|
46
45
|
|
47
|
-
|
46
|
+
it "should start the server in the background" do
|
47
|
+
env[:chef_zero].stub_chain(:server, :running?) { false }
|
48
|
+
env[:chef_zero].stub_chain(:server, :start_background) do
|
49
|
+
env[:chef_zero].stub_chain(:server, :running?) { true }
|
50
|
+
end
|
51
|
+
d.start_chef_zero(env)
|
52
|
+
env[:chef_zero].server.should have_received(:start_background)
|
53
|
+
end
|
48
54
|
|
49
|
-
it "should have an stop_chef_zero method" do
|
50
|
-
@d.must_respond_to(:stop_chef_zero)
|
51
55
|
end
|
56
|
+
end # describe #start_chef_zero
|
52
57
|
|
53
|
-
|
58
|
+
describe "#stop_chef_zero" do
|
54
59
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
60
|
+
before do
|
61
|
+
env[:chef_zero].stub_chain(:server, :running?) { true }
|
62
|
+
end
|
60
63
|
|
64
|
+
it "should stop server" do
|
65
|
+
env[:chef_zero].stub_chain(:server, :stop)
|
66
|
+
d.stop_chef_zero(env)
|
67
|
+
env[:chef_zero].server.should have_received(:stop)
|
61
68
|
end
|
62
69
|
|
63
|
-
end
|
70
|
+
end # describe #stop_chef_zero
|
64
71
|
|
65
72
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -6,16 +6,4 @@ require_relative "../lib/vagrant-chef-zero"
|
|
6
6
|
require_relative "../lib/vagrant-chef-zero/server_helpers.rb"
|
7
7
|
require_relative "../lib/vagrant-chef-zero.rb"
|
8
8
|
|
9
|
-
require '
|
10
|
-
require 'minitest/spec'
|
11
|
-
require 'minitest/mock'
|
12
|
-
require 'mocha/setup' # This should be after any minitest requires
|
13
|
-
require 'turn'
|
14
|
-
require 'json'
|
15
|
-
|
16
|
-
Turn.config do |c|
|
17
|
-
# :outline - turn's original case/test outline mode [default]
|
18
|
-
c.format = :outline
|
19
|
-
# use humanized test names (works only with :outline format)
|
20
|
-
c.natural = true
|
21
|
-
end
|
9
|
+
require 'json'
|
data/vagrant-chef-zero.gemspec
CHANGED
@@ -31,9 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.add_development_dependency "mocha"
|
32
32
|
s.add_development_dependency "simplecov"
|
33
33
|
s.add_development_dependency "rake"
|
34
|
-
s.add_development_dependency "
|
35
|
-
s.add_development_dependency "minitest", '< 5.0'
|
36
|
-
s.add_development_dependency "minitest-reporters"
|
34
|
+
s.add_development_dependency "rspec"
|
37
35
|
|
38
36
|
# The following block taken from @mitchellh 's vagrant-aws code
|
39
37
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-chef-zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef-zero
|
@@ -162,39 +162,7 @@ dependencies:
|
|
162
162
|
- !ruby/object:Gem::Version
|
163
163
|
version: '0'
|
164
164
|
- !ruby/object:Gem::Dependency
|
165
|
-
name:
|
166
|
-
requirement: !ruby/object:Gem::Requirement
|
167
|
-
none: false
|
168
|
-
requirements:
|
169
|
-
- - ! '>='
|
170
|
-
- !ruby/object:Gem::Version
|
171
|
-
version: '0'
|
172
|
-
type: :development
|
173
|
-
prerelease: false
|
174
|
-
version_requirements: !ruby/object:Gem::Requirement
|
175
|
-
none: false
|
176
|
-
requirements:
|
177
|
-
- - ! '>='
|
178
|
-
- !ruby/object:Gem::Version
|
179
|
-
version: '0'
|
180
|
-
- !ruby/object:Gem::Dependency
|
181
|
-
name: minitest
|
182
|
-
requirement: !ruby/object:Gem::Requirement
|
183
|
-
none: false
|
184
|
-
requirements:
|
185
|
-
- - <
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version: '5.0'
|
188
|
-
type: :development
|
189
|
-
prerelease: false
|
190
|
-
version_requirements: !ruby/object:Gem::Requirement
|
191
|
-
none: false
|
192
|
-
requirements:
|
193
|
-
- - <
|
194
|
-
- !ruby/object:Gem::Version
|
195
|
-
version: '5.0'
|
196
|
-
- !ruby/object:Gem::Dependency
|
197
|
-
name: minitest-reporters
|
165
|
+
name: rspec
|
198
166
|
requirement: !ruby/object:Gem::Requirement
|
199
167
|
none: false
|
200
168
|
requirements:
|
@@ -277,7 +245,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
277
245
|
version: '0'
|
278
246
|
segments:
|
279
247
|
- 0
|
280
|
-
hash: -
|
248
|
+
hash: -1000113792365389957
|
281
249
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
282
250
|
none: false
|
283
251
|
requirements:
|