cucumber-chef 1.0.3 → 2.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/.gitignore +8 -35
  2. data/.rspec +1 -0
  3. data/.rvmrc.template +2 -0
  4. data/.travis.yml +22 -0
  5. data/Gemfile +2 -15
  6. data/LICENSE +202 -201
  7. data/NOTICE +9 -0
  8. data/README.md +696 -92
  9. data/Rakefile +39 -25
  10. data/TODO.md +28 -0
  11. data/bin/cc-knife +32 -0
  12. data/bin/cucumber-chef +409 -79
  13. data/chef_repo/cookbooks/cucumber-chef/LICENSE +202 -0
  14. data/chef_repo/cookbooks/cucumber-chef/README.md +69 -0
  15. data/chef_repo/cookbooks/cucumber-chef/attributes/default.rb +27 -0
  16. data/chef_repo/cookbooks/cucumber-chef/metadata.rb +13 -0
  17. data/chef_repo/cookbooks/cucumber-chef/recipes/default.rb +23 -0
  18. data/chef_repo/cookbooks/cucumber-chef/recipes/lxc.rb +315 -0
  19. data/chef_repo/cookbooks/cucumber-chef/recipes/test_lab.rb +146 -0
  20. data/chef_repo/cookbooks/cucumber-chef/templates/default/db-168-192.erb +15 -0
  21. data/chef_repo/cookbooks/cucumber-chef/templates/default/db-test-lab.erb +15 -0
  22. data/chef_repo/cookbooks/cucumber-chef/templates/default/dhcpd-conf.erb +44 -0
  23. data/chef_repo/cookbooks/cucumber-chef/templates/default/gemrc.erb +10 -0
  24. data/{cookbooks/cucumber-chef/files/default/cucumber-net → chef_repo/cookbooks/cucumber-chef/templates/default/lxc-initializer-config.erb} +1 -1
  25. data/chef_repo/cookbooks/cucumber-chef/templates/default/lxc-install-chef.erb +3 -0
  26. data/chef_repo/cookbooks/cucumber-chef/templates/default/motd.erb +10 -0
  27. data/chef_repo/cookbooks/cucumber-chef/templates/default/named-conf-local.erb +25 -0
  28. data/{cookbooks/cucumber-chef/files/default/permissive-ssh-config → chef_repo/cookbooks/cucumber-chef/templates/default/ssh-config.erb} +3 -1
  29. data/chef_repo/roles/test_lab.rb +24 -0
  30. data/cucumber-chef.gemspec +50 -123
  31. data/examples/README.md +7 -0
  32. data/examples/users_add.feature +51 -0
  33. data/examples/users_auto_remove.feature +50 -0
  34. data/features/support/env.rb +3 -2
  35. data/lib/cucumber/chef/bootstrap.rb +94 -0
  36. data/lib/cucumber/chef/command.rb +78 -0
  37. data/lib/cucumber/chef/config.rb +143 -93
  38. data/lib/cucumber/chef/helpers/chef_client.rb +87 -0
  39. data/lib/cucumber/chef/helpers/chef_server.rb +90 -0
  40. data/lib/cucumber/chef/helpers/command.rb +57 -0
  41. data/lib/cucumber/chef/helpers/container.rb +154 -0
  42. data/lib/cucumber/chef/helpers/minitest.rb +35 -0
  43. data/lib/cucumber/chef/helpers/server.rb +81 -0
  44. data/lib/cucumber/chef/helpers/test_lab.rb +46 -0
  45. data/lib/cucumber/chef/helpers/utility.rb +73 -0
  46. data/lib/cucumber/chef/helpers.rb +56 -0
  47. data/lib/cucumber/chef/logger.rb +90 -0
  48. data/lib/cucumber/chef/provisioner.rb +275 -69
  49. data/lib/cucumber/chef/ssh.rb +190 -0
  50. data/lib/cucumber/chef/steps/chef_steps.rb +32 -0
  51. data/lib/cucumber/chef/steps/minitest_steps.rb +29 -0
  52. data/lib/cucumber/chef/steps/provision_steps.rb +60 -0
  53. data/lib/cucumber/chef/steps/ssh_steps.rb +95 -0
  54. data/lib/cucumber/chef/steps.rb +27 -0
  55. data/lib/cucumber/chef/tcp_socket.rb +83 -0
  56. data/lib/cucumber/chef/template.rb +57 -0
  57. data/lib/cucumber/chef/templates/bootstrap/ubuntu-precise-test-lab.erb +99 -0
  58. data/lib/cucumber/chef/templates/cucumber/env.rb +56 -0
  59. data/lib/cucumber/chef/templates/cucumber/example_feature.erb +49 -0
  60. data/lib/cucumber/chef/templates/cucumber/example_steps.erb +11 -0
  61. data/lib/cucumber/chef/templates/cucumber/readme-data_bags.erb +1 -0
  62. data/lib/cucumber/chef/templates/cucumber/readme-keys.erb +1 -0
  63. data/lib/cucumber/chef/templates/cucumber/readme-roles.erb +1 -0
  64. data/lib/cucumber/chef/templates/cucumber/readme.erb +18 -0
  65. data/lib/cucumber/chef/templates/cucumber-chef/config-rb.erb +33 -0
  66. data/lib/cucumber/chef/templates/cucumber-chef/cucumber-yml.erb +2 -0
  67. data/lib/cucumber/chef/templates/cucumber-chef/knife-rb.erb +18 -0
  68. data/lib/cucumber/chef/test_lab.rb +308 -52
  69. data/lib/cucumber/chef/test_runner.rb +86 -15
  70. data/lib/cucumber/chef/utility.rb +128 -0
  71. data/lib/cucumber/chef/version.rb +30 -1
  72. data/lib/cucumber/chef.rb +53 -20
  73. data/lib/cucumber-chef.rb +24 -1
  74. data/spec/cucumber/chef/config_spec.rb +144 -78
  75. data/spec/cucumber/chef/provisioner_spec.rb +60 -16
  76. data/spec/cucumber/chef/test_lab_spec.rb +62 -19
  77. data/spec/spec_helper.rb +30 -26
  78. data/todo.org +17 -0
  79. metadata +267 -163
  80. data/.document +0 -5
  81. data/VERSION +0 -1
  82. data/cookbooks/cucumber-chef/README.rdoc +0 -8
  83. data/cookbooks/cucumber-chef/files/default/add-git-identity +0 -2
  84. data/cookbooks/cucumber-chef/files/default/controller-first-boot +0 -1
  85. data/cookbooks/cucumber-chef/files/default/cucumber-private-key +0 -27
  86. data/cookbooks/cucumber-chef/files/default/cucumber-run_list +0 -1
  87. data/cookbooks/cucumber-chef/files/default/git-private-key +0 -27
  88. data/cookbooks/cucumber-chef/files/default/install-chef +0 -1
  89. data/cookbooks/cucumber-chef/files/default/lxc-controller-network-config +0 -5
  90. data/cookbooks/cucumber-chef/files/default/lxc-lucid-chef +0 -378
  91. data/cookbooks/cucumber-chef/metadata.rb +0 -6
  92. data/cookbooks/cucumber-chef/recipes/controller.rb +0 -51
  93. data/cookbooks/cucumber-chef/recipes/lxc.rb +0 -35
  94. data/cookbooks/cucumber-chef/recipes/test_lab.rb +0 -23
  95. data/cookbooks/cucumber-chef/recipes/testrunner.rb +0 -46
  96. data/cookbooks/cucumber-chef/roles/controller.rb +0 -7
  97. data/cookbooks/cucumber-chef/roles/test_lab_test.rb +0 -9
  98. data/cookbooks/cucumber-chef/templates/default/controller-client.erb +0 -5
  99. data/cookbooks/cucumber-chef/templates/default/lxc-lucid-chef +0 -385
  100. data/lib/cucumber/chef/handy.rb +0 -90
  101. data/lib/cucumber/chef/templates/controller.erb +0 -35
  102. data/lib/cucumber/chef/templates/env.rb +0 -16
  103. data/lib/cucumber/chef/templates/example_feature.erb +0 -11
  104. data/lib/cucumber/chef/templates/example_step.erb +0 -19
  105. data/lib/cucumber/chef/templates/readme.erb +0 -14
  106. data/lib/cucumber/chef/templates/ubuntu10.04-gems.erb +0 -43
  107. data/lib/cucumber/ec2_server_create.rb +0 -99
  108. data/website/website.html +0 -385
