test-kitchen 1.4.2 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.travis.yml +29 -33
  4. data/CHANGELOG.md +86 -2
  5. data/CONTRIBUTING.md +17 -0
  6. data/Gemfile.proxy_tests +5 -0
  7. data/MAINTAINERS.md +24 -0
  8. data/features/kitchen_driver_discover_command.feature +6 -0
  9. data/features/kitchen_init_command.feature +55 -7
  10. data/features/step_definitions/gem_steps.rb +12 -4
  11. data/features/step_definitions/git_steps.rb +1 -1
  12. data/features/step_definitions/output_steps.rb +1 -1
  13. data/features/support/env.rb +13 -9
  14. data/lib/kitchen/cli.rb +46 -5
  15. data/lib/kitchen/command/driver_discover.rb +8 -0
  16. data/lib/kitchen/command.rb +1 -0
  17. data/lib/kitchen/config.rb +4 -0
  18. data/lib/kitchen/configurable.rb +32 -0
  19. data/lib/kitchen/driver/ssh_base.rb +18 -4
  20. data/lib/kitchen/generator/driver_create.rb +2 -2
  21. data/lib/kitchen/generator/init.rb +4 -4
  22. data/lib/kitchen/instance.rb +7 -0
  23. data/lib/kitchen/lazy_hash.rb +20 -0
  24. data/lib/kitchen/logger.rb +4 -7
  25. data/lib/kitchen/provisioner/base.rb +16 -1
  26. data/lib/kitchen/provisioner/chef_base.rb +43 -98
  27. data/lib/kitchen/provisioner/chef_solo.rb +7 -4
  28. data/lib/kitchen/provisioner/chef_zero.rb +12 -5
  29. data/lib/kitchen/ssh.rb +1 -1
  30. data/lib/kitchen/transport/base.rb +7 -0
  31. data/lib/kitchen/transport/ssh.rb +13 -6
  32. data/lib/kitchen/transport/winrm.rb +168 -50
  33. data/lib/kitchen/verifier/base.rb +18 -1
  34. data/lib/kitchen/verifier/busser.rb +12 -5
  35. data/lib/kitchen/verifier/shell.rb +101 -0
  36. data/lib/kitchen/version.rb +1 -2
  37. data/spec/kitchen/collection_spec.rb +1 -1
  38. data/spec/kitchen/configurable_spec.rb +211 -2
  39. data/spec/kitchen/driver/ssh_base_spec.rb +131 -8
  40. data/spec/kitchen/lazy_hash_spec.rb +27 -0
  41. data/spec/kitchen/logger_spec.rb +10 -0
  42. data/spec/kitchen/provisioner/base_spec.rb +25 -0
  43. data/spec/kitchen/provisioner/chef_base_spec.rb +133 -252
  44. data/spec/kitchen/provisioner/chef_solo_spec.rb +30 -0
  45. data/spec/kitchen/provisioner/chef_zero_spec.rb +27 -2
  46. data/spec/kitchen/provisioner/shell_spec.rb +60 -12
  47. data/spec/kitchen/ssh_spec.rb +1 -1
  48. data/spec/kitchen/transport/ssh_spec.rb +2 -1
  49. data/spec/kitchen/transport/winrm_spec.rb +228 -48
  50. data/spec/kitchen/verifier/base_spec.rb +26 -0
  51. data/spec/kitchen/verifier/busser_spec.rb +69 -3
  52. data/spec/kitchen/verifier/shell_spec.rb +157 -0
  53. data/support/busser_install_command.sh +1 -2
  54. data/support/chef_base_install_command.ps1 +19 -12
  55. data/templates/driver/README.md.erb +1 -1
  56. data/test-kitchen.gemspec +12 -3
  57. metadata +106 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed6240c00a8d6ca35986ab16735134c1fe4368b1
4
- data.tar.gz: 3b4324d554794093cc15ebd2f82e9bca3c426074
3
+ metadata.gz: 08a62137db48122bfe93dc6da4e462fc95941bcf
4
+ data.tar.gz: 72a2c0b1c5ecea3f074386e41316ccd3e6d1e565
5
5
  SHA512:
