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.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/.cane +1 -1
  3. data/.rubocop.yml +3 -0
  4. data/.travis.yml +20 -9
  5. data/CHANGELOG.md +219 -108
  6. data/Gemfile +10 -6
  7. data/Guardfile +38 -9
  8. data/README.md +11 -1
  9. data/Rakefile +21 -37
  10. data/bin/kitchen +4 -4
  11. data/features/kitchen_action_commands.feature +161 -0
  12. data/features/kitchen_console_command.feature +34 -0
  13. data/features/kitchen_diagnose_command.feature +64 -0
  14. data/features/kitchen_init_command.feature +29 -17
  15. data/features/kitchen_list_command.feature +2 -2
  16. data/features/kitchen_login_command.feature +56 -0
  17. data/features/{sink_command.feature → kitchen_sink_command.feature} +0 -0
  18. data/features/kitchen_test_command.feature +88 -0
  19. data/features/step_definitions/gem_steps.rb +8 -6
  20. data/features/step_definitions/git_steps.rb +4 -2
  21. data/features/step_definitions/output_steps.rb +5 -0
  22. data/features/support/env.rb +12 -9
  23. data/lib/kitchen.rb +60 -38
  24. data/lib/kitchen/base64_stream.rb +55 -0
  25. data/lib/kitchen/busser.rb +124 -58
  26. data/lib/kitchen/cli.rb +121 -38
  27. data/lib/kitchen/collection.rb +3 -3
  28. data/lib/kitchen/color.rb +4 -4
  29. data/lib/kitchen/command.rb +78 -11
  30. data/lib/kitchen/command/action.rb +3 -2
  31. data/lib/kitchen/command/console.rb +12 -5
  32. data/lib/kitchen/command/diagnose.rb +17 -3
  33. data/lib/kitchen/command/driver_discover.rb +26 -7
  34. data/lib/kitchen/command/exec.rb +41 -0
  35. data/lib/kitchen/command/list.rb +44 -14
  36. data/lib/kitchen/command/login.rb +2 -1
  37. data/lib/kitchen/command/sink.rb +2 -1
  38. data/lib/kitchen/command/test.rb +5 -4
  39. data/lib/kitchen/config.rb +146 -14
  40. data/lib/kitchen/configurable.rb +314 -0
  41. data/lib/kitchen/data_munger.rb +522 -18
  42. data/lib/kitchen/diagnostic.rb +43 -4
  43. data/lib/kitchen/driver.rb +4 -4
  44. data/lib/kitchen/driver/base.rb +80 -115
  45. data/lib/kitchen/driver/dummy.rb +34 -6
  46. data/lib/kitchen/driver/proxy.rb +14 -3
  47. data/lib/kitchen/driver/ssh_base.rb +61 -7
  48. data/lib/kitchen/errors.rb +109 -9
  49. data/lib/kitchen/generator/driver_create.rb +39 -5
  50. data/lib/kitchen/generator/init.rb +130 -45
  51. data/lib/kitchen/instance.rb +162 -28
  52. data/lib/kitchen/lazy_hash.rb +79 -7
  53. data/lib/kitchen/loader/yaml.rb +159 -27
  54. data/lib/kitchen/logger.rb +267 -21
  55. data/lib/kitchen/logging.rb +30 -3
  56. data/lib/kitchen/login_command.rb +11 -2
  57. data/lib/kitchen/metadata_chopper.rb +2 -2
  58. data/lib/kitchen/provisioner.rb +4 -4
  59. data/lib/kitchen/provisioner/base.rb +107 -103
  60. data/lib/kitchen/provisioner/chef/berkshelf.rb +36 -8
  61. data/lib/kitchen/provisioner/chef/librarian.rb +40 -11
  62. data/lib/kitchen/provisioner/chef_base.rb +206 -167
  63. data/lib/kitchen/provisioner/chef_solo.rb +25 -7
  64. data/lib/kitchen/provisioner/chef_zero.rb +105 -29
  65. data/lib/kitchen/provisioner/dummy.rb +1 -1
  66. data/lib/kitchen/provisioner/shell.rb +21 -6
  67. data/lib/kitchen/rake_tasks.rb +8 -3
  68. data/lib/kitchen/shell_out.rb +15 -18
  69. data/lib/kitchen/ssh.rb +122 -27
  70. data/lib/kitchen/state_file.rb +24 -7
  71. data/lib/kitchen/thor_tasks.rb +9 -4
  72. data/lib/kitchen/util.rb +43 -118
  73. data/lib/kitchen/version.rb +1 -1
  74. data/lib/vendor/hash_recursive_merge.rb +10 -2
  75. data/spec/kitchen/base64_stream_spec.rb +77 -0
  76. data/spec/kitchen/busser_spec.rb +490 -0
  77. data/spec/kitchen/collection_spec.rb +10 -10
  78. data/spec/kitchen/color_spec.rb +2 -2
  79. data/spec/kitchen/config_spec.rb +234 -62
  80. data/spec/kitchen/configurable_spec.rb +490 -0
  81. data/spec/kitchen/data_munger_spec.rb +1070 -862
  82. data/spec/kitchen/diagnostic_spec.rb +79 -0
  83. data/spec/kitchen/driver/base_spec.rb +80 -85
  84. data/spec/kitchen/driver/dummy_spec.rb +43 -14
  85. data/spec/kitchen/driver/proxy_spec.rb +134 -0
  86. data/spec/kitchen/driver/ssh_base_spec.rb +644 -0
  87. data/spec/kitchen/driver_spec.rb +15 -15
  88. data/spec/kitchen/errors_spec.rb +309 -0
  89. data/spec/kitchen/instance_spec.rb +143 -46
  90. data/spec/kitchen/lazy_hash_spec.rb +36 -9
  91. data/spec/kitchen/loader/yaml_spec.rb +237 -226
  92. data/spec/kitchen/logger_spec.rb +419 -0
  93. data/spec/kitchen/logging_spec.rb +59 -0
  94. data/spec/kitchen/login_command_spec.rb +49 -0
  95. data/spec/kitchen/metadata_chopper_spec.rb +82 -0
  96. data/spec/kitchen/platform_spec.rb +4 -4
  97. data/spec/kitchen/provisioner/base_spec.rb +65 -125
  98. data/spec/kitchen/provisioner/chef_base_spec.rb +798 -0
  99. data/spec/kitchen/provisioner/chef_solo_spec.rb +316 -0
  100. data/spec/kitchen/provisioner/chef_zero_spec.rb +624 -0
  101. data/spec/kitchen/provisioner/shell_spec.rb +269 -0
  102. data/spec/kitchen/provisioner_spec.rb +6 -6
  103. data/spec/kitchen/shell_out_spec.rb +143 -0
  104. data/spec/kitchen/ssh_spec.rb +683 -0
  105. data/spec/kitchen/state_file_spec.rb +28 -21
  106. data/spec/kitchen/suite_spec.rb +7 -7
  107. data/spec/kitchen/util_spec.rb +68 -10
  108. data/spec/kitchen_spec.rb +107 -0
  109. data/spec/spec_helper.rb +18 -13
  110. data/support/chef-client-zero.rb +10 -9
  111. data/support/chef_helpers.sh +16 -0
  112. data/support/download_helpers.sh +109 -0
  113. data/test-kitchen.gemspec +42 -33
  114. metadata +107 -33
