cucumber-chef 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -2
- data/VERSION +1 -1
- data/bin/cucumber-chef +5 -9
- data/cucumber-chef.gemspec +13 -18
- data/spec/cucumber/chef/provisioner_spec.rb +0 -2
- data/website/website.html +385 -0
- metadata +105 -121
data/Gemfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.3
|
data/bin/cucumber-chef
CHANGED
@@ -2,23 +2,19 @@
|
|
2
2
|
require 'pathname'
|
3
3
|
require 'fileutils'
|
4
4
|
|
5
|
-
require 'rubygems'
|
6
|
-
require 'bundler/setup'
|
7
5
|
require 'thor'
|
8
|
-
|
9
|
-
$LOAD_PATH << File.join(File.dirname(__FILE__), '../lib')
|
10
6
|
require 'cucumber-chef'
|
11
7
|
|
12
8
|
class CucumberChef < Thor
|
13
9
|
include Thor::Actions
|
14
|
-
|
10
|
+
|
15
11
|
no_tasks do
|
16
12
|
def create_directory_structure(project_dir)
|
17
13
|
%w{step_definitions support}.each do |dir|
|
18
14
|
FileUtils.mkdir_p(project_dir + "features" + dir)
|
19
15
|
end
|
20
16
|
end
|
21
|
-
|
17
|
+
|
22
18
|
def generate_project_skeleton(project_dir)
|
23
19
|
template_dir = Pathname.new(__FILE__).parent.parent + 'lib' + 'cucumber' + 'chef' + 'templates'
|
24
20
|
CucumberChef.source_root template_dir.realpath
|
@@ -44,7 +40,7 @@ class CucumberChef < Thor
|
|
44
40
|
exit 255
|
45
41
|
end
|
46
42
|
end
|
47
|
-
|
43
|
+
|
48
44
|
desc "project <project name>" , "Create a project template for testing an infrastructure"
|
49
45
|
def project(project_name)
|
50
46
|
@project = project_name
|
@@ -52,7 +48,7 @@ class CucumberChef < Thor
|
|
52
48
|
create_directory_structure(project_dir)
|
53
49
|
generate_project_skeleton(project_dir)
|
54
50
|
end
|
55
|
-
|
51
|
+
|
56
52
|
desc "setup", "Set up a cucumber-chef test lab in Amazon EC2"
|
57
53
|
method_option :test, :type => :boolean
|
58
54
|
def setup
|
@@ -74,7 +70,7 @@ class CucumberChef < Thor
|
|
74
70
|
def connect
|
75
71
|
puts "Not implemented. For now, find the IP of your test lab using the info task, and connect manually."
|
76
72
|
end
|
77
|
-
|
73
|
+
|
78
74
|
desc "displayconfig", "Display the current config from knife.rb"
|
79
75
|
method_option :test, :type => :boolean
|
80
76
|
def displayconfig
|
data/cucumber-chef.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cucumber-chef}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Stephen Nelson-Smith"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-07-12}
|
13
13
|
s.default_executable = %q{cucumber-chef}
|
14
14
|
s.description = %q{Framework for behaviour-drive infrastructure development.}
|
15
15
|
s.email = %q{stephen@atalanta-systems.com}
|
@@ -75,7 +75,8 @@ Gem::Specification.new do |s|
|
|
75
75
|
"spec/cucumber/chef/config_spec.rb",
|
76
76
|
"spec/cucumber/chef/provisioner_spec.rb",
|
77
77
|
"spec/cucumber/chef/test_lab_spec.rb",
|
78
|
-
"spec/spec_helper.rb"
|
78
|
+
"spec/spec_helper.rb",
|
79
|
+
"website/website.html"
|
79
80
|
]
|
80
81
|
s.homepage = %q{http://cucumber-chef.org}
|
81
82
|
s.licenses = ["Apache v2"]
|
@@ -87,13 +88,11 @@ Gem::Specification.new do |s|
|
|
87
88
|
s.specification_version = 3
|
88
89
|
|
89
90
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
90
|
-
s.add_runtime_dependency(%q<
|
91
|
-
s.add_runtime_dependency(%q<chef>, [">= 0.10.
|
91
|
+
s.add_runtime_dependency(%q<rake>, ["~> 0.9.2"])
|
92
|
+
s.add_runtime_dependency(%q<chef>, [">= 0.10.2"])
|
92
93
|
s.add_runtime_dependency(%q<fog>, [">= 0"])
|
93
94
|
s.add_runtime_dependency(%q<thor>, [">= 0"])
|
94
|
-
s.
|
95
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
|
96
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
95
|
+
s.add_runtime_dependency(%q<net-scp>, [">= 0"])
|
97
96
|
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
98
97
|
s.add_development_dependency(%q<cucumber-nagios>, [">= 0"])
|
99
98
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
@@ -101,13 +100,11 @@ Gem::Specification.new do |s|
|
|
101
100
|
s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
|
102
101
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
103
102
|
else
|
104
|
-
s.add_dependency(%q<
|
105
|
-
s.add_dependency(%q<chef>, [">= 0.10.
|
103
|
+
s.add_dependency(%q<rake>, ["~> 0.9.2"])
|
104
|
+
s.add_dependency(%q<chef>, [">= 0.10.2"])
|
106
105
|
s.add_dependency(%q<fog>, [">= 0"])
|
107
106
|
s.add_dependency(%q<thor>, [">= 0"])
|
108
|
-
s.add_dependency(%q<
|
109
|
-
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
110
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
107
|
+
s.add_dependency(%q<net-scp>, [">= 0"])
|
111
108
|
s.add_dependency(%q<cucumber>, [">= 0"])
|
112
109
|
s.add_dependency(%q<cucumber-nagios>, [">= 0"])
|
113
110
|
s.add_dependency(%q<rspec>, [">= 0"])
|
@@ -116,13 +113,11 @@ Gem::Specification.new do |s|
|
|
116
113
|
s.add_dependency(%q<rcov>, [">= 0"])
|
117
114
|
end
|
118
115
|
else
|
119
|
-
s.add_dependency(%q<
|
120
|
-
s.add_dependency(%q<chef>, [">= 0.10.
|
116
|
+
s.add_dependency(%q<rake>, ["~> 0.9.2"])
|
117
|
+
s.add_dependency(%q<chef>, [">= 0.10.2"])
|
121
118
|
s.add_dependency(%q<fog>, [">= 0"])
|
122
119
|
s.add_dependency(%q<thor>, [">= 0"])
|
123
|
-
s.add_dependency(%q<
|
124
|
-
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
125
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
120
|
+
s.add_dependency(%q<net-scp>, [">= 0"])
|
126
121
|
s.add_dependency(%q<cucumber>, [">= 0"])
|
127
122
|
s.add_dependency(%q<cucumber-nagios>, [">= 0"])
|
128
123
|
s.add_dependency(%q<rspec>, [">= 0"])
|
@@ -46,8 +46,6 @@ describe Cucumber::Chef::Provisioner do
|
|
46
46
|
@test_lab.destroy
|
47
47
|
server = subject.build_test_lab(@config, StringIO.new)
|
48
48
|
@dns_name = server.dns_name
|
49
|
-
puts "Hanging around..." until tcp_test_ssh(server.public_ip_address)
|
50
|
-
puts "Got ssh..."
|
51
49
|
sleep(10)
|
52
50
|
subject.upload_cookbook(@config)
|
53
51
|
subject.upload_role(@config)
|
@@ -0,0 +1,385 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
2
|
+
"http://www.w3.org/TR/html4/strict.dtd">
|
3
|
+
|
4
|
+
<html lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
7
|
+
<title>Cucumber-chef</title>
|
8
|
+
<!-- Typekit service section -->
|
9
|
+
<script type="text/javascript"
|
10
|
+
src="http://use.typekit.com/jmb0kkz.js"></script>
|
11
|
+
|
12
|
+
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
|
13
|
+
<!-- End of typekit service section -->
|
14
|
+
|
15
|
+
<!-- Framework CSS --> <link rel="stylesheet" href="style/style.css"
|
16
|
+
type="text/css" media="screen, projection"> </head>
|
17
|
+
|
18
|
+
|
19
|
+
<body> <div class="container">
|
20
|
+
|
21
|
+
|
22
|
+
<div id="nav">
|
23
|
+
<ul>
|
24
|
+
<li class="selected">Main</li>
|
25
|
+
<li>Docs</li>
|
26
|
+
</ul>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div id="header">
|
30
|
+
<img src="images/cucumber-chef-logo.png" width="380" height="46"
|
31
|
+
alt="Cucumber Chef Logo"/>
|
32
|
+
|
33
|
+
<h3>A library of tools to enable test driven development</h3>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div class="page">
|
37
|
+
|
38
|
+
<div id="panel">
|
39
|
+
<a href="https://github.com/Atalanta/cucumber-chef"><img
|
40
|
+
src="images/large-button.png" width="252" height="52" class="imgpad"
|
41
|
+
alt="Git Hub" /></a>
|
42
|
+
|
43
|
+
<a href="http://oreilly.com/catalog/0636920020042"><img
|
44
|
+
src="images/book-cover.png" width="252" height="330" alt="Book
|
45
|
+
Cover"/></a>
|
46
|
+
|
47
|
+
<p class="book-description">Test-Driven Infrastructure with
|
48
|
+
Chef<br/>by Stephen Nelson-Smith<br/>Published by O’Reilly</p>
|
49
|
+
|
50
|
+
<a href="http://oreilly.com/catalog/0636920020042"><img
|
51
|
+
src="images/buy-button.png" width="62" height="27" alt="Buy
|
52
|
+
Button"/></a>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
<h2>Overview</h2>
|
57
|
+
|
58
|
+
<p><strong>Cucumber-chef</strong>is a library of tools to enable the
|
59
|
+
emerging discipline of infrastructure as code to practice test driven
|
60
|
+
development. It provides a testing platform within which cucumber
|
61
|
+
tests can be run which provision lightweight virtual machines,
|
62
|
+
configure them by applying the appriporaite Chef roles to them, and
|
63
|
+
then run acceptance and integration tests against the environment.</p>
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
<p>It begins with a very simple premise. with a very simple
|
68
|
+
premise. If we are framing our infratructure as code - if we're
|
69
|
+
writing cookbooks, recipes and other pieces of automation in a high
|
70
|
+
level programming language, such as Ruby, then it makes sense to
|
71
|
+
follow the current wisdom across the software development world to
|
72
|
+
maximise the quality, maintainability and reusability of our code,
|
73
|
+
providing maximum chance that we'll deliver value with it. One
|
74
|
+
area which has been shown to have a very positive effect is the
|
75
|
+
practive of 'test-driven' development. In this paradigm, the
|
76
|
+
developer begins by writing a test that captures the intended
|
77
|
+
behaviour of the code they are going to write. This test will
|
78
|
+
start out by failing. The developer then writes code to make the
|
79
|
+
test pass, and iterates thereafter.</p>
|
80
|
+
|
81
|
+
<strong>Cucumber-Chef</strong> provides a framework to make it easier
|
82
|
+
to do test-driven development for infrastructure. It does this by
|
83
|
+
providing a test infrastructure, in the cloud, which provides a very
|
84
|
+
fast, lightweight and cheap way to fire up virtual machines for
|
85
|
+
testing. We call this the "test lab".</p>
|
86
|
+
|
87
|
+
|
88
|
+
<p>As you might have guessed from the name, we're going to write high
|
89
|
+
level acceptance tests using Cucumber. Cucumber-Chef provides step
|
90
|
+
definitions and helper methods to make it easy to provision and manage
|
91
|
+
machines with Chef, and then build end-to-end tests.</p>
|
92
|
+
|
93
|
+
|
94
|
+
<ul> <li><strong>Test Lab:</strong> An environment made up (at
|
95
|
+
present) of an EC2 instance, configured to be an LXC host. This
|
96
|
+
machine does nothing other than provide space in which Linux
|
97
|
+
containers can be created and destroyed.</li>
|
98
|
+
|
99
|
+
<li><strong>Controller:</strong> One special Linux container which
|
100
|
+
acts as the central point from which tests are run. This machine is
|
101
|
+
where the tests run, and has connectivity and credentials to connect
|
102
|
+
to the machines that are created as part of a test run.</li>
|
103
|
+
|
104
|
+
<li><strong>Container:</strong> A container is a lightweight virtual
|
105
|
+
machine - it is entirely self-contained, with its own process tree,
|
106
|
+
resource constraints, filesystem and network stack. It shares a
|
107
|
+
kernel with the Test Lab host server.</li> </ul>
|
108
|
+
|
109
|
+
|
110
|
+
<h3>Getting Started</h3>
|
111
|
+
|
112
|
+
<p>Getting started with <strong>Cucumber-Chef</strong> is a simple,
|
113
|
+
three step process:</p>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<ul>
|
118
|
+
<li>1) Install Cucumber-Chef</li>
|
119
|
+
<li>2) Integrate with Hosted Chef and Amazon EC2</li>
|
120
|
+
<li>3) Run cucumber-chef setup</li>
|
121
|
+
</ul>
|
122
|
+
|
123
|
+
<h3>Installing Cucumber-Chef</h3>
|
124
|
+
|
125
|
+
<p>Installing Cucumber-Chef is simple. It's distributed as a
|
126
|
+
RubyGem, so you can simply run:</p>
|
127
|
+
|
128
|
+
|
129
|
+
<div class="inset-box">
|
130
|
+
<pre><code>$ gem install cucumber-chef
|
131
|
+
</code></pre>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
<p>Once installed, you can run cucumber-chef on the command line to
|
135
|
+
get an overview of the tasks it can carry out.</p>
|
136
|
+
|
137
|
+
|
138
|
+
<div class="inset-box">
|
139
|
+
<pre><code>$ cucumber-chef
|
140
|
+
Tasks:
|
141
|
+
cucumber-chef connect # Connect to a container in your test lab
|
142
|
+
cucumber-chef destroy # Destroy running test labs
|
143
|
+
cucumber-chef displayconfig # Display the current config from knife.rb
|
144
|
+
cucumber-chef help [TASK] # Describe available tasks or one specific task
|
145
|
+
cucumber-chef info # Display information about the current test lab
|
146
|
+
cucumber-chef project <project name> # Create a project template for testing an infrastructure
|
147
|
+
cucumber-chef setup # Set up a cucumber-chef test lab in Amazon EC2
|
148
|
+
cucumber-chef test # Run a cucumber-chef test suite from a workstation.
|
149
|
+
cucumber-chef upload <project name> # Upload a cucumber-chef test
|
150
|
+
</code></pre>
|
151
|
+
</div>
|
152
|
+
|
153
|
+
<h3>Integrate with Hosted Chef and Amazon EC2</h3>
|
154
|
+
|
155
|
+
<p>In it's current incarnation, Cucumber-Chef makes two important
|
156
|
+
assumptions. Firstly, it assumes you're using Opscode Hosted Chef
|
157
|
+
rather than your own Chef server. Secondly, it assume that you are
|
158
|
+
comfortable with using Amazon's EC2 service for providing the 'bare
|
159
|
+
metal' on which we set up the test lab. </p>
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
<p><strong>Cucumber-chef</strong> is tightly integrated with Chef - it
|
164
|
+
uses your knife.rb for credentials, and any cucumber-chef-specific
|
165
|
+
configuration goes in knife.rb under the cucumber-chef namespace.</p>
|
166
|
+
|
167
|
+
|
168
|
+
<p>On installation, the first thing you should do is run:</p>
|
169
|
+
|
170
|
+
<div class="inset-box">
|
171
|
+
<pre>
|
172
|
+
$ cucumber-chef displayconfig
|
173
|
+
</pre>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
<p>This will look for your knife.rb, and extract the relevant
|
177
|
+
sections, check them, and display them on the screen. If any entries
|
178
|
+
are missing, it will alert you.</p>
|
179
|
+
|
180
|
+
|
181
|
+
<p>The recommended best practice for Chef is to keep your knife.rb
|
182
|
+
inside your organisation's Chef repository, inside the .chef
|
183
|
+
directory, and use environment variables to specify username,
|
184
|
+
organisation name and cloud provider credentials. Cucumber-chef
|
185
|
+
supports and encourages this approach. It will search for a
|
186
|
+
directory called .chef in your current directory, and then carry on
|
187
|
+
going up the directory tree until it finds one. In practice this
|
188
|
+
means that if you stay within the chef-repo directory for the
|
189
|
+
organisation on which you're working, cucumber-chef will use the
|
190
|
+
knife.rb; if your elsewhere in the filesystem rooted in your home
|
191
|
+
directory, and have .chef in your home directory, cucumber-chef
|
192
|
+
will use that. Otherwise you'll need to either change into a
|
193
|
+
directory where a .chef can be found, or copy, creatre or link
|
194
|
+
accordingly. In most cases we anticipate that you'll be inside the
|
195
|
+
chef-repo of your organisation, and the documentation is written
|
196
|
+
from this perspective.</p>
|
197
|
+
|
198
|
+
<p>If you haven't already, refactor your knife.rb to look like this:</p>
|
199
|
+
|
200
|
+
<div class="inset-box">
|
201
|
+
<pre><code>current_dir = File.dirname(__FILE__)
|
202
|
+
user = ENV['OPSCODE_USER'] || ENV['USER']
|
203
|
+
log_level :info
|
204
|
+
log_location STDOUT
|
205
|
+
node_name user
|
206
|
+
client_key "#{ENV['HOME']}/.chef/#{user}.pem"
|
207
|
+
validation_client_name "#{ENV['ORGNAME']}-validator"
|
208
|
+
validation_key "#{ENV['HOME']}/.chef/#{ENV['ORGNAME']}-validator.pem"
|
209
|
+
chef_server_url "https://api.opscode.com/organizations/#{ENV['ORGNAME']}"
|
210
|
+
cache_type 'BasicFile'
|
211
|
+
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
|
212
|
+
cookbook_path ["#{current_dir}/../cookbooks"]
|
213
|
+
</code></pre>
|
214
|
+
</div>
|
215
|
+
|
216
|
+
<p>Now set your Hosted Chef username and organization name using
|
217
|
+
environment variables:</p>
|
218
|
+
|
219
|
+
|
220
|
+
<div class="inset-box">
|
221
|
+
<pre><code>$ export OPSCODE_USER=platform_user_name
|
222
|
+
$ export ORGNAME=platform_organisation
|
223
|
+
</code></pre>
|
224
|
+
</div>
|
225
|
+
|
226
|
+
<p>Now put your validator and client keys in $HOME/.chef. Verify that
|
227
|
+
everything still works:</p>
|
228
|
+
|
229
|
+
|
230
|
+
<div class="inset-box">
|
231
|
+
<pre><code>$ knife client list
|
232
|
+
</code></pre>
|
233
|
+
</div>
|
234
|
+
|
235
|
+
<p>If you get results back, we're in business.</p>
|
236
|
+
|
237
|
+
<p>Now add the EC2 configuration:</p>
|
238
|
+
|
239
|
+
<div class="inset-box">
|
240
|
+
<pre><code>knife[:aws_access_key_id] = ENV['AWS_ACCESS_KEY_ID']
|
241
|
+
knife[:aws_secret_access_key] = ENV['AWS_SECRET_ACCESS_KEY']
|
242
|
+
knife[:aws_ssh_key_id] = ENV['AWS_SSH_KEY_ID']
|
243
|
+
knife[:identity_file] = "/path/to/aws_ssh_key.pem"
|
244
|
+
knife[:availability_zone] = "eu-west-1a"
|
245
|
+
knife[:region] = "eu-west-1"
|
246
|
+
knife[:aws_image_id] = "ami-339ca947"
|
247
|
+
</code></pre>
|
248
|
+
</div>
|
249
|
+
|
250
|
+
<p>Note that right now Cucumber-Chef only supports Ubuntu-based test
|
251
|
+
labs.</p>
|
252
|
+
|
253
|
+
|
254
|
+
<p>And set your environment variables:</p>
|
255
|
+
|
256
|
+
<div class="inset-box">
|
257
|
+
<pre><code>$ export AWS_ACCESS_KEY_ID=SEKRITKEY
|
258
|
+
$ export AWS_SECRET_ACCESS_KEY=REELYSEKRITKEY
|
259
|
+
$ export AWS_SSH_KEY_ID
|
260
|
+
</code></pre>
|
261
|
+
</div>
|
262
|
+
|
263
|
+
<p>And then ensure your AWS ssh key is in place.</p>
|
264
|
+
|
265
|
+
<p>Now check your config again, with cucumber-chef display config. If
|
266
|
+
you get no complaints, you're ready to set up a test lab.</p>
|
267
|
+
|
268
|
+
|
269
|
+
<h3>Run cucumber-chef setup</h3>
|
270
|
+
|
271
|
+
<div class="inset-box">
|
272
|
+
<pre><code>$ cucumber-chef setup
|
273
|
+
</code></pre>
|
274
|
+
</div>
|
275
|
+
|
276
|
+
<p>This command will set up a complete test lab environment, As long
|
277
|
+
as you've provided valid AWS and Opscode credentials, it will do this
|
278
|
+
automatically. The process takes about 15 minutes, after which you'll
|
279
|
+
have a fully funtioning platform available for you to use. Let's just
|
280
|
+
quickly review what that means. You will have an EC2 machine, fully
|
281
|
+
managed by Chef, and providing the following:</p>
|
282
|
+
|
283
|
+
|
284
|
+
<ul>
|
285
|
+
<li>The ability to provision LXC containers</li>
|
286
|
+
<li>The ability to run tests against LXC containers</li>
|
287
|
+
<li>A dedicated container for certain kinds of testing scenarios</li>
|
288
|
+
</ul>
|
289
|
+
|
290
|
+
<p>The next stage is to set up a project. A project is simply a
|
291
|
+
directory structure for containing your cucumber features and steps,
|
292
|
+
already set up with an appropriate environment to make use of the
|
293
|
+
step definitions provided with cucumber-chef. We think it makes
|
294
|
+
most sense to have this in your organisation's chef repo.
|
295
|
+
Cucumber-chef provides a task which will create a the directory for
|
296
|
+
you, and populate it with a README and an example feature and
|
297
|
+
step.</p>
|
298
|
+
|
299
|
+
|
300
|
+
<div class="inset-box">
|
301
|
+
<pre><code>$ cd /path/to/chef-repo
|
302
|
+
$ cucumber-chef project example
|
303
|
+
</code></pre>
|
304
|
+
</div>
|
305
|
+
|
306
|
+
<p>This will create a directory, cucumber-chef, and a subdirectory, example.</p>
|
307
|
+
|
308
|
+
<div class="inset-box">
|
309
|
+
<pre><code>└── example
|
310
|
+
├── README
|
311
|
+
└── features
|
312
|
+
├── example.feature
|
313
|
+
├── step_definitions
|
314
|
+
│ └── example_step.rb
|
315
|
+
└── support
|
316
|
+
└── env.rb
|
317
|
+
</code></pre>
|
318
|
+
</div>
|
319
|
+
|
320
|
+
<h2>Writing tests</h2>
|
321
|
+
|
322
|
+
<p>Once you've got your test lab set up, and you've generated a
|
323
|
+
project, it's time to crack on with writing a test. The basic idea is
|
324
|
+
this:</p>
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
<p>
|
329
|
+
<ul>
|
330
|
+
<li>1) An infrastructure requirement is established</li>
|
331
|
+
<li>2) Write a cucumber feature that expresses the required
|
332
|
+
behaviour of the infrastructure requirement</li>
|
333
|
+
|
334
|
+
<li>3) Write steps that will build this infrastructure environment
|
335
|
+
on the test lab, using the step definitions provided - these include
|
336
|
+
the ability to create a container, apply roles to it, and destroy it
|
337
|
+
again.</li>
|
338
|
+
|
339
|
+
<li>4) Write cookbooks and recipes and supporting code to make
|
340
|
+
the test pass</li>
|
341
|
+
</ul></p>
|
342
|
+
|
343
|
+
<h2>Running tests</h2>
|
344
|
+
|
345
|
+
<p>You can write the tests and Chef code wherever you like. We're
|
346
|
+
assuming you prefer working on your local machine, and checking into
|
347
|
+
version control. But we don't really care. When it's time to run
|
348
|
+
tests, cucumber-chef provides a task which handles this:</p>
|
349
|
+
|
350
|
+
|
351
|
+
<div class="inset-box">
|
352
|
+
<pre><code>$ cucumber-chef test myproject
|
353
|
+
</code></pre>
|
354
|
+
</div>
|
355
|
+
|
356
|
+
<p>At the moment cucumber-chef doesn't pass though clever filtering
|
357
|
+
and tagging options that cucumber supports - you run all the tests.
|
358
|
+
We're going to improve that soon, again, patches and pull requests
|
359
|
+
very welcome.</p>
|
360
|
+
|
361
|
+
|
362
|
+
<p>Running the test task will upload your current project to the test
|
363
|
+
lab, and run the tests, reporting the results back to the screen.
|
364
|
+
Cucumber-chef also provides an upload task, so you can push the
|
365
|
+
current project to the test lab, and then connect to test lab yourself
|
366
|
+
to run tests in a more granular way. To do this, you need to know the
|
367
|
+
IP of the test lab. You can find this out by running:</p>
|
368
|
+
|
369
|
+
|
370
|
+
<div class="inset-box">
|
371
|
+
<pre><code>$ cucumber-chef info
|
372
|
+
</code></pre>
|
373
|
+
</div>
|
374
|
+
|
375
|
+
<p>At present, Cucumber-Chef only allows one test lab per AWS account
|
376
|
+
and Opscode Hosted Chef account.</p>
|
377
|
+
|
378
|
+
|
379
|
+
</div>
|
380
|
+
|
381
|
+
</div>
|
382
|
+
|
383
|
+
</body>
|
384
|
+
|
385
|
+
</html>
|
metadata
CHANGED
@@ -1,169 +1,149 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-chef
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.2
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 1.0.3
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Stephen Nelson-Smith
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
12
|
+
|
13
|
+
date: 2011-07-12 00:00:00 +01:00
|
13
14
|
default_executable: cucumber-chef
|
14
|
-
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
requirement: &
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rake
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
19
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version:
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.9.2
|
23
24
|
type: :runtime
|
24
25
|
prerelease: false
|
25
|
-
version_requirements: *
|
26
|
-
- !ruby/object:Gem::Dependency
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
27
28
|
name: chef
|
28
|
-
requirement: &
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
29
30
|
none: false
|
30
|
-
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.10.
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.10.2
|
34
35
|
type: :runtime
|
35
36
|
prerelease: false
|
36
|
-
version_requirements: *
|
37
|
-
- !ruby/object:Gem::Dependency
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
38
39
|
name: fog
|
39
|
-
requirement: &
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
41
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version:
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
45
46
|
type: :runtime
|
46
47
|
prerelease: false
|
47
|
-
version_requirements: *
|
48
|
-
- !ruby/object:Gem::Dependency
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
49
50
|
name: thor
|
50
|
-
requirement: &
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
51
52
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version:
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
56
57
|
type: :runtime
|
57
58
|
prerelease: false
|
58
|
-
version_requirements: *
|
59
|
-
- !ruby/object:Gem::Dependency
|
60
|
-
name:
|
61
|
-
requirement: &
|
62
|
-
none: false
|
63
|
-
requirements:
|
64
|
-
- - ~>
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: 1.0.0
|
67
|
-
type: :development
|
68
|
-
prerelease: false
|
69
|
-
version_requirements: *10129500
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: jeweler
|
72
|
-
requirement: &10128800 !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 1.6.2
|
78
|
-
type: :development
|
79
|
-
prerelease: false
|
80
|
-
version_requirements: *10128800
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
name: rcov
|
83
|
-
requirement: &10128080 !ruby/object:Gem::Requirement
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: net-scp
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
84
63
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version:
|
89
|
-
type: :
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
type: :runtime
|
90
69
|
prerelease: false
|
91
|
-
version_requirements: *
|
92
|
-
- !ruby/object:Gem::Dependency
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
93
72
|
name: cucumber
|
94
|
-
requirement: &
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
95
74
|
none: false
|
96
|
-
requirements:
|
97
|
-
- -
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version:
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
100
79
|
type: :development
|
101
80
|
prerelease: false
|
102
|
-
version_requirements: *
|
103
|
-
- !ruby/object:Gem::Dependency
|
81
|
+
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
104
83
|
name: cucumber-nagios
|
105
|
-
requirement: &
|
84
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
106
85
|
none: false
|
107
|
-
requirements:
|
108
|
-
- -
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version:
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: "0"
|
111
90
|
type: :development
|
112
91
|
prerelease: false
|
113
|
-
version_requirements: *
|
114
|
-
- !ruby/object:Gem::Dependency
|
92
|
+
version_requirements: *id007
|
93
|
+
- !ruby/object:Gem::Dependency
|
115
94
|
name: rspec
|
116
|
-
requirement: &
|
95
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
117
96
|
none: false
|
118
|
-
requirements:
|
119
|
-
- -
|
120
|
-
- !ruby/object:Gem::Version
|
121
|
-
version:
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: "0"
|
122
101
|
type: :development
|
123
102
|
prerelease: false
|
124
|
-
version_requirements: *
|
125
|
-
- !ruby/object:Gem::Dependency
|
103
|
+
version_requirements: *id008
|
104
|
+
- !ruby/object:Gem::Dependency
|
126
105
|
name: bundler
|
127
|
-
requirement: &
|
106
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
128
107
|
none: false
|
129
|
-
requirements:
|
108
|
+
requirements:
|
130
109
|
- - ~>
|
131
|
-
- !ruby/object:Gem::Version
|
110
|
+
- !ruby/object:Gem::Version
|
132
111
|
version: 1.0.0
|
133
112
|
type: :development
|
134
113
|
prerelease: false
|
135
|
-
version_requirements: *
|
136
|
-
- !ruby/object:Gem::Dependency
|
114
|
+
version_requirements: *id009
|
115
|
+
- !ruby/object:Gem::Dependency
|
137
116
|
name: jeweler
|
138
|
-
requirement: &
|
117
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
139
118
|
none: false
|
140
|
-
requirements:
|
119
|
+
requirements:
|
141
120
|
- - ~>
|
142
|
-
- !ruby/object:Gem::Version
|
121
|
+
- !ruby/object:Gem::Version
|
143
122
|
version: 1.6.2
|
144
123
|
type: :development
|
145
124
|
prerelease: false
|
146
|
-
version_requirements: *
|
147
|
-
- !ruby/object:Gem::Dependency
|
125
|
+
version_requirements: *id010
|
126
|
+
- !ruby/object:Gem::Dependency
|
148
127
|
name: rcov
|
149
|
-
requirement: &
|
128
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
150
129
|
none: false
|
151
|
-
requirements:
|
152
|
-
- -
|
153
|
-
- !ruby/object:Gem::Version
|
154
|
-
version:
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: "0"
|
155
134
|
type: :development
|
156
135
|
prerelease: false
|
157
|
-
version_requirements: *
|
136
|
+
version_requirements: *id011
|
158
137
|
description: Framework for behaviour-drive infrastructure development.
|
159
138
|
email: stephen@atalanta-systems.com
|
160
|
-
executables:
|
139
|
+
executables:
|
161
140
|
- cucumber-chef
|
162
141
|
extensions: []
|
163
|
-
|
142
|
+
|
143
|
+
extra_rdoc_files:
|
164
144
|
- LICENSE
|
165
145
|
- README.md
|
166
|
-
files:
|
146
|
+
files:
|
167
147
|
- .document
|
168
148
|
- .gitignore
|
169
149
|
- Gemfile
|
@@ -221,33 +201,37 @@ files:
|
|
221
201
|
- spec/cucumber/chef/provisioner_spec.rb
|
222
202
|
- spec/cucumber/chef/test_lab_spec.rb
|
223
203
|
- spec/spec_helper.rb
|
204
|
+
- website/website.html
|
224
205
|
has_rdoc: true
|
225
206
|
homepage: http://cucumber-chef.org
|
226
|
-
licenses:
|
207
|
+
licenses:
|
227
208
|
- Apache v2
|
228
209
|
post_install_message:
|
229
210
|
rdoc_options: []
|
230
|
-
|
211
|
+
|
212
|
+
require_paths:
|
231
213
|
- lib
|
232
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
214
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
233
215
|
none: false
|
234
|
-
requirements:
|
235
|
-
- -
|
236
|
-
- !ruby/object:Gem::Version
|
237
|
-
|
238
|
-
segments:
|
216
|
+
requirements:
|
217
|
+
- - ">="
|
218
|
+
- !ruby/object:Gem::Version
|
219
|
+
hash: -2659917113260781265
|
220
|
+
segments:
|
239
221
|
- 0
|
240
|
-
|
241
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
|
+
version: "0"
|
223
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
242
224
|
none: false
|
243
|
-
requirements:
|
244
|
-
- -
|
245
|
-
- !ruby/object:Gem::Version
|
246
|
-
version:
|
225
|
+
requirements:
|
226
|
+
- - ">="
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: "0"
|
247
229
|
requirements: []
|
230
|
+
|
248
231
|
rubyforge_project:
|
249
232
|
rubygems_version: 1.6.2
|
250
233
|
signing_key:
|
251
234
|
specification_version: 3
|
252
235
|
summary: Tests Chef-built infrastructure
|
253
236
|
test_files: []
|
237
|
+
|