6
- metadata.gz: d1949f7688de24d288aa21d15f4d1bc80dc049937b60ab56e3ac445211e7c68c57fcb7c2b1f3fc93fa25e341f2dd9907494ecdcfcda4518dd2939cbed22fec3f
7
- data.tar.gz: a8713a783d3ff9b2dff382e790a1496ec75b1f305bab75b02d0a5a36f505995c4b998f2a0a057d6d7443371757b50d69aa732b1d16a467211378500b021836d3
6
+ metadata.gz: 40a9ceb94182a02f14007b5396e21d729246e2ab51f45e7cbb934b70a605446a53d83001a73ad0b0b4ae8a742bf6656e540f67e016064546ce817158bb7e488f
7
+ data.tar.gz: f326bbd4cb7f2d454a9fb5f42cef75799641782fda6d681cb1bb44059d49fe1c5304d5325b858ac5594d6cacf1ada040cc7f1d32cfcba799a70d6014176c7d98
data/.gitignore CHANGED
@@ -3,7 +3,7 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
6
+ Gemfile*.lock
7
7
  InstalledFiles
8
8
  _yardoc
9
9
  coverage
data/.travis.yml CHANGED
@@ -1,22 +1,12 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.2
5
- - 2.1
4
+ - 2.2.4
5
+ - 2.1.8
6
6
  - 2.0.0
7
- - 1.9.3
8
7
  - ruby-head
9
8
 
10
- env:
11
- - RUBYGEMS_VERSION=
12
- - RUBYGEMS_VERSION=2.4.5
13
- - RUBYGEMS_VERSION=2.2.2
14
- - RUBYGEMS_VERSION=2.1.11
15
- - RUBYGEMS_VERSION=2.0.14
16
- - RUBYGEMS_VERSION=1.8.29
17
-
18
9
  before_install:
19
- - if [ -n "$RUBYGEMS_VERSION" ]; then gem update --system $RUBYGEMS_VERSION; fi
20
10
  - gem --version
21
11
 
22
12
  bundler_args: --without guard
@@ -24,29 +14,35 @@ bundler_args: --without guard
24
14
  sudo: false
25
15
 
26
16
  matrix:
17
+ include:
18
+ - rvm: 2.2.4
19
+ sudo: required
20
+ dist: trusty
21
+ # To run the proxy tests we need additional gems than what Test Kitchen normally uses
22
+ # for testing
23
+ gemfile: Gemfile.proxy_tests
24
+ before_install:
25
+ - gem install bundler
26
+ - sudo apt-get update
27
+ - sudo apt-get -y install squid3 git curl
28
+ env:
29
+ # ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
30
+ - secure: "E7h427Y8z6Nx5sdrA4Ye9gO9pDGpe4jxfhJdM4HPJIM/FSkEJM0ZDPdvhQ6QAQ1S1AHja/JhQUFaNP5NzKhRkVqGCzunBBC6RVb7pp1Qo16EMhJkg7LEsExiSsjQykAzt2w6K/71V+mIlMKxCPYdpu6PT/8w/jZFgBqLEHXuogU="
31
+ - global:
32
+ - PROXY_TESTS_DIR=proxy_tests/files/default/scripts
33
+ - PROXY_TESTS_REPO=$PROXY_TESTS_DIR/repo
34
+
35
+ script:
36
+ - bundle exec kitchen --version
37
+ # TODO switch to master when https://github.com/chef/proxy_tests/pull/12 is merged
38
+ - git clone https://github.com/chef/proxy_tests.git
39
+ - rvmsudo -E bundle exec bash $PROXY_TESTS_DIR/run_tests.sh kitchen \* \* /tmp/out.txt
40
+ after_script:
41
+ - cat /tmp/out.txt
42
+ - sudo cat /var/log/squid3/cache.log
43
+ - sudo cat /var/log/squid3/access.log
27
44
  allow_failures:
28
45
  - rvm: ruby-head
29
- exclude:
30
- - rvm: 2.2
31
- env: RUBYGEMS_VERSION=2.2.2
32
- - rvm: 2.2
33
- env: RUBYGEMS_VERSION=2.1.11
34
- - rvm: 2.2
35
- env: RUBYGEMS_VERSION=2.0.14
36
- - rvm: 2.2
37
- env: RUBYGEMS_VERSION=1.8.29
38
- - rvm: 2.1
39
- env: RUBYGEMS_VERSION=1.8.29
40
- - rvm: 2.0.0
41
- env: RUBYGEMS_VERSION=1.8.29
42
- - rvm: ruby-head
43
- env: RUBYGEMS_VERSION=2.2.2
44
- - rvm: ruby-head
45
- env: RUBYGEMS_VERSION=2.1.11
46
- - rvm: ruby-head
47
- env: RUBYGEMS_VERSION=2.0.14
48
- - rvm: ruby-head
49
- env: RUBYGEMS_VERSION=1.8.29
50
46
 
51
47
  notifications:
52
48
  irc: "chat.freenode.net#kitchenci"