data/Gemfile CHANGED
@@ -1,10 +1,14 @@
1
- source 'https://rubygems.org'
1
+ # -*- encoding: utf-8 -*-
2
+ source "https://rubygems.org"
2
3
  gemspec
3
4
 
4
5
  group :guard do
5
- gem 'rb-inotify', :require => false
6
- gem 'rb-fsevent', :require => false
7
- gem 'rb-fchange', :require => false
8
- gem 'guard-minitest'
9
- gem 'guard-cucumber', '~> 1.4'
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
- guard 'minitest' do
2
- watch(%r|^spec/(.*)_spec\.rb|)
3
- watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
4
- watch(%r|^spec/spec_helper\.rb|) { "spec" }
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
- cucumber_cli = '--no-profile --color --format progress --strict'
8
- cucumber_cli += ' --tags ~@spawn' if RUBY_PLATFORM =~ /mswin|mingw|windows/
9
- guard 'cucumber', cli: cucumber_cli do
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/.+$}) { 'features' }
12
- watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
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 confiuration; what you want to test and on which target
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
- require 'bundler/gem_tasks'
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['spec/**/*_spec.rb']
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 = ['features', '-x', '--format progress']
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
- unless RUBY_ENGINE == 'jruby'
28
- require 'cane/rake_task'
29
- require 'tailor/rake_task'
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 = './.cane'
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]
@@ -5,9 +5,9 @@
5
5
  # https://twitter.com/mitchellh/status/283014103189053442
6
6
  Signal.trap("INT") { exit 1 }
7
7
 
8
- $:.unshift File.join(File.dirname(__FILE__), %w{.. lib})
9
- require 'rubygems'
10
- require 'kitchen/cli'
11
- require 'kitchen/errors'
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