test-kitchen 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cane +1 -1
- data/.rubocop.yml +3 -0
- data/.travis.yml +20 -9
- data/CHANGELOG.md +219 -108
- data/Gemfile +10 -6
- data/Guardfile +38 -9
- data/README.md +11 -1
- data/Rakefile +21 -37
- data/bin/kitchen +4 -4
- data/features/kitchen_action_commands.feature +161 -0
- data/features/kitchen_console_command.feature +34 -0
- data/features/kitchen_diagnose_command.feature +64 -0
- data/features/kitchen_init_command.feature +29 -17
- data/features/kitchen_list_command.feature +2 -2
- data/features/kitchen_login_command.feature +56 -0
- data/features/{sink_command.feature → kitchen_sink_command.feature} +0 -0
- data/features/kitchen_test_command.feature +88 -0
- data/features/step_definitions/gem_steps.rb +8 -6
- data/features/step_definitions/git_steps.rb +4 -2
- data/features/step_definitions/output_steps.rb +5 -0
- data/features/support/env.rb +12 -9
- data/lib/kitchen.rb +60 -38
- data/lib/kitchen/base64_stream.rb +55 -0
- data/lib/kitchen/busser.rb +124 -58
- data/lib/kitchen/cli.rb +121 -38
- data/lib/kitchen/collection.rb +3 -3
- data/lib/kitchen/color.rb +4 -4
- data/lib/kitchen/command.rb +78 -11
- data/lib/kitchen/command/action.rb +3 -2
- data/lib/kitchen/command/console.rb +12 -5
- data/lib/kitchen/command/diagnose.rb +17 -3
- data/lib/kitchen/command/driver_discover.rb +26 -7
- data/lib/kitchen/command/exec.rb +41 -0
- data/lib/kitchen/command/list.rb +44 -14
- data/lib/kitchen/command/login.rb +2 -1
- data/lib/kitchen/command/sink.rb +2 -1
- data/lib/kitchen/command/test.rb +5 -4
- data/lib/kitchen/config.rb +146 -14
- data/lib/kitchen/configurable.rb +314 -0
- data/lib/kitchen/data_munger.rb +522 -18
- data/lib/kitchen/diagnostic.rb +43 -4
- data/lib/kitchen/driver.rb +4 -4
- data/lib/kitchen/driver/base.rb +80 -115
- data/lib/kitchen/driver/dummy.rb +34 -6
- data/lib/kitchen/driver/proxy.rb +14 -3
- data/lib/kitchen/driver/ssh_base.rb +61 -7
- data/lib/kitchen/errors.rb +109 -9
- data/lib/kitchen/generator/driver_create.rb +39 -5
- data/lib/kitchen/generator/init.rb +130 -45
- data/lib/kitchen/instance.rb +162 -28
- data/lib/kitchen/lazy_hash.rb +79 -7
- data/lib/kitchen/loader/yaml.rb +159 -27
- data/lib/kitchen/logger.rb +267 -21
- data/lib/kitchen/logging.rb +30 -3
- data/lib/kitchen/login_command.rb +11 -2
- data/lib/kitchen/metadata_chopper.rb +2 -2
- data/lib/kitchen/provisioner.rb +4 -4
- data/lib/kitchen/provisioner/base.rb +107 -103
- data/lib/kitchen/provisioner/chef/berkshelf.rb +36 -8
- data/lib/kitchen/provisioner/chef/librarian.rb +40 -11
- data/lib/kitchen/provisioner/chef_base.rb +206 -167
- data/lib/kitchen/provisioner/chef_solo.rb +25 -7
- data/lib/kitchen/provisioner/chef_zero.rb +105 -29
- data/lib/kitchen/provisioner/dummy.rb +1 -1
- data/lib/kitchen/provisioner/shell.rb +21 -6
- data/lib/kitchen/rake_tasks.rb +8 -3
- data/lib/kitchen/shell_out.rb +15 -18
- data/lib/kitchen/ssh.rb +122 -27
- data/lib/kitchen/state_file.rb +24 -7
- data/lib/kitchen/thor_tasks.rb +9 -4
- data/lib/kitchen/util.rb +43 -118
- data/lib/kitchen/version.rb +1 -1
- data/lib/vendor/hash_recursive_merge.rb +10 -2
- data/spec/kitchen/base64_stream_spec.rb +77 -0
- data/spec/kitchen/busser_spec.rb +490 -0
- data/spec/kitchen/collection_spec.rb +10 -10
- data/spec/kitchen/color_spec.rb +2 -2
- data/spec/kitchen/config_spec.rb +234 -62
- data/spec/kitchen/configurable_spec.rb +490 -0
- data/spec/kitchen/data_munger_spec.rb +1070 -862
- data/spec/kitchen/diagnostic_spec.rb +79 -0
- data/spec/kitchen/driver/base_spec.rb +80 -85
- data/spec/kitchen/driver/dummy_spec.rb +43 -14
- data/spec/kitchen/driver/proxy_spec.rb +134 -0
- data/spec/kitchen/driver/ssh_base_spec.rb +644 -0
- data/spec/kitchen/driver_spec.rb +15 -15
- data/spec/kitchen/errors_spec.rb +309 -0
- data/spec/kitchen/instance_spec.rb +143 -46
- data/spec/kitchen/lazy_hash_spec.rb +36 -9
- data/spec/kitchen/loader/yaml_spec.rb +237 -226
- data/spec/kitchen/logger_spec.rb +419 -0
- data/spec/kitchen/logging_spec.rb +59 -0
- data/spec/kitchen/login_command_spec.rb +49 -0
- data/spec/kitchen/metadata_chopper_spec.rb +82 -0
- data/spec/kitchen/platform_spec.rb +4 -4
- data/spec/kitchen/provisioner/base_spec.rb +65 -125
- data/spec/kitchen/provisioner/chef_base_spec.rb +798 -0
- data/spec/kitchen/provisioner/chef_solo_spec.rb +316 -0
- data/spec/kitchen/provisioner/chef_zero_spec.rb +624 -0
- data/spec/kitchen/provisioner/shell_spec.rb +269 -0
- data/spec/kitchen/provisioner_spec.rb +6 -6
- data/spec/kitchen/shell_out_spec.rb +143 -0
- data/spec/kitchen/ssh_spec.rb +683 -0
- data/spec/kitchen/state_file_spec.rb +28 -21
- data/spec/kitchen/suite_spec.rb +7 -7
- data/spec/kitchen/util_spec.rb +68 -10
- data/spec/kitchen_spec.rb +107 -0
- data/spec/spec_helper.rb +18 -13
- data/support/chef-client-zero.rb +10 -9
- data/support/chef_helpers.sh +16 -0
- data/support/download_helpers.sh +109 -0
- data/test-kitchen.gemspec +42 -33
- metadata +107 -33
data/Gemfile
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
-
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
source "https://rubygems.org"
|
2
3
|
gemspec
|
3
4
|
|
4
5
|
group :guard do
|
5
|
-
gem
|
6
|
-
gem
|
7
|
-
gem
|
8
|
-
gem
|
9
|
-
|
6
|
+
gem "guard-minitest"
|
7
|
+
gem "guard-cucumber", "~> 1.4"
|
8
|
+
gem "guard-rubocop"
|
9
|
+
gem "guard-yard"
|
10
|
+
end
|
11
|
+
|
12
|
+
group :test do
|
13
|
+
gem "codeclimate-test-reporter", :require => nil
|
10
14
|
end
|
data/Guardfile
CHANGED
@@ -1,13 +1,42 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
ignore %r{^\.gem/}
|
3
|
+
|
4
|
+
def rubocop_opts
|
5
|
+
{ :all_on_start => false, :keep_failed => false, :cli => "-r finstyle" }
|
6
|
+
end
|
7
|
+
|
8
|
+
def cucumber_opts
|
9
|
+
cucumber_cli = "--no-profile --color --format progress --strict"
|
10
|
+
cucumber_cli += " --tags ~@spawn" if RUBY_PLATFORM =~ /mswin|mingw|windows/
|
11
|
+
|
12
|
+
{ :all_on_start => false, :cli => cucumber_cli }
|
13
|
+
end
|
14
|
+
|
15
|
+
def yard_opts
|
16
|
+
{ :port => "8808" }
|
5
17
|
end
|
6
18
|
|
7
|
-
|
8
|
-
|
9
|
-
|
19
|
+
group :red_green_refactor, :halt_on_fail => true do
|
20
|
+
guard :minitest do
|
21
|
+
watch(%r{^spec/(.*)_spec\.rb})
|
22
|
+
watch(%r{^lib/(.*)([^/]+)\.rb}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
23
|
+
watch(%r{^spec/spec_helper\.rb}) { "spec" }
|
24
|
+
end
|
25
|
+
|
26
|
+
guard :rubocop, rubocop_opts do
|
27
|
+
watch(%r{.+\.rb$})
|
28
|
+
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
guard :cucumber, cucumber_opts do
|
10
33
|
watch(%r{^features/.+\.feature$})
|
11
|
-
watch(%r{^features/support/.+$})
|
12
|
-
watch(%r{^features/step_definitions/(.+)_steps\.rb$})
|
34
|
+
watch(%r{^features/support/.+$}) { "features" }
|
35
|
+
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) do |m|
|
36
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "features"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
guard :yard, yard_opts do
|
41
|
+
watch(%r{lib/.+\.rb})
|
13
42
|
end
|
data/README.md
CHANGED
@@ -3,7 +3,9 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/test-kitchen.png)](http://badge.fury.io/rb/test-kitchen)
|
4
4
|
[![Build Status](https://secure.travis-ci.org/test-kitchen/test-kitchen.png?branch=master)](https://travis-ci.org/test-kitchen/test-kitchen)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/test-kitchen/test-kitchen.png)](https://codeclimate.com/github/test-kitchen/test-kitchen)
|
6
|
+
[![Test Coverage](https://codeclimate.com/github/test-kitchen/test-kitchen/coverage.png)](https://codeclimate.com/github/test-kitchen/test-kitchen)
|
6
7
|
[![Dependency Status](https://gemnasium.com/test-kitchen/test-kitchen.png)](https://gemnasium.com/test-kitchen/test-kitchen)
|
8
|
+
[![Inline docs](http://inch-ci.org/github/test-kitchen/test-kitchen.png?branch=master)](http://inch-ci.org/github/test-kitchen/test-kitchen)
|
7
9
|
|
8
10
|
| | |
|
9
11
|
|-------------|-----------------------------------------------|
|
@@ -41,7 +43,7 @@ $ kitchen init
|
|
41
43
|
```
|
42
44
|
|
43
45
|
A `.kitchen.yml` will be created in your project base directory. This file
|
44
|
-
describes your testing
|
46
|
+
describes your testing configuration; what you want to test and on which target
|
45
47
|
platforms. Each of these suite and platform combinations are called instances.
|
46
48
|
By default your instances will be converged with Chef Solo and run in Vagrant
|
47
49
|
virtual machines.
|
@@ -71,6 +73,8 @@ run through all the instances in serial by running:
|
|
71
73
|
$ kitchen test
|
72
74
|
```
|
73
75
|
|
76
|
+
## Usage
|
77
|
+
|
74
78
|
There is help included with the `kitchen help` subcommand which will list all
|
75
79
|
subcommands and their usage:
|
76
80
|
|
@@ -78,6 +82,12 @@ subcommands and their usage:
|
|
78
82
|
$ kitchen help test
|
79
83
|
```
|
80
84
|
|
85
|
+
More verbose logging (for both test-kitchen and the chef-solo/chef-zero provisioners) can be specified when running test-kitchen form the command line using:
|
86
|
+
|
87
|
+
```
|
88
|
+
$ kitchen test -l debug
|
89
|
+
```
|
90
|
+
|
81
91
|
## Documentation
|
82
92
|
|
83
93
|
Documentation is being added on the Test Kitchen [website][website]. Please
|
data/Rakefile
CHANGED
@@ -1,16 +1,18 @@
|
|
1
|
-
|
2
|
-
require 'rake/testtask'
|
3
|
-
require 'cucumber'
|
4
|
-
require 'cucumber/rake/task'
|
1
|
+
# -*- encoding: utf-8 -*-
|
5
2
|
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
|
5
|
+
require "rake/testtask"
|
6
6
|
Rake::TestTask.new(:unit) do |t|
|
7
7
|
t.libs.push "lib"
|
8
|
-
t.test_files = FileList[
|
8
|
+
t.test_files = FileList["spec/**/*_spec.rb"]
|
9
9
|
t.verbose = true
|
10
10
|
end
|
11
11
|
|
12
|
+
require "cucumber"
|
13
|
+
require "cucumber/rake/task"
|
12
14
|
Cucumber::Rake::Task.new(:features) do |t|
|
13
|
-
t.cucumber_opts = [
|
15
|
+
t.cucumber_opts = ["features", "-x", "--format progress"]
|
14
16
|
end
|
15
17
|
|
16
18
|
desc "Run all test suites"
|
@@ -24,45 +26,27 @@ task :stats do
|
|
24
26
|
sh "countloc -r spec features"
|
25
27
|
end
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
require "finstyle"
|
30
|
+
require "rubocop/rake_task"
|
31
|
+
RuboCop::RakeTask.new(:style) do |task|
|
32
|
+
task.options << "--display-cop-names"
|
33
|
+
end
|
30
34
|
|
35
|
+
if RUBY_ENGINE != "jruby"
|
36
|
+
require "cane/rake_task"
|
31
37
|
desc "Run cane to check quality metrics"
|
32
38
|
Cane::RakeTask.new do |cane|
|
33
|
-
cane.canefile =
|
34
|
-
end
|
35
|
-
|
36
|
-
Tailor::RakeTask.new do |task|
|
37
|
-
task.file_set('bin/*', 'binaries')
|
38
|
-
task.file_set('lib/**/*.rb', 'code') do |style|
|
39
|
-
# TODO: Tailor is confused thinking `module Kitchen` is a class. Until
|
40
|
-
# the classes are split in seperate files, let's punt on this
|
41
|
-
style.max_code_lines_in_class 1550, level: :warn
|
42
|
-
# NOTE: Kitchen::InitGenerator.default_yaml is over the default 30 lines
|
43
|
-
# and produces a warning. Since most of it is increasing readability of
|
44
|
-
# the data structure, allowing it here to prevent it from growing
|
45
|
-
style.max_code_lines_in_method 34
|
46
|
-
style.max_line_length 80, level: :warn
|
47
|
-
style.max_line_length 160, level: :error
|
48
|
-
end
|
49
|
-
task.file_set('spec/**/*.rb', 'tests') do |style|
|
50
|
-
# allow vertical alignment of `let(:foo) { block }` blocks
|
51
|
-
style.spaces_before_lbrace 1, level: :off
|
52
|
-
end
|
53
|
-
task.file_set('spec/kitchen/data_munger_spec.rb', 'tests') do |style|
|
54
|
-
# allow data formatting in DataMunger
|
55
|
-
style.indentation_spaces 2, level: :off
|
56
|
-
# allow far larger spec file to cover all data input cases as possible
|
57
|
-
style.max_code_lines_in_class 600, level: :off
|
58
|
-
end
|
39
|
+
cane.canefile = "./.cane"
|
59
40
|
end
|
60
41
|
|
61
42
|
desc "Run all quality tasks"
|
62
|
-
task :quality => [:cane, :stats]
|
43
|
+
task :quality => [:cane, :style, :stats]
|
63
44
|
else
|
64
45
|
desc "Run all quality tasks"
|
65
|
-
task :quality => [:stats]
|
46
|
+
task :quality => [:style, :stats]
|
66
47
|
end
|
67
48
|
|
49
|
+
require "yard"
|
50
|
+
YARD::Rake::YardocTask.new
|
51
|
+
|
68
52
|
task :default => [:test, :quality]
|
data/bin/kitchen
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
# https://twitter.com/mitchellh/status/283014103189053442
|
6
6
|
Signal.trap("INT") { exit 1 }
|
7
7
|
|
8
|
-
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
8
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w[.. lib])
|
9
|
+
require "rubygems"
|
10
|
+
require "kitchen/cli"
|
11
|
+
require "kitchen/errors"
|
12
12
|
|
13
13
|
Kitchen.with_friendly_errors { Kitchen::CLI.start }
|
@@ -0,0 +1,161 @@
|
|
1
|
+
Feature: Running instance actions
|
2
|
+
In order to trigger discrete instance lifecyle actions
|
3
|
+
As an operator
|
4
|
+
I want to run a action commands
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given a file named ".kitchen.yml" with:
|
8
|
+
"""
|
9
|
+
---
|
10
|
+
driver:
|
11
|
+
name: dummy
|
12
|
+
|
13
|
+
provisioner:
|
14
|
+
name: dummy
|
15
|
+
|
16
|
+
platforms:
|
17
|
+
- name: cool
|
18
|
+
- name: beans
|
19
|
+
|
20
|
+
suites:
|
21
|
+
- name: client
|
22
|
+
- name: server
|
23
|
+
"""
|
24
|
+
|
25
|
+
@spawn
|
26
|
+
Scenario: Creating a single instance
|
27
|
+
When I successfully run `kitchen list client-beans`
|
28
|
+
Then the stdout should match /^client-beans\s+.+\s+\<Not Created\>\Z/
|
29
|
+
When I run `kitchen create client-beans`
|
30
|
+
Then the output should contain "Finished creating <client-beans>"
|
31
|
+
And the exit status should be 0
|
32
|
+
When I successfully run `kitchen list client-beans`
|
33
|
+
Then the stdout should match /^client-beans\s+.+\s+Created\Z/
|
34
|
+
|
35
|
+
@spawn
|
36
|
+
Scenario: Creating a single instance that fails
|
37
|
+
Given a file named ".kitchen.local.yml" with:
|
38
|
+
"""
|
39
|
+
---
|
40
|
+
driver:
|
41
|
+
fail_create: true
|
42
|
+
"""
|
43
|
+
When I successfully run `kitchen list client-beans`
|
44
|
+
Then the stdout should match /^client-beans\s+.+\s+\<Not Created\>\Z/
|
45
|
+
When I run `kitchen create client-beans`
|
46
|
+
Then the output should contain "Create failed on instance <client-beans>"
|
47
|
+
And the exit status should not be 0
|
48
|
+
When I successfully run `kitchen list client-beans`
|
49
|
+
Then the stdout should match /^client-beans\s+.+\s+\<Not Created\>\Z/
|
50
|
+
|
51
|
+
@spawn
|
52
|
+
Scenario: Converging a single instance
|
53
|
+
When I successfully run `kitchen create client-beans`
|
54
|
+
And I successfully run `kitchen list client-beans`
|
55
|
+
Then the stdout should match /^client-beans\s+.+\s+Created\Z/
|
56
|
+
When I run `kitchen converge client-beans`
|
57
|
+
Then the output should contain "Finished converging <client-beans>"
|
58
|
+
And the exit status should be 0
|
59
|
+
When I successfully run `kitchen list client-beans`
|
60
|
+
Then the stdout should match /^client-beans\s+.+\s+Converged\Z/
|
61
|
+
|
62
|
+
@spawn
|
63
|
+
Scenario: Converging a single instance that fails
|
64
|
+
Given a file named ".kitchen.local.yml" with:
|
65
|
+
"""
|
66
|
+
---
|
67
|
+
driver:
|
68
|
+
fail_converge: true
|
69
|
+
"""
|
70
|
+
When I successfully run `kitchen create client-beans`
|
71
|
+
And I successfully run `kitchen list client-beans`
|
72
|
+
Then the stdout should match /^client-beans\s+.+\s+Created\Z/
|
73
|
+
When I run `kitchen converge client-beans`
|
74
|
+
Then the output should contain "Converge failed on instance <client-beans>"
|
75
|
+
And the exit status should not be 0
|
76
|
+
When I successfully run `kitchen list client-beans`
|
77
|
+
Then the stdout should match /^client-beans\s+.+\s+Created\Z/
|
78
|
+
|
79
|
+
@spawn
|
80
|
+
Scenario: Setting up a single instance
|
81
|
+
When I successfully run `kitchen converge client-beans`
|
82
|
+
And I successfully run `kitchen list client-beans`
|
83
|
+
Then the stdout should match /^client-beans\s+.+\s+Converged\Z/
|
84
|
+
When I run `kitchen setup client-beans`
|
85
|
+
Then the output should contain "Finished setting up <client-beans>"
|
86
|
+
And the exit status should be 0
|
87
|
+
When I successfully run `kitchen list client-beans`
|
88
|
+
Then the stdout should match /^client-beans\s+.+\s+Set Up\Z/
|
89
|
+
|
90
|
+
@spawn
|
91
|
+
Scenario: Setting up a single instance that fails
|
92
|
+
Given a file named ".kitchen.local.yml" with:
|
93
|
+
"""
|
94
|
+
---
|
95
|
+
driver:
|
96
|
+
fail_setup: true
|
97
|
+
"""
|
98
|
+
When I successfully run `kitchen converge client-beans`
|
99
|
+
And I successfully run `kitchen list client-beans`
|
100
|
+
Then the stdout should match /^client-beans\s+.+\s+Converged\Z/
|
101
|
+
When I run `kitchen setup client-beans`
|
102
|
+
Then the output should contain "Setup failed on instance <client-beans>"
|
103
|
+
And the exit status should not be 0
|
104
|
+
When I successfully run `kitchen list client-beans`
|
105
|
+
Then the stdout should match /^client-beans\s+.+\s+Converged\Z/
|
106
|
+
|
107
|
+
@spawn
|
108
|
+
Scenario: Verifying a single instance
|
109
|
+
When I successfully run `kitchen setup client-beans`
|
110
|
+
And I successfully run `kitchen list client-beans`
|
111
|
+
Then the stdout should match /^client-beans\s+.+\s+Set Up\Z/
|
112
|
+
When I run `kitchen verify client-beans`
|
113
|
+
Then the output should contain "Finished verifying <client-beans>"
|
114
|
+
And the exit status should be 0
|
115
|
+
When I successfully run `kitchen list client-beans`
|
116
|
+
Then the stdout should match /^client-beans\s+.+\s+Verified\Z/
|
117
|
+
|
118
|
+
@spawn
|
119
|
+
Scenario: Verifying a single instance that fails
|
120
|
+
Given a file named ".kitchen.local.yml" with:
|
121
|
+
"""
|
122
|
+
---
|
123
|
+
driver:
|
124
|
+
fail_verify: true
|
125
|
+
"""
|
126
|
+
When I successfully run `kitchen setup client-beans`
|
127
|
+
And I successfully run `kitchen list client-beans`
|
128
|
+
Then the stdout should match /^client-beans\s+.+\s+Set Up\Z/
|
129
|
+
When I run `kitchen verify client-beans`
|
130
|
+
Then the output should contain "Verify failed on instance <client-beans>"
|
131
|
+
And the exit status should not be 0
|
132
|
+
When I successfully run `kitchen list client-beans`
|
133
|
+
Then the stdout should match /^client-beans\s+.+\s+Set Up\Z/
|
134
|
+
|
135
|
+
@spawn
|
136
|
+
Scenario: Destroying a single instance
|
137
|
+
When I successfully run `kitchen create client-beans`
|
138
|
+
And I successfully run `kitchen list client-beans`
|
139
|
+
Then the stdout should match /^client-beans\s+.+\s+Created\Z/
|
140
|
+
When I run `kitchen destroy client-beans`
|
141
|
+
Then the output should contain "Finished destroying <client-beans>"
|
142
|
+
And the exit status should be 0
|
143
|
+
When I successfully run `kitchen list client-beans`
|
144
|
+
Then the stdout should match /^client-beans\s+.+\s+\<Not Created\>\Z/
|
145
|
+
|
146
|
+
@spawn
|
147
|
+
Scenario: Destroying a single instance that fails
|
148
|
+
Given a file named ".kitchen.local.yml" with:
|
149
|
+
"""
|
150
|
+
---
|
151
|
+
driver:
|
152
|
+
fail_destroy: true
|
153
|
+
"""
|
154
|
+
When I successfully run `kitchen create client-beans`
|
155
|
+
And I successfully run `kitchen list client-beans`
|
156
|
+
Then the stdout should match /^client-beans\s+.+\s+Created\Z/
|
157
|
+
When I run `kitchen destroy client-beans`
|
158
|
+
Then the output should contain "Destroy failed on instance <client-beans>"
|
159
|
+
And the exit status should not be 0
|
160
|
+
When I successfully run `kitchen list client-beans`
|
161
|
+
Then the stdout should match /^client-beans\s+.+\s+Created\Z/
|
@@ -0,0 +1,34 @@
|
|
1
|
+
Feature: Running a console command
|
2
|
+
In order to interactively explore Kitchen's internals and wiring
|
3
|
+
As an opterator
|
4
|
+
I want to run a command to launch an interactive console session
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given a file named ".kitchen.yml" with:
|
8
|
+
"""
|
9
|
+
---
|
10
|
+
driver:
|
11
|
+
name: dummy
|
12
|
+
|
13
|
+
provisioner:
|
14
|
+
name: dummy
|
15
|
+
|
16
|
+
platforms:
|
17
|
+
- name: flebian
|
18
|
+
|
19
|
+
suites:
|
20
|
+
- name: default
|
21
|
+
- name: full
|
22
|
+
"""
|
23
|
+
|
24
|
+
@spawn
|
25
|
+
Scenario: Launching a session
|
26
|
+
When I run `kitchen console` interactively
|
27
|
+
And I type "instances.map { |i| i.name }"
|
28
|
+
And I type "exit"
|
29
|
+
Then the output should contain "kc(Kitchen::Config)> "
|
30
|
+
Then the output should contain:
|
31
|
+
"""
|
32
|
+
["default-flebian", "full-flebian"]
|
33
|
+
"""
|
34
|
+
And the exit status should be 0
|
@@ -0,0 +1,64 @@
|
|
1
|
+
Feature: Running a diagnosis command
|
2
|
+
In order to understand how Kitchen is wired together
|
3
|
+
As an operator and configuration sleuth
|
4
|
+
I want to run a command to get configuration information
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given a file named ".kitchen.yml" with:
|
8
|
+
"""
|
9
|
+
---
|
10
|
+
driver:
|
11
|
+
name: dummy
|
12
|
+
|
13
|
+
provisioner:
|
14
|
+
name: dummy
|
15
|
+
|
16
|
+
platforms:
|
17
|
+
- name: cool
|
18
|
+
- name: beans
|
19
|
+
|
20
|
+
suites:
|
21
|
+
- name: client
|
22
|
+
- name: server
|
23
|
+
"""
|
24
|
+
|
25
|
+
@spawn
|
26
|
+
Scenario: Showing all instances
|
27
|
+
When I run `kitchen diagnose`
|
28
|
+
Then the output should contain "kitchen_version: "
|
29
|
+
Then the output should contain " client-cool:"
|
30
|
+
Then the output should contain " client-beans:"
|
31
|
+
Then the output should contain " server-cool:"
|
32
|
+
Then the output should contain " server-beans:"
|
33
|
+
And the exit status should be 0
|
34
|
+
|
35
|
+
@spawn
|
36
|
+
Scenario: Showing all instances with loader configuration
|
37
|
+
When I run `kitchen diagnose --loader`
|
38
|
+
Then the output should contain:
|
39
|
+
"""
|
40
|
+
loader:
|
41
|
+
process_erb: true
|
42
|
+
process_local: true
|
43
|
+
process_global: true
|
44
|
+
"""
|
45
|
+
And the exit status should be 0
|
46
|
+
|
47
|
+
@spawn
|
48
|
+
Scenario: Coping with loading failure
|
49
|
+
Given a file named ".kitchen.local.yml" with:
|
50
|
+
"""
|
51
|
+
I'm a little teapot
|
52
|
+
"""
|
53
|
+
When I run `kitchen diagnose --all`
|
54
|
+
Then the output should contain:
|
55
|
+
"""
|
56
|
+
raw_data:
|
57
|
+
error:
|
58
|
+
"""
|
59
|
+
And the output should contain:
|
60
|
+
"""
|
61
|
+
instances:
|
62
|
+
error:
|
63
|
+
"""
|
64
|
+
And the exit status should be 0
|