@@ -0,0 +1,146 @@
1
+ ################################################################################
2
+ #
3
+ # Author: Zachary Patten <zachary@jovelabs.com>
4
+ # Copyright: Copyright (c) 2011-2012 Atalanta Systems Ltd
5
+ # License: Apache License, Version 2.0
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ ################################################################################
20
+
21
+
22
+ %w( build-essential wget chkconfig ruby-full ruby-dev libxml2-dev libxslt1-dev ).each do |p|
23
+ package p
24
+ end
25
+
26
+ bash "install rubygems" do
27
+ code <<-EOH
28
+ cd /tmp
29
+ wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.19.tgz
30
+ tar zxf rubygems-1.8.19.tgz
31
+ cd rubygems-1.8.19
32
+ ruby setup.rb --no-format-executable
33
+ EOH
34
+ end
35
+
36
+ gem_package "cucumber-chef" do
37
+ gem_binary("/usr/bin/gem")
38
+
39
+ if node['cucumber_chef']['prerelease']
40
+ options("--prerelease")
41
+ end
42
+ end
43
+
44
+ %w( rspec ).each do |g|
45
+ gem_package g do
46
+ gem_binary("/usr/bin/gem")
47
+ end
48
+ end
49
+
50
+ ################################################################################
51
+ # CHEF-CLIENT
52
+ ################################################################################
53
+ service "chef-client"
54
+
55
+ execute "set chef-client logging to debug" do
56
+ command "sed -i \"s/log_level :info/log_level :debug/\" /etc/chef/client.rb"
57
+
58
+ notifies :restart, "service[chef-client]"
59
+
60
+ only_if do
61
+ %x( cat /etc/chef/client.rb | grep "log_level :info" )
62
+ ($? == 0)
63
+ end
64
+ end
65
+
66
+
67
+ ################################################################################
68
+ # SYSTEM TWEAKS
69
+ ################################################################################
70
+
71
+ %w( root ubuntu ).each do |user|
72
+ home_dir = (user == "root" ? "/#{user}" : "/home/#{user}")
73
+
74
+ directory "create .ssh directory for #{user}" do
75
+ path "#{home_dir}/.ssh"
76
+ owner user
77
+ group user
78
+ mode "0700"
79
+
80
+ not_if { File.directory?(File.join(home_dir, ".ssh")) }
81
+ end
82
+
83
+ template "create ssh config for #{user}" do
84
+ path "#{home_dir}/.ssh/config"
85
+ source "ssh-config.erb"
86
+ owner user
87
+ group user
88
+ mode "0600"
89
+
90
+ not_if { File.exists?(File.join(home_dir, ".ssh", "config")) }
91
+ end
92
+
93
+ template "create .gemrc for #{user}" do
94
+ path "#{home_dir}/.gemrc"
95
+ source "gemrc.erb"
96
+ owner user
97
+ group user
98
+ mode "0644"
99
+
100
+ not_if { File.exists?(File.join(home_dir, ".gemrc")) }
101
+ end
102
+
103
+ execute "generate ssh keypair for #{user}" do
104
+ command "ssh-keygen -q -N '' -f #{home_dir}/.ssh/id_rsa"
105
+
106
+ not_if { File.exists?(File.join(home_dir, ".ssh", "id_rsa")) }
107
+ end
108
+
109
+ file "ensure ssh private key ownership for #{user}" do
110
+ path "#{home_dir}/.ssh/id_rsa"
111
+ owner user
112
+ group user
113
+ end
114
+
115
+ file "ensure ssh public key ownership for #{user}" do
116
+ path "#{home_dir}/.ssh/id_rsa.pub"
117
+ owner user
118
+ group user
119
+ end
120
+
121
+ execute "copy public key into authorized_keys for #{user}" do
122
+ command "cat #{home_dir}/.ssh/id_rsa.pub | tee -a #{home_dir}/.ssh/authorized_keys"
123
+
124
+ not_if do
125
+ %x( cat #{home_dir}/.ssh/authorized_keys | grep "`cat #{home_dir}/.ssh/id_rsa.pub`" )
126
+ ($? == 0)
127
+ end
128
+ end
129
+ end
130
+
131
+ file "remove update-motd" do
132
+ path "/etc/motd"
133
+ action :delete
134
+
135
+ only_if { File.exists?("/etc/motd") && File.symlink?("/etc/motd") }
136
+ end
137
+
138
+ template "install cucumber-chef motd" do
139
+ path "/etc/motd"
140
+ source "motd.erb"
141
+ owner "root"
142
+ group "root"
143
+ mode "0644"
144
+
145
+ not_if { File.exists?("/etc/motd") && !File.symlink?("/etc/motd") }
146
+ end
@@ -0,0 +1,15 @@
1
+ ;
2
+ ; WARNING: Automatically generated file; DO NOT EDIT!
3
+ ; Cucumber-Chef v<%= node["cucumber_chef"]["version"] %> BIND9 Zone File
4
+ ; Generated on <%= Time.now.utc.to_s %>
5
+ ;
6
+ $TTL 86400
7
+ @ IN SOA localhost. root.localhost. (
8
+ 1 ; Serial
9
+ 604800 ; Refresh
10
+ 86400 ; Retry
11
+ 2419200 ; Expire
12
+ 86400 ) ; Negative Cache TTL
13
+ ;
14
+ @ IN NS localhost.
15
+ 254.255 PTR cucumber-chef.test-lab.
@@ -0,0 +1,15 @@
1
+ ;
2
+ ; WARNING: Automatically generated file; DO NOT EDIT!
3
+ ; Cucumber-Chef v<%= node["cucumber_chef"]["version"] %> BIND9 Zone File
4
+ ; Generated on <%= Time.now.utc.to_s %>
5
+ ;
6
+ $TTL 86400
7
+ @ IN SOA localhost. root.localhost. (
8
+ 1 ; Serial
9
+ 604800 ; Refresh
10
+ 86400 ; Retry
11
+ 2419200 ; Expire
12
+ 86400 ) ; Negative Cache TTL
13
+ ;
14
+ @ IN NS localhost.
15
+ cucumber-chef A 192.168.255.254
@@ -0,0 +1,44 @@
1
+ #
2
+ # WARNING: Automatically generated file; DO NOT EDIT!
3
+ # Cucumber-Chef v<%= node["cucumber_chef"]["version"] %> DHCPD Configuration
4
+ # Generated on <%= Time.now.utc.to_s %>
5
+ #
6
+
7
+ log-facility local7;
8
+ authoritative;
9
+
10
+ ddns-updates on;
11
+ ddns-update-style interim;
12
+ ddns-domainname "test-lab.";
13
+ ddns-rev-domainname "in-addr.arpa.";
14
+ ignore client-updates;
15
+ update-static-leases on;
16
+ update-conflict-detection false;
17
+
18
+ default-lease-time 600;
19
+ max-lease-time 7200;
20
+
21
+ pid-file-name "/var/run/dhcp-server/dhcpd.pid";
22
+ include "/etc/bind/rndc.key";
23
+
24
+ zone 168.192.in-addr.arpa. {
25
+ primary 127.0.0.1;
26
+ key "rndc-key";
27
+ }
28
+
29
+ zone test-lab. {
30
+ primary 127.0.0.1;
31
+ key "rndc-key";
32
+ }
33
+
34
+ subnet 192.168.0.0 netmask 255.255.0.0 {
35
+ option routers 192.168.255.254;
36
+ option subnet-mask 255.255.0.0;
37
+ option broadcast-address 192.168.255.255;
38
+ option domain-name-servers 192.168.255.254, 8.8.8.8, 8.8.4.4;
39
+ option ntp-servers 192.168.255.254;
40
+
41
+ range 192.168.255.1 192.168.255.100;
42
+ }
43
+
44
+ include "/etc/dhcp/test-lab.conf";
@@ -0,0 +1,10 @@
1
+ ---
2
+ :bulk_threshold: 1000
3
+ :update_sources: true
4
+ :sources:
5
+ - http://rubygems.org
6
+ - http://gems.github.com
7
+ :backtrace: true
8
+ :verbose: true
9
+ :benchmark: false
10
+ gem: --no-ri --no-rdoc --conservative
@@ -2,4 +2,4 @@ lxc.network.type = veth
2
2
  lxc.network.flags = up
3
3
  lxc.network.link = br0
4
4
  lxc.network.name = eth0
5
- lxc.network.ipv4 = 192.168.3.2/24
5
+ lxc.network.ipv4 = 0.0.0.0
@@ -0,0 +1,3 @@
1
+ apt-get -q -y --force-yes install wget
2
+ wget http://opscode.com/chef/install.sh -O - | bash
3
+ mkdir -p /etc/chef
@@ -0,0 +1,10 @@
1
+ _____ _ _____ _ __
2
+ / ____| | | / ____| | / _|
3
+ | | _ _ ___ _ _ _ __ ___ | |__ ___ _ __| | | |__ ___| |_
4
+ | | | | | |/ __| | | | '_ ` _ \| '_ \ / _ \ '__| | | '_ \ / _ \ _|
5
+ | |___| |_| | (__| |_| | | | | | | |_) | __/ | | |____| | | | __/ |
6
+ \_____\__,_|\___|\__,_|_| |_| |_|_.__/ \___|_| \_____|_| |_|\___|_|
7
+
8
+
9
+ Welcome to the Cucumber Chef Test Lab v<%= node["cucumber_chef"]["version"] %>
10
+
@@ -0,0 +1,25 @@
1
+ #
2
+ # WARNING: Automatically generated file; DO NOT EDIT!
3
+ # Cucumber-Chef v<%= node["cucumber_chef"]["version"] %> BIND9 Configuration
4
+ # Generated on <%= Time.now.utc.to_s %>
5
+ #
6
+
7
+ include "/etc/bind/rndc.key";
8
+
9
+ zone "test-lab" {
10
+ type master;
11
+ file "/var/lib/bind/db.test-lab";
12
+ allow-update { key "rndc-key"; };
13
+ notify yes;
14
+ };
15
+
16
+ zone "168.192.in-addr.arpa" {
17
+ type master;
18
+ file "/var/lib/bind/db.168.192";
19
+ allow-update { key "rndc-key"; };
20
+ notify yes;
21
+ };
22
+
23
+ controls {
24
+ inet 127.0.0.1 allow { 127.0.0.1; } keys { "rndc-key"; };
25
+ };
@@ -1,3 +1,5 @@
1
1
  UserKnownHostsFile /dev/null
2
2
  StrictHostKeyChecking no
3
- LogLevel error
3
+ LogLevel error
4
+ KeepAlive yes
5
+ ServerAliveInterval 60
@@ -0,0 +1,24 @@
1
+ #
2
+ # Author:: Zachary Patten (<zpatten@jovelabs.com>)
3
+ # Cookbook Name:: cucumber-chef
4
+ # Role:: test_lab
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+
20
+ name "test_lab"
21
+ description "Platform for running acceptance and integration tests"
22
+ run_list(
23
+ "recipe[cucumber-chef]"
24
+ )
@@ -1,129 +1,56 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
1
+ ################################################################################
2
+ #
3
+ # Author: Stephen Nelson-Smith <stephen@atalanta-systems.com>
4
+ # Author: Zachary Patten <zachary@jovelabs.com>
5
+ # Copyright: Copyright (c) 2011-2012 Atalanta Systems Ltd
6
+ # License: Apache License, Version 2.0
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+ ################################################################################
21
+
22
+ require File.expand_path("../lib/cucumber/chef/version", __FILE__)
5
23
 
6
24
  Gem::Specification.new do |s|
7
- s.name = %q{cucumber-chef}
8
- s.version = "1.0.3"
25
+ s.name = "cucumber-chef"
26
+ s.version = Cucumber::Chef::VERSION
27
+ s.platform = Gem::Platform::RUBY
28
+ s.authors = ["Stephen Nelson-Smith", "Zachary Patten"]
29
+ s.email = ["stephen@atalanta-systems.com", "zachary@jovelabs.com"]
30
+ s.homepage = "http://www.cucumber-chef.org"
31
+ s.summary = "Test Driven Infrastructure"
32
+ s.description = "Framework for test-driven infrastructure development."
33
+ s.required_ruby_version = ">= 1.8.7"
34
+ s.required_rubygems_version = ">= 1.3.6"
35
+ s.licenses = ["Apache 2.0"]
9
36
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Stephen Nelson-Smith"]
12
- s.date = %q{2011-07-12}
13
- s.default_executable = %q{cucumber-chef}
14
- s.description = %q{Framework for behaviour-drive infrastructure development.}
15
- s.email = %q{stephen@atalanta-systems.com}
16
- s.executables = ["cucumber-chef"]
17
- s.extra_rdoc_files = [
18
- "LICENSE",
19
- "README.md"
20
- ]
21
- s.files = [
22
- ".document",
23
- ".gitignore",
24
- "Gemfile",
25
- "LICENSE",
26
- "README.md",
27
- "Rakefile",
28
- "VERSION",
29
- "bin/cucumber-chef",
30
- "cookbooks/cucumber-chef/README.rdoc",
31
- "cookbooks/cucumber-chef/files/default/add-git-identity",
32
- "cookbooks/cucumber-chef/files/default/controller-first-boot",
33
- "cookbooks/cucumber-chef/files/default/cucumber-net",
34
- "cookbooks/cucumber-chef/files/default/cucumber-private-key",
35
- "cookbooks/cucumber-chef/files/default/cucumber-run_list",
36
- "cookbooks/cucumber-chef/files/default/git-private-key",
37
- "cookbooks/cucumber-chef/files/default/install-chef",
38
- "cookbooks/cucumber-chef/files/default/lxc-controller-network-config",
39
- "cookbooks/cucumber-chef/files/default/lxc-lucid-chef",
40
- "cookbooks/cucumber-chef/files/default/permissive-ssh-config",
41
- "cookbooks/cucumber-chef/metadata.rb",
42
- "cookbooks/cucumber-chef/recipes/controller.rb",
43
- "cookbooks/cucumber-chef/recipes/lxc.rb",
44
- "cookbooks/cucumber-chef/recipes/test_lab.rb",
45
- "cookbooks/cucumber-chef/recipes/testrunner.rb",
46
- "cookbooks/cucumber-chef/roles/controller.rb",
47
- "cookbooks/cucumber-chef/roles/test_lab_test.rb",
48
- "cookbooks/cucumber-chef/templates/default/controller-client.erb",
49
- "cookbooks/cucumber-chef/templates/default/lxc-lucid-chef",
50
- "cucumber-chef.gemspec",
51
- "features/installing.feature",
52
- "features/steps/installing_steps.rb",
53
- "features/steps/setup_steps.rb",
54
- "features/steps/upload_steps.rb",
55
- "features/steps/usage_steps.rb",
56
- "features/support/env.rb",
57
- "features/support/filetools.rb",
58
- "features/support/silent_system.rb",
59
- "features/usage.feature",
60
- "lib/cucumber-chef.rb",
61
- "lib/cucumber/chef.rb",
62
- "lib/cucumber/chef/config.rb",
63
- "lib/cucumber/chef/handy.rb",
64
- "lib/cucumber/chef/provisioner.rb",
65
- "lib/cucumber/chef/templates/controller.erb",
66
- "lib/cucumber/chef/templates/env.rb",
67
- "lib/cucumber/chef/templates/example_feature.erb",
68
- "lib/cucumber/chef/templates/example_step.erb",
69
- "lib/cucumber/chef/templates/readme.erb",
70
- "lib/cucumber/chef/templates/ubuntu10.04-gems.erb",
71
- "lib/cucumber/chef/test_lab.rb",
72
- "lib/cucumber/chef/test_runner.rb",
73
- "lib/cucumber/chef/version.rb",
74
- "lib/cucumber/ec2_server_create.rb",
75
- "spec/cucumber/chef/config_spec.rb",
76
- "spec/cucumber/chef/provisioner_spec.rb",
77
- "spec/cucumber/chef/test_lab_spec.rb",
78
- "spec/spec_helper.rb",
79
- "website/website.html"
80
- ]
81
- s.homepage = %q{http://cucumber-chef.org}
82
- s.licenses = ["Apache v2"]
83
- s.require_paths = ["lib"]
84
- s.rubygems_version = %q{1.6.2}
85
- s.summary = %q{Tests Chef-built infrastructure}
37
+ s.add_dependency("chef", "~> 0.10.10")
38
+ s.add_dependency("cucumber", "~> 1.2.0")
39
+ s.add_dependency("erubis", "~> 2.7.0")
40
+ s.add_dependency("fog", "~> 1.3.1")
41
+ s.add_dependency("net-sftp", "~> 2.0.5")
42
+ s.add_dependency("net-ssh", "~> 2.2.2")
43
+ s.add_dependency("mixlib-config", "~> 1.1.2")
44
+ s.add_dependency("thor", "~> 0.15.2")
45
+ s.add_dependency("rake", "~> 0.9.2")
46
+ s.add_dependency("ubuntu_ami", "~> 0.4.0")
86
47
 
87
- if s.respond_to? :specification_version then
88
- s.specification_version = 3
48
+ s.add_development_dependency("rspec", "~> 2.10.0")
49
+ s.add_development_dependency("simplecov", "~> 0.6.4")
89
50
 
90
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
91
- s.add_runtime_dependency(%q<rake>, ["~> 0.9.2"])
92
- s.add_runtime_dependency(%q<chef>, [">= 0.10.2"])
93
- s.add_runtime_dependency(%q<fog>, [">= 0"])
94
- s.add_runtime_dependency(%q<thor>, [">= 0"])
95
- s.add_runtime_dependency(%q<net-scp>, [">= 0"])
96
- s.add_development_dependency(%q<cucumber>, [">= 0"])
97
- s.add_development_dependency(%q<cucumber-nagios>, [">= 0"])
98
- s.add_development_dependency(%q<rspec>, [">= 0"])
99
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
100
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
101
- s.add_development_dependency(%q<rcov>, [">= 0"])
102
- else
103
- s.add_dependency(%q<rake>, ["~> 0.9.2"])
104
- s.add_dependency(%q<chef>, [">= 0.10.2"])
105
- s.add_dependency(%q<fog>, [">= 0"])
106
- s.add_dependency(%q<thor>, [">= 0"])
107
- s.add_dependency(%q<net-scp>, [">= 0"])
108
- s.add_dependency(%q<cucumber>, [">= 0"])
109
- s.add_dependency(%q<cucumber-nagios>, [">= 0"])
110
- s.add_dependency(%q<rspec>, [">= 0"])
111
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
112
- s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
113
- s.add_dependency(%q<rcov>, [">= 0"])
114
- end
115
- else
116
- s.add_dependency(%q<rake>, ["~> 0.9.2"])
117
- s.add_dependency(%q<chef>, [">= 0.10.2"])
118
- s.add_dependency(%q<fog>, [">= 0"])
119
- s.add_dependency(%q<thor>, [">= 0"])
120
- s.add_dependency(%q<net-scp>, [">= 0"])
121
- s.add_dependency(%q<cucumber>, [">= 0"])
122
- s.add_dependency(%q<cucumber-nagios>, [">= 0"])
123
- s.add_dependency(%q<rspec>, [">= 0"])
124
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
125
- s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
126
- s.add_dependency(%q<rcov>, [">= 0"])
127
- end
128
- end
51
+ s.files = `git ls-files`.split("\n")
52
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
53
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
129
54
 
55
+ s.require_path = 'lib'
56
+ end
@@ -0,0 +1,7 @@
1
+ Examples
2
+ ========
3
+
4
+ This directory contains various examples in the form of early feature tests for some of my cookbooks. You can find out more about the cookbooks on GitHub:
5
+
6
+ https://github.com/jovelabs
7
+ https://github.com/zpatten
@@ -0,0 +1,51 @@
1
+ @users
2
+ Feature: Perform test driven infrastructure with Cucumber-Chef
3
+ In order to learn how to develop test driven infrastructure
4
+ As an infrastructure developer
5
+ I want to better understand how to use Cucumber-Chef
6
+
7
+ Background:
8
+ * I have a server called "users"
9
+ * "users" is running "ubuntu" "lucid"
10
+ * "users" has been provisioned
11
+ * the following roles have been updated:
12
+ | role | role_path |
13
+ | users | ./support/roles/ |
14
+ * the "users" role has been added to the "users" run list
15
+ * the following databags have been updated:
16
+ | databag | databag_path |
17
+ | users | ./support/data_bags/users |
18
+ * the chef-client has been run on "users"
19
+ * I ssh to "users" with the following credentials:
20
+ | username | keyfile |
21
+ | root | ../.ssh/id_rsa |
22
+
23
+ Scenario: The user has been added
24
+ When I run "cat /etc/passwd | grep [b]dobbs"
25
+ Then I should see "bdobbs" in the output
26
+ And I should see "/home/bdobbs" in the output
27
+ And I should see "/bin/bash" in the output
28
+
29
+ Scenario: The user's groups have been added
30
+ When I run "cat /etc/group | grep [b]dobbs"
31
+ Then I should see "bdobbs" in the output
32
+ And I should see "sysop" in the output
33
+ And I should see "dba" in the output
34
+ And I should see "dev" in the output
35
+
36
+ Scenario: The user's ssh keys have been populated
37
+ When I run "cat /home/bdobbs/.ssh/authorized_keys"
38
+ Then I should see "ssh-rsa" in the output
39
+ And I should see "bob@dobbs" in the output
40
+
41
+ Scenario: The user's ssh config has been populated
42
+ When I run "cat /home/bdobbs/.ssh/config"
43
+ Then I should see "KeepAlive yes" in the output
44
+ And I should see "ServerAliveInterval 60" in the output
45
+
46
+ Scenario: The user can ssh in to the system with their key pair
47
+ * I ssh to "users" with the following credentials:
48
+ | username | keyfile |
49
+ | bdobbs | ./support/keys/bdobbs |
50
+ When I run "hostname"
51
+ Then I should see "users" in the output
@@ -0,0 +1,50 @@
1
+ @users
2
+ Feature: Perform test driven infrastructure with Cucumber-Chef
3
+ In order to learn how to develop test driven infrastructure
4
+ As an infrastructure developer
5
+ I want to better understand how to use Cucumber-Chef
6
+
7
+ Background:
8
+ * I have a server called "users"
9
+ * "users" is running "ubuntu" "lucid"
10
+ * "users" has been provisioned
11
+ * the following roles have been updated:
12
+ | role | role_path |
13
+ | users | ./support/roles/ |
14
+ * the "users" role has been added to the "users" run list
15
+ * the following databags have been updated:
16
+ | databag | databag_path |
17
+ | users | ./support/data_bags/users |
18
+ * the chef-client has been run on "users"
19
+ * I ssh to "users" with the following credentials:
20
+ | username | keyfile |
21
+ | root | ../.ssh/id_rsa |
22
+
23
+ Scenario: The user has been removed
24
+ * the following databags have been updated:
25
+ | databag | databag_path |
26
+ | users | ./support/data_bags/users-auto-remove |
27
+ * the chef-client has been run on "users"
28
+ When I run "cat /etc/passwd | grep [b]dobbs"
29
+ Then I should not see "bdobbs" in the output
30
+ And I should not see "/home/bdobbs" in the output
31
+ And I should not see "/bin/bash" in the output
32
+
33
+ Scenario: The user's group has been removed
34
+ * the following databags have been updated:
35
+ | databag | databag_path |
36
+ | users | ./support/data_bags/users-auto-remove |
37
+ * the chef-client has been run on "users"
38
+ When I run "cat /etc/group | grep [b]dobbs"
39
+ Then I should not see "bdobbs" in the output
40
+ And I should not see "sysop" in the output
41
+ And I should not see "dba" in the output
42
+ And I should not see "dev" in the output
43
+
44
+ Scenario: The user's directory has been preserved on remove
45
+ * the following databags have been updated:
46
+ | databag | databag_path |
47
+ | users | ./support/data_bags/users-auto-remove |
48
+ * the chef-client has been run on "users"
49
+ When I run "[[ -e /home/bdobbs ]] && echo OK"
50
+ Then I should see "OK" in the output
@@ -4,9 +4,7 @@ $: << File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
4
4
  $: << File.expand_path(File.dirname(__FILE__))
5
5
 
6
6
  require 'rspec/expectations'
7
- require 'chef'
8
7
  require 'cucumber/chef'
9
- require 'cucumber/nagios/steps'
10
8
 
11
9
  class CustomWorld
12
10
  include Cucumber::Chef
@@ -17,9 +15,12 @@ World do
17
15
  end
18
16
 
19
17
  Around('@invalid_credentials') do |scenario, block|
18
+ # Move current working directory if one exists (and restore at end)
19
+ FileUtils.mv(".chef", ".chef_cucumber_temp") if File.exist?(".chef")
20
20
  FileUtils.mkdir_p(".chef")
21
21
  config = "chef_node_name 'REALLYBOGUSORGNAME'"
22
22
  File.open(".chef/knife.rb", 'w') { |f| f.puts config }
23
23
  block.call
24
24
  FileUtils.rm_rf(".chef")
25
+ FileUtils.mv(".chef_cucumber_temp", ".chef") if File.exist?(".chef_cucumber_temp")
25
26
  end