data/CHANGELOG.md CHANGED
@@ -1,4 +1,48 @@
1
- ## 1.4.2
1
+ ## 1.5.0
2
+
3
+ ### Potentially breaking changes
4
+
5
+ ### Bug fixes
6
+
7
+ * PR [#499][]: Use single quotes in Rake/Thorfile templates ([@chr4][])
8
+ * PR [#697][]: Set default log level even if you forget to add it to command line arg ([@scotthain][])
9
+ * PR [#816][]: Fix SuSe OS Busser install ([@Peuserik][])
10
+ * PR [#824][]: Fix handling of chunked ssh output ([@kingpong][])
11
+ * PR [#833][]: Updates the gem path to install everything in /tmp/verifier ([@scotthain][])
12
+ * PR [#835][]: WinRM connect (with retry) is failing on Windows ([@Stift][])
13
+ * PR [#864][]: Fix Windows Omnibus Install ([@dissonanz][])
14
+ * PR [#878][]: write install_command to file and invoke on the instance to avoid command too long on windows ([@mwrock][])
15
+ * PR [#897][]: typo: on != no ([@miketheman][])
16
+ * PR [#919][]: Because net/ssh is no longer including timeout.rb, we need to so that Ruby doesn't think Timeout belongs to the TK class ([@tyler-ball][])
17
+
18
+ ### New features
19
+
20
+ * PR [#741][]: Add shell verifier ([@sawanoboly][])
21
+ * PR [#752][]: Make lazyhash enumerable ([@caboteria][])
22
+ * PR [#827][]: update omnibus url to chef.io ([@andrewelizondo][])
23
+ * PR [#857][]: add cli option to set the test path ([@chris-rock][])
24
+ * PR [#892][]: Adding proxy tests to the Travis.yml ([@tyler-ball][])
25
+ * PR [#895][]: Adding in ChefConfig support to enable loading proxy config from chef config files ([@tyler-ball][])
26
+ * PR [#901][]: Add support for --profile-ruby ([@martinb3][])
27
+ * PR [#906][]: Adding Maintainers file ([@cheeseplus][])
28
+
29
+ ### Improvements
30
+
31
+ * PR [#753][]: add tests for empty or missing files ([@miketheman][])
32
+ * PR [#776][]: Add more options for WinRM ([@smurawski][])
33
+ * PR [#782][]: Use [`mixlib-install`](https://github.com/chef/mixlib-install) to generate chef install command. ([@thommay][])
34
+ * PR [#804][]: Drop Ruby 1.9 from TravisCI build matrix ([@thommay][])
35
+ * PR [#813][]: Honor proxy ENV variables ([@mcquin][])
36
+ * PR [#825][]: Add hooks for instance cleanup before exit ([@coderanger][])
37
+ * PR [#872][]: Added try/catch around main and set error action to stop ([@mcallb][])
38
+ * PR [#885][]: Running the chef_base provisioner install_command via sudo, and command_prefix support ([@adamleff][])
39
+ * PR [#896][]: Fixing garbled output for chef_zero provisioner ([@someara][])
40
+ * PR [#908][]: Updating to the latest release of net-ssh to consume https://github.com/net-ssh/net-ssh/pull/280 ([@tyler-ball][])
41
+ * PR [#911][]: Put Travis on a diet ([@cheeseplus][])
42
+ * PR [#912][]: The netssh 3.0 update returns a different error on connection timeout than 2.9.2 did, adding it to the retry list ([@tyler-ball][])
43
+
44
+
45
+ ## 1.4.2 / 2015-08-03
2
46
 
3
47
  ### Potentially breaking changes
4
48
 
@@ -717,6 +761,7 @@ The initial release.
717
761
  [#481]: https://github.com/test-kitchen/test-kitchen/issues/481
718
762
  [#489]: https://github.com/test-kitchen/test-kitchen/issues/489
719
763
  [#498]: https://github.com/test-kitchen/test-kitchen/issues/498
764
+ [#499]: https://github.com/test-kitchen/test-kitchen/issues/499
720
765
  [#504]: https://github.com/test-kitchen/test-kitchen/issues/504
721
766
  [#507]: https://github.com/test-kitchen/test-kitchen/issues/507
722
767
  [#510]: https://github.com/test-kitchen/test-kitchen/issues/510
@@ -762,6 +807,7 @@ The initial release.
762
807
  [#675]: https://github.com/test-kitchen/test-kitchen/issues/675
763
808
  [#688]: https://github.com/test-kitchen/test-kitchen/issues/688
764
809
  [#689]: https://github.com/test-kitchen/test-kitchen/issues/689
810
+ [#697]: https://github.com/test-kitchen/test-kitchen/issues/697
765
811
  [#704]: https://github.com/test-kitchen/test-kitchen/issues/704
766
812
  [#711]: https://github.com/test-kitchen/test-kitchen/issues/711
767
813
  [#728]: https://github.com/test-kitchen/test-kitchen/issues/728
@@ -769,13 +815,45 @@ The initial release.
769
815
  [#734]: https://github.com/test-kitchen/test-kitchen/issues/734
770
816
  [#736]: https://github.com/test-kitchen/test-kitchen/issues/736
771
817
  [#737]: https://github.com/test-kitchen/test-kitchen/issues/737
818
+ [#741]: https://github.com/test-kitchen/test-kitchen/issues/741
819
+ [#752]: https://github.com/test-kitchen/test-kitchen/issues/752
820
+ [#753]: https://github.com/test-kitchen/test-kitchen/issues/753
821
+ [#776]: https://github.com/test-kitchen/test-kitchen/issues/776
822
+ [#782]: https://github.com/test-kitchen/test-kitchen/issues/782
772
823
  [#801]: https://github.com/test-kitchen/test-kitchen/issues/801
773
824
  [#802]: https://github.com/test-kitchen/test-kitchen/issues/802
825
+ [#804]: https://github.com/test-kitchen/test-kitchen/issues/804
826
+ [#813]: https://github.com/test-kitchen/test-kitchen/issues/813
827
+ [#816]: https://github.com/test-kitchen/test-kitchen/issues/816
828
+ [#824]: https://github.com/test-kitchen/test-kitchen/issues/824
829
+ [#825]: https://github.com/test-kitchen/test-kitchen/issues/825
830
+ [#827]: https://github.com/test-kitchen/test-kitchen/issues/827
831
+ [#833]: https://github.com/test-kitchen/test-kitchen/issues/833
832
+ [#835]: https://github.com/test-kitchen/test-kitchen/issues/835
833
+ [#857]: https://github.com/test-kitchen/test-kitchen/issues/857
834
+ [#864]: https://github.com/test-kitchen/test-kitchen/issues/864
835
+ [#872]: https://github.com/test-kitchen/test-kitchen/issues/872
836
+ [#878]: https://github.com/test-kitchen/test-kitchen/issues/878
837
+ [#885]: https://github.com/test-kitchen/test-kitchen/issues/885
838
+ [#892]: https://github.com/test-kitchen/test-kitchen/issues/892
839
+ [#895]: https://github.com/test-kitchen/test-kitchen/issues/895
840
+ [#896]: https://github.com/test-kitchen/test-kitchen/issues/896
841
+ [#897]: https://github.com/test-kitchen/test-kitchen/issues/897
842
+ [#901]: https://github.com/test-kitchen/test-kitchen/issues/901
843
+ [#906]: https://github.com/test-kitchen/test-kitchen/issues/906
844
+ [#908]: https://github.com/test-kitchen/test-kitchen/issues/908
845
+ [#911]: https://github.com/test-kitchen/test-kitchen/issues/911
846
+ [#912]: https://github.com/test-kitchen/test-kitchen/issues/912
847
+ [#919]: https://github.com/test-kitchen/test-kitchen/issues/919
774
848
  [@Annih]: https://github.com/Annih
775
849
  [@ChrisLundquist]: https://github.com/ChrisLundquist
776
850
  [@MarkGibbons]: https://github.com/MarkGibbons
851
+ [@Peuserik]: https://github.com/Peuserik
852
+ [@Stift]: https://github.com/Stift
777
853
  [@adamhjk]: https://github.com/adamhjk
854
+ [@adamleff]: https://github.com/adamleff
778
855
  [@afiune]: https://github.com/afiune
856
+ [@andrewelizondo]: https://github.com/andrewelizondo
779
857
  [@arangamani]: https://github.com/arangamani
780
858
  [@arunthampi]: https://github.com/arunthampi
781
859
  [@benlangfeld]: https://github.com/benlangfeld
@@ -783,10 +861,14 @@ The initial release.
783
861
  [@bryanwb]: https://github.com/bryanwb
784
862
  [@caboteria]: https://github.com/caboteria
785
863
  [@calavera]: https://github.com/calavera
864
+ [@cheeseplus]: https://github.com/cheeseplus
865
+ [@chr4]: https://github.com/chr4
866
+ [@chris-rock]: https://github.com/chris-rock
786
867
  [@chrishenry]: https://github.com/chrishenry
787
868
  [@coderanger]: https://github.com/coderanger
788
869
  [@curiositycasualty]: https://github.com/curiositycasualty
789
870
  [@daniellockard]: https://github.com/daniellockard
871
+ [@dissonanz]: https://github.com/dissonanz
790
872
  [@ekrupnik]: https://github.com/ekrupnik
791
873
  [@fnichol]: https://github.com/fnichol
792
874
  [@fnordfish]: https://github.com/fnordfish
@@ -810,12 +892,14 @@ The initial release.
810
892
  [@juliandunn]: https://github.com/juliandunn
811
893
  [@justincampbell]: https://github.com/justincampbell
812
894
  [@kamalim]: https://github.com/kamalim
895
+ [@kingpong]: https://github.com/kingpong
813
896
  [@kisoku]: https://github.com/kisoku
814
897
  [@lamont-granquist]: https://github.com/lamont-granquist
815
898
  [@lloydde]: https://github.com/lloydde
816
899
  [@manul]: https://github.com/manul
817
900
  [@martinb3]: https://github.com/martinb3
818
901
  [@mattray]: https://github.com/mattray
902
+ [@mcallb]: https://github.com/mcallb
819
903
  [@mconigliaro]: https://github.com/mconigliaro
820
904
  [@mcquin]: https://github.com/mcquin
821
905
  [@metadave]: https://github.com/metadave
@@ -851,4 +935,4 @@ The initial release.
851
935
  [@tyler-ball]: https://github.com/tyler-ball
852
936
  [@whiteley]: https://github.com/whiteley
853
937
  [@zl4bv]: https://github.com/zl4bv
854
- [@zts]: https://github.com/zts
938
+ [@zts]: https://github.com/zts
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,17 @@
1
+ # Release Process
2
+
3
+ This release process applies to all Test Kitchen projects, but each project may have additional requirements.
4
+
5
+ 1. Perform a Github diff between master and the last released version. Determine whether included PRs justify a patch, minor or major version release.
6
+ 2. Check out the master branch of the project being prepared for release.
7
+ 3. Branch into a release-branch of the form `150_release_prep`.
8
+ 4. Modify the `version.rb` file to specify the version for releasing.
9
+ 5. Update the changelog to include what is being released.
10
+ 1. For these projects we use [PimpMyChangelog](https://github.com/pcreux/pimpmychangelog). All this does is make the CHANGELOG look pretty - for now we manually import the PRs / Issues and categorize them.
11
+ 2. Start a [diff](https://github.com/test-kitchen/test-kitchen/compare/v1.4.2...master) in Github between master and the last release
12
+ 3. Look for all the merged PRs and add them to the CHANGELOG.md under the appropriate category. They should have the form `* PR #999: PR Description (@author)`.
13
+ 4. Install and run `pimpmychangelog`. This should change all the PR numbers and @ mentions into links.
14
+ 6. `git commit` the `version.rb` and `CHANGELOG.md` changes to the branch and setup a PR for them. Allow the PR to run any automated tests and review the CHANGELOG for accuracy.
15
+ 7. Merge the PR to master after review.
16
+ 8. Switch your local copy to the master branch and `git pull` to pull in the release preperation changes.
17
+ 9. Run `rake release` on the master branch.
@@ -0,0 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+ eval_gemfile File.join(File.dirname(__FILE__), "Gemfile")
3
+
4
+ gem "kitchen-ec2"
5
+ gem "chef-config"
data/MAINTAINERS.md ADDED
@@ -0,0 +1,24 @@
1
+ # Maintainers
2
+
3
+ This file lists how the Test Kitchen project is maintained. When making changes
4
+ to the system, this file tells you who needs to review your patch. You need a :+1: vote
5
+ from at least 2 members of the project team listed below. Additionally, you need to not
6
+ receive a veto from the Lieutenant or the Project Lead.
7
+
8
+ ## Project Lead
9
+
10
+ * [Fletcher Nichol](https://github.com/fnichol)
11
+
12
+ ## Lieutenants
13
+ * [Tyler Ball](https://github.com/tyler-ball)
14
+
15
+ ## Maintainers
16
+
17
+ * [Seth Thomas](https://github.com/cheeseplus)
18
+ * [Adam Leff](https://github.com/adamleff)
19
+ * [Jennifer Davis](https://github.com/iennae)
20
+ * [Matt Wrock](https://github.com/mwrock)
21
+ * [Steven Murawski](http://github.com/smurawski)
22
+ * [Chris Hartmann](https://github.com/chris-rock)
23
+ * [Sean Omeara](http://github.com/someara)
24
+ * [Robb Kidd](https://github.com/robbkidd)
@@ -17,3 +17,9 @@ Feature: Search RubyGems to discover new Test Kitchen Driver gems
17
17
  When I run `kitchen driver discover`
18
18
  Then the exit status should be 0
19
19
  And the output should contain "kitchen-bluebox"
20
+
21
+ Scenario: Running driver discover with the --chef-config-path parameter loads the chef config
22
+ Given an empty file named "kitchen_client.rb"
23
+ When I run `kitchen driver discover --chef-config-path=kitchen_client.rb`
24
+ Then the exit status should be 0
25
+ And the output should contain "kitchen-bluebox"
@@ -3,6 +3,9 @@ Feature: Add Test Kitchen support to an existing project
3
3
  As an operator
4
4
  I want to run a command to initialize my project
5
5
 
6
+ Background:
7
+ Given a sandboxed GEM_HOME directory named "kitchen-init"
8
+
6
9
  @spawn
7
10
  Scenario: Displaying help
8
11
  When I run `kitchen help init`
@@ -15,8 +18,7 @@ Feature: Add Test Kitchen support to an existing project
15
18
 
16
19
  @spawn
17
20
  Scenario: Running init with default values
18
- Given a sandboxed GEM_HOME directory named "kitchen-init"
19
- And I have a git repository
21
+ Given I have a git repository
20
22
  When I run `kitchen init`
21
23
  Then the exit status should be 0
22
24
  And a directory named "test/integration/default" should exist
@@ -165,15 +167,15 @@ Feature: Add Test Kitchen support to an existing project
165
167
  Then the file "Rakefile" should contain:
166
168
  """
167
169
  begin
168
- require "kitchen/rake_tasks"
170
+ require 'kitchen/rake_tasks'
169
171
  Kitchen::RakeTasks.new
170
172
  rescue LoadError
171
- puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV["CI"]
173
+ puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
172
174
  end
173
175
  """
174
176
 
175
177
  Scenario: Running without git doesn't make a .gitignore
176
- When I successfully run `kitchen init`
178
+ When I successfully run `kitchen init --no-driver`
177
179
  Then the exit status should be 0
178
180
  And a file named ".gitignore" should not exist
179
181
 
@@ -184,10 +186,10 @@ Feature: Add Test Kitchen support to an existing project
184
186
  Then the file "Thorfile" should contain:
185
187
  """
186
188
  begin
187
- require "kitchen/thor_tasks"
189
+ require 'kitchen/thor_tasks'
188
190
  Kitchen::ThorTasks.new
189
191
  rescue LoadError
190
- puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV["CI"]
192
+ puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
191
193
  end
192
194
  """
193
195
 
@@ -224,3 +226,49 @@ Feature: Add Test Kitchen support to an existing project
224
226
  attributes:
225
227
 
226
228
  """
229
+
230
+ Scenario: Running init with an empty file metadata.rb sets an empty run list
231
+ Given an empty file named "metadata.rb"
232
+ When I successfully run `kitchen init`
233
+ Then the file ".kitchen.yml" should contain exactly:
234
+ """
235
+ ---
236
+ driver:
237
+ name: vagrant
238
+
239
+ provisioner:
240
+ name: chef_solo
241
+
242
+ platforms:
243
+ - name: ubuntu-14.04
244
+ - name: centos-7.1
245
+
246
+ suites:
247
+ - name: default
248
+ run_list:
249
+ attributes:
250
+
251
+ """
252
+
253
+ Scenario: Running init with no metadata.rb file sets an empty run list
254
+ Given a file named "metadata.rb" does not exist
255
+ When I successfully run `kitchen init`
256
+ Then the file ".kitchen.yml" should contain exactly:
257
+ """
258
+ ---
259
+ driver:
260
+ name: vagrant
261
+
262
+ provisioner:
263
+ name: chef_solo
264
+
265
+ platforms:
266
+ - name: ubuntu-14.04
267
+ - name: centos-7.1
268
+
269
+ suites:
270
+ - name: default
271
+ run_list:
272
+ attributes:
273
+
274
+ """
@@ -10,19 +10,27 @@ Given(/^a sandboxed GEM_HOME directory named "(.*?)"$/) do |name|
10
10
  @aruba_timeout_seconds = 30
11
11
 
12
12
  gem_home = Pathname.new(Dir.mktmpdir(name))
13
- ENV["GEM_HOME"] = gem_home.to_s
14
- ENV["GEM_PATH"] = [gem_home.to_s, ENV["GEM_PATH"]].join(":")
13
+ aruba.environment["GEM_HOME"] = gem_home.to_s
14
+ aruba.environment["GEM_PATH"] = [gem_home.to_s, ENV["GEM_PATH"]].join(":")
15
15
  @cleanup_dirs << gem_home
16
16
  end
17
17
 
18
18
  Then(/^a gem named "(.*?)" is installed with version "(.*?)"$/) do |name, version|
19
19
  unbundlerize do
20
- run_simple(unescape("gem list #{name} --version #{version} -i"), true, nil)
20
+ run_simple(
21
+ sanitize_text("gem list #{name} --version #{version} -i"),
22
+ :fail_on_error => true,
23
+ :exit_timeout => nil
24
+ )
21
25
  end
22
26
  end
23
27
 
24
28
  Then(/^a gem named "(.*?)" is installed$/) do |name|
25
29
  unbundlerize do
26
- run_simple(unescape("gem list #{name} -i"), true, nil)
30
+ run_simple(
31
+ sanitize_text("gem list #{name} -i"),
32
+ :fail_on_error => true,
33
+ :exit_timeout => nil
34
+ )
27
35
  end
28
36
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Given(/I have a git repository/) do
4
- create_dir(".git")
4
+ create_directory(".git")
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Then(/^the stdout should match \/([^\/]*)\/$/) do |expected|
4
- assert_matching_output(expected, all_stdout)
4
+ expect(last_command_started).to have_output_on_stdout(Regexp.new(expected))
5
5
  end
@@ -31,12 +31,12 @@ Before do
31
31
  @aruba_timeout_seconds = 15
32
32
  @cleanup_dirs = []
33
33
 
34
- Aruba::Processes::InProcess.main_class = ArubaHelper
35
- Aruba.process = Aruba::Processes::InProcess
34
+ aruba.config.command_launcher = :in_process
35
+ aruba.config.main_class = ArubaHelper
36
36
  end
37
37
 
38
38
  Before("@spawn") do
39
- Aruba.process = Aruba::Processes::SpawnProcess
39
+ aruba.config.command_launcher = :spawn
40
40
  end
41
41
 
42
42
  After do |s|
@@ -47,25 +47,29 @@ After do |s|
47
47
 
48
48
  # Restore environment variables to their original settings, if they have
49
49
  # been saved off
50
- ENV.keys.select { |key| key =~ /^_CUKE_/ }.each do |backup_key|
51
- ENV[backup_key.sub(/^_CUKE_/, "")] = ENV.delete(backup_key)
52
- end
50
+ env = aruba.environment
51
+ env.to_h.keys.select { |key| key =~ /^_CUKE_/ }.
52
+ each do |backup_key|
53
+ env[backup_key.sub(/^_CUKE_/, "")] = env[backup_key]
54
+ env.delete(backup_key)
55
+ end
53
56
 
54
57
  @cleanup_dirs.each { |dir| FileUtils.rm_rf(dir) }
55
58
  end
56
59
 
57
60
  def backup_envvar(key)
58
- ENV["_CUKE_#{key}"] = ENV[key]
61
+ aruba.environment["_CUKE_#{key}"] = aruba.environment[key]
59
62
  end
60
63
 
61
64
  def restore_envvar(key)
62
- ENV[key] = ENV.delete("_CUKE_#{key}")
65
+ aruba.environment[key] = aruba.environment["_CUKE_#{key}"]
66
+ aruba.environment.delete("_CUKE_#{key}")
63
67
  end
64
68
 
65
69
  def unbundlerize
66
70
  keys = %w[BUNDLER_EDITOR BUNDLE_BIN_PATH BUNDLE_GEMFILE RUBYOPT]
67
71
 
68
- keys.each { |key| backup_envvar(key); ENV.delete(key) }
72
+ keys.each { |key| backup_envvar(key); aruba.environment.delete(key) }
69
73
  yield
70
74
  keys.each { |key| restore_envvar(key) }
71
75
  end
data/lib/kitchen/cli.rb CHANGED
@@ -93,6 +93,14 @@ module Kitchen
93
93
  :type => :boolean
94
94
  end
95
95
 
96
+ # Sets the test_base_path method_options
97
+ # @api private
98
+ def self.test_base_path
99
+ method_option :test_base_path,
100
+ :aliases => "-t",
101
+ :desc => "Set the base path of the tests"
102
+ end
103
+
96
104
  desc "list [INSTANCE|REGEXP|all]", "Lists one or more instances"
97
105
  method_option :bare,
98
106
  :aliases => "-b",
@@ -165,6 +173,7 @@ module Kitchen
165
173
  [Future DEPRECATION, use --concurrency]
166
174
  Run a #{action} against all matching instances concurrently.
167
175
  DESC
176
+ test_base_path
168
177
  log_options
169
178
  define_method(action) do |*args|
170
179
  update_config!
@@ -210,6 +219,7 @@ module Kitchen
210
219
  :type => :boolean,
211
220
  :default => false,
212
221
  :desc => "Invoke init command if .kitchen.yml is missing"
222
+ test_base_path
213
223
  log_options
214
224
  def test(*args)
215
225
  update_config!
@@ -287,6 +297,9 @@ module Kitchen
287
297
  guarenteed that every result is a driver, but chances are good most
288
298
  relevant drivers will be returned.
289
299
  D
300
+ method_option :chef_config_path,
301
+ :default => nil,
302
+ :desc => "Path to chef config file containing proxy configuration to use"
290
303
  def discover
291
304
  perform("discover", "driver_discover", args)
292
305
  end
@@ -331,23 +344,51 @@ module Kitchen
331
344
  #
332
345
  # @api private
333
346
  def update_config!
334
- if options[:log_level]
335
- level = options[:log_level].downcase.to_sym
336
- @config.log_level = level
337
- end
347
+ @config.log_level = log_level if log_level
348
+
338
349
  unless options[:log_overwrite].nil?
339
350
  @config.log_overwrite = options[:log_overwrite]
340
351
  end
341
352
 
353
+ if options[:test_base_path]
354
+ # ensure we have an absolute path
355
+ @config.test_base_path = File.absolute_path(options[:test_base_path])
356
+ end
357
+
342
358
  # Now that we have required configs, lets create our file logger
343
359
  Kitchen.logger = Kitchen.default_file_logger(
344
- level,
360
+ log_level,
345
361
  options[:log_overwrite]
346
362
  )
347
363
 
348
364
  update_parallel!
349
365
  end
350
366
 
367
+ # Validate the log level from the config / CLI options, defaulting
368
+ # to :info if the supplied level is empty or invalid
369
+ #
370
+ # @api private
371
+ def log_level
372
+ return unless options[:log_level]
373
+ return @log_level if @log_level
374
+
375
+ level = options[:log_level].downcase.to_sym
376
+ unless valid_log_level?(level)
377
+ level = :info
378
+ banner "WARNING - invalid log level specified: " \
379
+ "\"#{options[:log_level]}\" - reverting to :info log level."
380
+ end
381
+
382
+ @log_level = level
383
+ end
384
+
385
+ # Check to whether a provided log level is valid
386
+ #
387
+ # @api private
388
+ def valid_log_level?(level)
389
+ !Util.to_logger_level(level).nil?
390
+ end
391
+
351
392
  # Set parallel concurrency options for Thor
352
393
  #
353
394
  # @api private
@@ -19,6 +19,8 @@
19
19
  require "kitchen/command"
20
20
 
21
21
  require "rubygems/spec_fetcher"
22
+ require "chef-config/config"
23
+ require "chef-config/workstation_config_loader"
22
24
 
23
25
  module Kitchen
24
26
 
@@ -31,6 +33,12 @@ module Kitchen
31
33
 
32
34
  # Invoke the command.
33
35
  def call
36
+ # We are introducing the idea of using the Chef configuration as a
37
+ # unified config for all the ChefDK tools. The first practical
38
+ # implementation of this is 1 location to setup proxy configurations.
39
+ ChefConfig::WorkstationConfigLoader.new(options[:chef_config_path]).load
40
+ ChefConfig::Config.export_proxies
41
+
34
42
  specs = fetch_gem_specs.sort { |x, y| x[0] <=> y[0] }
35
43
  specs = specs[0, 49].push(["...", "..."]) if specs.size > 49
36
44
  specs = specs.unshift(["Gem Name", "Latest Stable Release"])
@@ -174,6 +174,7 @@ module Kitchen
174
174
  threads << Thread.new do
175
175
  while instance = queue.pop
176
176
  instance.public_send(action, *args)
177
+ instance.cleanup!
177
178
  end
178
179
  end
179
180
  end
@@ -77,6 +77,10 @@ module Kitchen
77
77
  # @api private
78
78
  attr_accessor :log_overwrite
79
79
 
80
+ # @return [String] an absolute path to the directory containing test suites
81
+ # @api private
82
+ attr_accessor :test_base_path
83
+
80
84
  # Creates a new configuration, representing a particular testing
81
85
  # configuration for a project.
82
86
  #