test-kitchen 1.16.0 → 1.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +2 -0
- data/.travis.yml +5 -11
- data/CHANGELOG.md +7 -0
- data/ECOSYSTEM.md +6 -6
- data/Gemfile +7 -5
- data/README.md +0 -4
- data/Rakefile +1 -1
- data/appveyor.yml +2 -1
- data/features/kitchen_console_command.feature +1 -0
- data/lib/kitchen/command/driver_discover.rb +1 -1
- data/lib/kitchen/config.rb +0 -5
- data/lib/kitchen/configurable.rb +2 -2
- data/lib/kitchen/driver/ssh_base.rb +2 -2
- data/lib/kitchen/generator/init.rb +1 -1
- data/lib/kitchen/provisioner/base.rb +5 -3
- data/lib/kitchen/provisioner/chef/common_sandbox.rb +9 -10
- data/lib/kitchen/provisioner/shell.rb +1 -1
- data/lib/kitchen/transport/base.rb +1 -0
- data/lib/kitchen/transport/ssh.rb +6 -0
- data/lib/kitchen/transport/winrm.rb +7 -0
- data/lib/kitchen/util.rb +54 -0
- data/lib/kitchen/verifier/base.rb +6 -4
- data/lib/kitchen/verifier/busser.rb +4 -6
- data/lib/kitchen/version.rb +1 -1
- data/spec/kitchen/config_spec.rb +5 -1
- data/spec/kitchen/configurable_spec.rb +1 -1
- data/spec/kitchen/driver/base_spec.rb +1 -1
- data/spec/kitchen/driver/proxy_spec.rb +1 -1
- data/spec/kitchen/driver/ssh_base_spec.rb +2 -2
- data/spec/kitchen/instance_spec.rb +10 -4
- data/spec/kitchen/loader/yaml_spec.rb +10 -10
- data/spec/kitchen/logger_spec.rb +1 -1
- data/spec/kitchen/login_command_spec.rb +1 -1
- data/spec/kitchen/platform_spec.rb +2 -2
- data/spec/kitchen/provisioner/base_spec.rb +5 -5
- data/spec/kitchen/provisioner/chef_base_spec.rb +4 -4
- data/spec/kitchen/provisioner/chef_zero_spec.rb +2 -2
- data/spec/kitchen/transport/ssh_spec.rb +2 -2
- data/spec/kitchen/transport/winrm_spec.rb +1 -1
- data/spec/kitchen/util_spec.rb +94 -0
- data/spec/kitchen/verifier/base_spec.rb +5 -5
- data/spec/kitchen/verifier/busser_spec.rb +6 -6
- data/spec/spec_helper.rb +3 -1
- data/test-kitchen.gemspec +1 -3
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13d92eb0bbf9293ce27c929b2996bafb9c541944
|
4
|
+
data.tar.gz: fc171e5c1aed0b53f5eb63ebb027057550f25f11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26d62a953bfa1ba500c10aa513418620cdd3a00b4d31c4c59223db20daaa49c432031c89dfd59918e0a2ea39b609099cc1274c556d52b29e6cc01ce7c8393643
|
7
|
+
data.tar.gz: b673fc933c448eedf9aafef55886e64ea73d2e44f0b4f4576053f354c16ad984ecd2da796f40a50f674a414393cc9e2dbb169c3233892a193922f308084ebccf
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
3
|
rvm:
|
4
|
-
- 2.
|
5
|
-
- 2.
|
6
|
-
- 2.4.0
|
4
|
+
- 2.3.4
|
5
|
+
- 2.4.1
|
7
6
|
- ruby-head
|
8
7
|
|
9
8
|
env:
|
@@ -12,8 +11,9 @@ env:
|
|
12
11
|
- machine_pass=travis
|
13
12
|
- machine_port=22
|
14
13
|
|
15
|
-
dist:
|
14
|
+
dist: precise
|
16
15
|
sudo: required
|
16
|
+
#cache: bundler
|
17
17
|
|
18
18
|
before_install:
|
19
19
|
- sudo usermod -p `openssl passwd -1 'travis'` travis
|
@@ -23,7 +23,6 @@ bundler_args: --without guard integration
|
|
23
23
|
|
24
24
|
script:
|
25
25
|
- bundle exec rake
|
26
|
-
- bundle exec codeclimate-test-reporter
|
27
26
|
- bundle install --with integration
|
28
27
|
- export KITCHEN_YAML=.kitchen.ci.yml
|
29
28
|
- bundle exec kitchen verify ubuntu
|
@@ -34,7 +33,7 @@ branches:
|
|
34
33
|
|
35
34
|
matrix:
|
36
35
|
include:
|
37
|
-
- rvm: 2.
|
36
|
+
- rvm: 2.3.4
|
38
37
|
# To run the proxy tests we need additional gems than what Test Kitchen normally uses
|
39
38
|
# for testing
|
40
39
|
gemfile: Gemfile.proxy_tests
|
@@ -65,8 +64,3 @@ matrix:
|
|
65
64
|
|
66
65
|
notifications:
|
67
66
|
irc: "chat.freenode.net#kitchenci"
|
68
|
-
|
69
|
-
addons:
|
70
|
-
code_climate:
|
71
|
-
repo_token:
|
72
|
-
secure: "lcqi3hbalLTinxwsl+um1aN1dgijBrODSMseGEJMJGkofz3VZ+Ofuuwp9x9VjvewuiUFHsiPD5SQ6hx8N+L3wXB6qA+HTmIrXecL7VjehbImEyOuu4/++vcTdpTINAd2Qt/KuJ1eY0okSwVmvtX1VD8gYD8yrlMKdj6uexf8Bgs="
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v1.17.0](https://github.com/test-kitchen/test-kitchen/tree/v1.17.0) (2017-08-11)
|
4
|
+
[Full Changelog](https://github.com/test-kitchen/test-kitchen/compare/v1.16.0...v1.17.0)
|
5
|
+
|
6
|
+
**Fixed bugs:**
|
7
|
+
|
8
|
+
- Fix Dir.glob usage [\#1258](https://github.com/test-kitchen/test-kitchen/pull/1258) ([jaym](https://github.com/jaym))
|
9
|
+
|
3
10
|
## [v1.16.0](https://github.com/test-kitchen/test-kitchen/tree/v1.16.0) (2017-03-03)
|
4
11
|
[Full Changelog](https://github.com/test-kitchen/test-kitchen/compare/v1.15.0...v1.16.0)
|
5
12
|
|
data/ECOSYSTEM.md
CHANGED
@@ -9,22 +9,22 @@ The following are in the test-kitchen organization
|
|
9
9
|
[![Status](https://travis-ci.org/test-kitchen/kitchen-ec2.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-ec2)| [![Status](https://travis-ci.org/test-kitchen/kitchen-digitalocean.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-digitalocean) | [![Status](https://travis-ci.org/test-kitchen/kitchen-openstack.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-openstack) | [![Status](https://travis-ci.org/test-kitchen/kitchen-rackspace.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-rackspace) | [![Status](https://travis-ci.org/test-kitchen/kitchen-google.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-google) | [![Status](https://travis-ci.org/test-kitchen/kitchen-vagrant.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-vagrant)
|
10
10
|
[![Gem Version](https://badge.fury.io/rb/kitchen-ec2.svg)](http://badge.fury.io/rb/kitchen-ec2) | [![Gem Version](https://badge.fury.io/rb/kitchen-digitalocean.svg)](http://badge.fury.io/rb/kitchen-digitalocean) | [![Gem Version](https://badge.fury.io/rb/kitchen-openstack.svg)](http://badge.fury.io/rb/kitchen-openstack) | [![Gem Version](https://badge.fury.io/rb/kitchen-rackspace.svg)](http://badge.fury.io/rb/kitchen-rackspace) | [![Gem Version](https://badge.fury.io/rb/kitchen-google.svg)](http://badge.fury.io/rb/kitchen-google) | [![Gem Version](https://badge.fury.io/rb/kitchen-vagrant.svg)](http://badge.fury.io/rb/kitchen-vagrant)
|
11
11
|
|
12
|
-
[kitchen-dsc][dsc] | [kitchen-pester][pester] | [kitchen-joyent][joyent] | [kitchen-opennebula][opennebula] | [kitchen-hyperv][hyperv] | [kitchen-cloudstack][cloudstack]
|
13
|
-
---- | ---- | ---- | ---- | ---- | ----
|
12
|
+
[kitchen-dsc][dsc] | [kitchen-pester][pester] | [kitchen-joyent][joyent] | [kitchen-opennebula][opennebula] | [kitchen-hyperv][hyperv] | [kitchen-cloudstack][cloudstack] |
|
13
|
+
---- | ---- | ---- | ---- | ---- | ---- |
|
14
14
|
[![Status](https://travis-ci.org/test-kitchen/kitchen-dsc.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-dsc)| [![Status](https://travis-ci.org/test-kitchen/kitchen-pester.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-pester) | [![Status](https://travis-ci.org/test-kitchen/kitchen-joyent.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-joyent) | [![Status](https://travis-ci.org/test-kitchen/kitchen-opennebula.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-opennebula) | [![Status](https://travis-ci.org/test-kitchen/kitchen-hyperv.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-hyperv) | [![Status](https://travis-ci.org/test-kitchen/kitchen-cloudstack.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-cloudstack)
|
15
15
|
[![Gem Version](https://badge.fury.io/rb/kitchen-dsc.svg)](http://badge.fury.io/rb/kitchen-dsc) | [![Gem Version](https://badge.fury.io/rb/kitchen-pester.svg)](http://badge.fury.io/rb/kitchen-pester) | [![Gem Version](https://badge.fury.io/rb/kitchen-joyent.svg)](http://badge.fury.io/rb/kitchen-joyent) | [![Gem Version](https://badge.fury.io/rb/kitchen-opennebula.svg)](http://badge.fury.io/rb/kitchen-opennebula) | [![Gem Version](https://badge.fury.io/rb/kitchen-hyperv.svg)](http://badge.fury.io/rb/kitchen-hyperv) | [![Gem Version](https://badge.fury.io/rb/kitchen-cloudstack.svg)](http://badge.fury.io/rb/kitchen-cloudstack)
|
16
16
|
|
17
17
|
The following are written by the [chef][chef] organization.
|
18
18
|
|
19
|
-
[kitchen-appbundle-updater][appbundle-updater] | [kitchen-inspec][inspec]
|
20
|
-
---- | ---- |
|
19
|
+
[kitchen-appbundle-updater][appbundle-updater] | [kitchen-inspec][inspec]
|
20
|
+
---- | ---- |
|
21
21
|
[![Status](https://travis-ci.org/chef/kitchen-appbundle-updater.svg?branch=master)](https://travis-ci.org/chef/kitchen-appbundle-updater)| [![Status](https://travis-ci.org/chef/kitchen-inspec.svg?branch=master)](https://travis-ci.org/chef/kitchen-inspec) |
|
22
22
|
[![Gem Version](https://badge.fury.io/rb/kitchen-appbundle-updater.svg)](http://badge.fury.io/rb/kitchen-appbundle-updater) | [![Gem Version](https://badge.fury.io/rb/kitchen-inspec.svg)](http://badge.fury.io/rb/kitchen-inspec) |
|
23
23
|
|
24
24
|
The following are written by the [chef-partners][chefpartners] organization.
|
25
25
|
|
26
26
|
[kitchen-vra][vra] | [kitchen-vro][vro] | [kitchen-vcair][vcair] | [kitchen-oraclecloud][oracle] | [kitchen-ssh-cisco][sadpanda]
|
27
|
-
---- | ---- | ---- | ---- | ---- |
|
27
|
+
---- | ---- | ---- | ---- | ---- |
|
28
28
|
[![Status](https://travis-ci.org/chef-partners/kitchen-vra.svg?branch=master)](https://travis-ci.org/chef-partners/kitchen-vra)| [![Status](https://travis-ci.org/chef-partners/kitchen-vro.svg?branch=master)](https://travis-ci.org/chef-partners/kitchen-vro) | [![Status](https://travis-ci.org/chef-partners/kitchen-vcair.svg?branch=master)](https://travis-ci.org/chef-partners/kitchen-vcair) | [![Status](https://travis-ci.org/chef-partners/kitchen-oraclecloud.svg?branch=master)](https://travis-ci.org/chef-partners/kitchen-oraclecloud) | [![Status](https://travis-ci.org/chef-partners/kitchen-ssh-cisco.svg?branch=master)](https://travis-ci.org/chef-partners/kitchen-ssh-cisco) | [![Status](https://travis-ci.org/test-kitchen/kitchen-cloudstack.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-cloudstack)
|
29
29
|
[![Gem Version](https://badge.fury.io/rb/kitchen-vra.svg)](http://badge.fury.io/rb/kitchen-vra) | [![Gem Version](https://badge.fury.io/rb/kitchen-vro.svg)](http://badge.fury.io/rb/kitchen-vro) | [![Gem Version](https://badge.fury.io/rb/kitchen-vcair.svg)](http://badge.fury.io/rb/kitchen-vcair) | [![Gem Version](https://badge.fury.io/rb/kitchen-oraclecloud.svg)](http://badge.fury.io/rb/kitchen-oraclecloud) | [![Gem Version](https://badge.fury.io/rb/kitchen-ssh-cisco.svg)](http://badge.fury.io/rb/kitchen-ssh-cisco)
|
30
30
|
|
@@ -41,7 +41,7 @@ The following are community driven plugins.
|
|
41
41
|
[![Gem Version](https://badge.fury.io/rb/kitchen-nodes.svg)](http://badge.fury.io/rb/kitchen-nodes) | [![Gem Version](https://badge.fury.io/rb/kitchen-zcloudjp.svg)](http://badge.fury.io/rb/kitchen-zcloudjp) | [![Gem Version](https://badge.fury.io/rb/kitchen-bluebox.svg)](http://badge.fury.io/rb/kitchen-bluebox) | [![Gem Version](https://badge.fury.io/rb/kitchen-softlayer.svg)](http://badge.fury.io/rb/kitchen-softlayer) | [![Gem Version](https://badge.fury.io/rb/kitchen-linode.svg)](http://badge.fury.io/rb/kitchen-linode) | [![Gem Version](https://badge.fury.io/rb/kitchen-docker.svg)](http://badge.fury.io/rb/kitchen-docker)
|
42
42
|
|
43
43
|
[kitchen-qemu][qemu] | [kitchen-cfengine][cfengine] | [kitchen-cloudformation][cloudformation] | [kitchen-wpar][wpar] | [kitchen-powervc][powervc]
|
44
|
-
---- | ---- | ---- | ---- | ---- |
|
44
|
+
---- | ---- | ---- | ---- | ---- |
|
45
45
|
[![Status](https://travis-ci.org/esmil/kitchen-qemu.svg?branch=master)](https://travis-ci.org/esmil/kitchen-qemu)| [![Status](https://travis-ci.org/nmische/kitchen-cfengine.svg?branch=master)](https://travis-ci.org/nmische/kitchen-cfengine) | [![Status](https://travis-ci.org/neillturner/kitchen-cloudformation.svg?branch=master)](https://travis-ci.org/neillturner/kitchen-cloudformation) | [![Status](https://travis-ci.org/adejoux/kitchen-wpar.svg?branch=master)](https://travis-ci.org/adejoux/kitchen-wpar) | [![Status](https://travis-ci.org/chmod666org/kitchen-powervc.svg?branch=master)](https://travis-ci.org/chmod666org/kitchen-powervc)
|
46
46
|
[![Gem Version](https://badge.fury.io/rb/kitchen-qemu.svg)](http://badge.fury.io/rb/kitchen-qemu) | [![Gem Version](https://badge.fury.io/rb/kitchen-cfengine.svg)](http://badge.fury.io/rb/kitchen-cfengine) | [![Gem Version](https://badge.fury.io/rb/kitchen-cloudformation.svg)](http://badge.fury.io/rb/kitchen-cloudformation) | [![Gem Version](https://badge.fury.io/rb/kitchen-wpar.svg)](http://badge.fury.io/rb/kitchen-wpar) | [![Gem Version](https://badge.fury.io/rb/kitchen-powervc.svg)](http://badge.fury.io/rb/kitchen-powervc)
|
47
47
|
|
data/Gemfile
CHANGED
@@ -6,10 +6,12 @@ gem "rack", "< 2.0"
|
|
6
6
|
gem "train", "~> 0.22"
|
7
7
|
|
8
8
|
group :integration do
|
9
|
-
gem "berkshelf"
|
10
|
-
gem "kitchen-inspec"
|
9
|
+
gem "berkshelf"
|
10
|
+
gem "kitchen-inspec"
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
|
14
|
+
|
15
|
+
# If you want to load debugging tools into the bundle exec sandbox,
|
16
|
+
# add these additional dependencies into chef/Gemfile.local
|
17
|
+
eval(IO.read(__FILE__ + ".local"), binding) if File.exist?(__FILE__ + ".local")
|
data/README.md
CHANGED
@@ -2,10 +2,6 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/test-kitchen.svg)](http://badge.fury.io/rb/test-kitchen)
|
4
4
|
[![Build Status](https://secure.travis-ci.org/test-kitchen/test-kitchen.svg?branch=master)](https://travis-ci.org/test-kitchen/test-kitchen)
|
5
|
-
[![Code Climate](https://codeclimate.com/github/test-kitchen/test-kitchen.svg)](https://codeclimate.com/github/test-kitchen/test-kitchen)
|
6
|
-
[![Test Coverage](https://codeclimate.com/github/test-kitchen/test-kitchen/coverage.svg)](https://codeclimate.com/github/test-kitchen/test-kitchen)
|
7
|
-
[![Dependency Status](https://gemnasium.com/test-kitchen/test-kitchen.svg)](https://gemnasium.com/test-kitchen/test-kitchen)
|
8
|
-
[![Inline docs](http://inch-ci.org/github/test-kitchen/test-kitchen.svg?branch=master)](http://inch-ci.org/github/test-kitchen/test-kitchen)
|
9
5
|
|
10
6
|
| | |
|
11
7
|
|-------------|-----------------------------------------------|
|
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ begin
|
|
13
13
|
require "cucumber"
|
14
14
|
require "cucumber/rake/task"
|
15
15
|
Cucumber::Rake::Task.new(:features) do |t|
|
16
|
-
t.cucumber_opts = ["features", "-x", "--format progress", "--no-color"]
|
16
|
+
t.cucumber_opts = ["features", "-x", "--format progress", "--no-color", "--tags ~@ignore"]
|
17
17
|
end
|
18
18
|
rescue LoadError
|
19
19
|
puts "cucumber is not available. (sudo) gem install cucumber to run tests."
|
data/appveyor.yml
CHANGED
@@ -26,8 +26,9 @@ install:
|
|
26
26
|
- ps: net user /add $env:machine_user $env:machine_pass
|
27
27
|
- ps: net localgroup administrators $env:machine_user /add
|
28
28
|
- ps: $env:PATH="C:\Ruby$env:ruby_version\bin;$env:PATH"
|
29
|
-
- ps: Invoke-WebRequest -Uri http://curl.haxx.se/ca/cacert.pem -OutFile c:\projects\test_kitchen\certs.pem
|
30
29
|
- ps: Write-Host $env:path
|
30
|
+
- appveyor DownloadFile http://curl.haxx.se/ca/cacert.pem -FileName c:\projects\test_kitchen\certs.pem
|
31
|
+
- set SSL_CERT_FILE=c:\projects\test_kitchen\certs.pem
|
31
32
|
- gem update --system || gem update --system || gem update --system
|
32
33
|
- gem install bundler --quiet --no-ri --no-rdoc || gem install bundler --quiet --no-ri --no-rdoc || gem install bundler --quiet --no-ri --no-rdoc
|
33
34
|
- update_rubygems
|
@@ -42,7 +42,7 @@ module Kitchen
|
|
42
42
|
end
|
43
43
|
ChefConfig::Config.export_proxies if defined?(ChefConfig::Config.export_proxies)
|
44
44
|
|
45
|
-
specs = fetch_gem_specs.
|
45
|
+
specs = fetch_gem_specs.sort_by { |spec| spec[0] }
|
46
46
|
specs = specs[0, 49].push(["...", "..."]) if specs.size > 49
|
47
47
|
specs = specs.unshift(["Gem Name", "Latest Stable Release"])
|
48
48
|
print_table(specs, indent: 4)
|
data/lib/kitchen/config.rb
CHANGED
@@ -56,11 +56,6 @@ module Kitchen
|
|
56
56
|
# @api private
|
57
57
|
attr_reader :log_root
|
58
58
|
|
59
|
-
# @return [String] the absolute path to the directory containing test
|
60
|
-
# suites and other testing-related file and directories
|
61
|
-
# @api private
|
62
|
-
attr_reader :test_base_path
|
63
|
-
|
64
59
|
# @return [#read] the data loader that responds to a `#read` message,
|
65
60
|
# returning a Hash data structure
|
66
61
|
# @api private
|
data/lib/kitchen/configurable.rb
CHANGED
@@ -70,7 +70,7 @@ module Kitchen
|
|
70
70
|
def converge(state) # rubocop:disable Metrics/AbcSize
|
71
71
|
provisioner = instance.provisioner
|
72
72
|
provisioner.create_sandbox
|
73
|
-
sandbox_dirs =
|
73
|
+
sandbox_dirs = Util.list_directory(provisioner.sandbox_path)
|
74
74
|
|
75
75
|
instance.transport.connection(backcompat_merged_state(state)) do |conn|
|
76
76
|
conn.execute(env_cmd(provisioner.install_command))
|
@@ -102,7 +102,7 @@ module Kitchen
|
|
102
102
|
def verify(state) # rubocop:disable Metrics/AbcSize
|
103
103
|
verifier = instance.verifier
|
104
104
|
verifier.create_sandbox
|
105
|
-
sandbox_dirs =
|
105
|
+
sandbox_dirs = Util.list_directory(verifier.sandbox_path)
|
106
106
|
|
107
107
|
instance.transport.connection(backcompat_merged_state(state)) do |conn|
|
108
108
|
conn.execute(env_cmd(verifier.init_command))
|
@@ -119,7 +119,7 @@ module Kitchen
|
|
119
119
|
# initialized
|
120
120
|
# @api private
|
121
121
|
def init_test_dir?
|
122
|
-
|
122
|
+
Util.list_directory("test/integration/").select { |d| File.directory?(d) }.empty?
|
123
123
|
end
|
124
124
|
|
125
125
|
# @return [true,false] whether or not a `.gitignore` file needs to be
|
@@ -63,7 +63,7 @@ module Kitchen
|
|
63
63
|
# rubocop:disable Metrics/AbcSize
|
64
64
|
def call(state)
|
65
65
|
create_sandbox
|
66
|
-
sandbox_dirs =
|
66
|
+
sandbox_dirs = Util.list_directory(sandbox_path)
|
67
67
|
|
68
68
|
instance.transport.connection(state) do |conn|
|
69
69
|
conn.execute(install_command)
|
@@ -151,9 +151,11 @@ module Kitchen
|
|
151
151
|
# @raise [ClientError] if the sandbox directory has no yet been created
|
152
152
|
# by calling `#create_sandbox`
|
153
153
|
def sandbox_path
|
154
|
-
@sandbox_path
|
154
|
+
@sandbox_path ||= begin
|
155
|
+
raise ClientError, "Sandbox directory has not yet " \
|
155
156
|
"been created. Please run #{self.class}#create_sandox before " \
|
156
|
-
"trying to access the path."
|
157
|
+
"trying to access the path."
|
158
|
+
end
|
157
159
|
end
|
158
160
|
|
159
161
|
# Deletes the sandbox path. Without calling this method, the sandbox path
|
@@ -80,8 +80,8 @@ module Kitchen
|
|
80
80
|
# @return [Array<String>] an array of absolute paths to files
|
81
81
|
# @api private
|
82
82
|
def all_files_in_cookbooks
|
83
|
-
|
84
|
-
.select { |fn| File.file?(fn)
|
83
|
+
Util.list_directory(tmpbooks_dir, include_dot: true, recurse: true)
|
84
|
+
.select { |fn| File.file?(fn) }
|
85
85
|
end
|
86
86
|
|
87
87
|
# @return [String] an absolute path to a Policyfile, relative to the
|
@@ -152,7 +152,7 @@ module Kitchen
|
|
152
152
|
|
153
153
|
cb_path = File.join(tmpbooks_dir, cb_name)
|
154
154
|
|
155
|
-
glob =
|
155
|
+
glob = Util.list_directory(config[:kitchen_root])
|
156
156
|
|
157
157
|
FileUtils.mkdir_p(cb_path)
|
158
158
|
FileUtils.cp_r(glob, cb_path)
|
@@ -164,8 +164,8 @@ module Kitchen
|
|
164
164
|
def filter_only_cookbook_files
|
165
165
|
info("Removing non-cookbook files before transfer")
|
166
166
|
FileUtils.rm(all_files_in_cookbooks - only_cookbook_files)
|
167
|
-
|
168
|
-
|
167
|
+
Util.list_directory(tmpbooks_dir, recurse: true)
|
168
|
+
.reverse_each { |fn| FileUtils.rmdir(fn) if File.directory?(fn) && Dir.entries(fn).size == 2 }
|
169
169
|
end
|
170
170
|
|
171
171
|
# @return [Logger] the instance's logger or Test Kitchen's common
|
@@ -202,10 +202,9 @@ module Kitchen
|
|
202
202
|
# @return [Array<String>] an array of absolute paths to files
|
203
203
|
# @api private
|
204
204
|
def only_cookbook_files
|
205
|
-
glob = File.join(
|
206
|
-
|
207
|
-
|
208
|
-
.select { |fn| File.file?(fn) && ! %w{. ..}.include?(fn) }
|
205
|
+
glob = File.join("*", "{#{config[:cookbook_files_glob]}}")
|
206
|
+
Util.safe_glob(tmpbooks_dir, glob, File::FNM_DOTMATCH)
|
207
|
+
.select { |fn| File.file?(fn) && ! %w{. ..}.include?(fn) }
|
209
208
|
end
|
210
209
|
|
211
210
|
# Prepares a generic Chef component source directory or file for
|
@@ -235,7 +234,7 @@ module Kitchen
|
|
235
234
|
case opts[:type]
|
236
235
|
when :directory
|
237
236
|
FileUtils.mkdir_p(dest)
|
238
|
-
FileUtils.cp_r(
|
237
|
+
FileUtils.cp_r(Util.list_directory(src), dest)
|
239
238
|
when :file
|
240
239
|
FileUtils.mkdir_p(File.dirname(dest))
|
241
240
|
FileUtils.cp_r(src, dest)
|
@@ -93,7 +93,7 @@ module Kitchen
|
|
93
93
|
|
94
94
|
tmpdata_dir = File.join(sandbox_path, "data")
|
95
95
|
FileUtils.mkdir_p(tmpdata_dir)
|
96
|
-
FileUtils.cp_r(
|
96
|
+
FileUtils.cp_r(Util.list_directory(config[:data_path]), tmpdata_dir)
|
97
97
|
end
|
98
98
|
|
99
99
|
# Copies the executable script to the sandbox directory or creates a
|
@@ -107,6 +107,12 @@ module Kitchen
|
|
107
107
|
#
|
108
108
|
# @author Fletcher Nichol <fnichol@nichol.ca>
|
109
109
|
class Connection < Kitchen::Transport::Base::Connection
|
110
|
+
# (see Base::Connection#initialize)
|
111
|
+
def initialize(config = {})
|
112
|
+
super(config)
|
113
|
+
@session = nil
|
114
|
+
end
|
115
|
+
|
110
116
|
# (see Base::Connection#close)
|
111
117
|
def close
|
112
118
|
return if @session.nil?
|
@@ -82,6 +82,13 @@ module Kitchen
|
|
82
82
|
#
|
83
83
|
# @author Fletcher Nichol <fnichol@nichol.ca>
|
84
84
|
class Connection < Kitchen::Transport::Base::Connection
|
85
|
+
# (see Base::Connection#initialize)
|
86
|
+
def initialize(config = {})
|
87
|
+
super(config)
|
88
|
+
@unelevated_session = nil
|
89
|
+
@elevated_session = nil
|
90
|
+
end
|
91
|
+
|
85
92
|
# (see Base::Connection#close)
|
86
93
|
def close
|
87
94
|
@unelevated_session.close if @unelevated_session
|
data/lib/kitchen/util.rb
CHANGED
@@ -141,5 +141,59 @@ module Kitchen
|
|
141
141
|
File.dirname(__FILE__), %w{.. .. support download_helpers.sh}
|
142
142
|
))
|
143
143
|
end
|
144
|
+
|
145
|
+
# Lists the contents of the given directory. path will be prepended
|
146
|
+
# to the list returned. '.' and '..' are never returned.
|
147
|
+
#
|
148
|
+
# @param path [String] the directory to list
|
149
|
+
# @param include_dot [Boolean] if true, dot files will be included
|
150
|
+
# @param recurse [Boolean] if true, listing will be recursive
|
151
|
+
# @return A listing of the specified path
|
152
|
+
#
|
153
|
+
# @note You should prefer this method to using Dir.glob directly. The reason is
|
154
|
+
# because Dir.glob behaves strangely on Windows. It wont accept '\'
|
155
|
+
# and doesn't like fake directories (C:\Documents and Settings)
|
156
|
+
# It also does not do any sort of error checking, so things one would
|
157
|
+
# expect to fail just return an empty list
|
158
|
+
def self.list_directory(path, include_dot: false, recurse: false)
|
159
|
+
# Things (such as tests) are relying on this to not blow up if
|
160
|
+
# the directory does not exist
|
161
|
+
return [] if !Dir.exist?(path)
|
162
|
+
|
163
|
+
Dir.chdir(path) do
|
164
|
+
glob_pattern = if recurse
|
165
|
+
"**/*"
|
166
|
+
else
|
167
|
+
"*"
|
168
|
+
end
|
169
|
+
flags = if include_dot
|
170
|
+
[File::FNM_DOTMATCH]
|
171
|
+
else
|
172
|
+
[]
|
173
|
+
end
|
174
|
+
Dir.glob(glob_pattern, *flags)
|
175
|
+
.reject { |f| [".", ".."].include?(f) }
|
176
|
+
.map { |f| File.join(path, f) }
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# Similar to Dir.glob.
|
181
|
+
#
|
182
|
+
# The difference is this function forces you to specify where to glob from.
|
183
|
+
# You should glob from the path closest to what you want. The reason for this
|
184
|
+
# is because if you have symlinks on windows of any kind, Dir.glob will not
|
185
|
+
# traverse them.
|
186
|
+
#
|
187
|
+
# @param path [String] the directory to glob from
|
188
|
+
# @param pattern [String] The pattern to match
|
189
|
+
# @param flags [Integer] You can specify flags you would have passed to Dir.glob
|
190
|
+
# @return Files matching the specified pattern in the given path
|
191
|
+
def self.safe_glob(path, pattern, *flags)
|
192
|
+
return [] if !Dir.exist?(path)
|
193
|
+
|
194
|
+
Dir.chdir(path) do
|
195
|
+
Dir.glob(pattern, *flags).map { |f| File.join(path, f) }
|
196
|
+
end
|
197
|
+
end
|
144
198
|
end
|
145
199
|
end
|
@@ -65,7 +65,7 @@ module Kitchen
|
|
65
65
|
# @raise [ActionFailed] if the action could not be completed
|
66
66
|
def call(state)
|
67
67
|
create_sandbox
|
68
|
-
sandbox_dirs =
|
68
|
+
sandbox_dirs = Util.list_directory(sandbox_path)
|
69
69
|
|
70
70
|
instance.transport.connection(state) do |conn|
|
71
71
|
conn.execute(install_command)
|
@@ -158,9 +158,11 @@ module Kitchen
|
|
158
158
|
# @raise [ClientError] if the sandbox directory has no yet been created
|
159
159
|
# by calling `#create_sandbox`
|
160
160
|
def sandbox_path
|
161
|
-
@sandbox_path
|
162
|
-
|
163
|
-
|
161
|
+
@sandbox_path ||= begin
|
162
|
+
raise ClientError, "Sandbox directory has not yet " \
|
163
|
+
"been created. Please run #{self.class}#create_sandox before " \
|
164
|
+
"trying to access the path."
|
165
|
+
end
|
164
166
|
end
|
165
167
|
|
166
168
|
# Sets the API version for this verifier. If the verifier does not set
|
@@ -193,8 +193,8 @@ module Kitchen
|
|
193
193
|
# @return [Array<String>] array of helper files
|
194
194
|
# @api private
|
195
195
|
def helper_files
|
196
|
-
glob = File.join(
|
197
|
-
|
196
|
+
glob = File.join("helpers", "*/**/*")
|
197
|
+
Util.safe_glob(config[:test_base_path], glob).reject { |f| File.directory?(f) }
|
198
198
|
end
|
199
199
|
|
200
200
|
def install_command_vars
|
@@ -221,8 +221,7 @@ module Kitchen
|
|
221
221
|
# @api private
|
222
222
|
def local_suite_files
|
223
223
|
base = File.join(config[:test_base_path], config[:suite_name])
|
224
|
-
|
225
|
-
Dir.glob(glob).reject do |f|
|
224
|
+
Util.safe_glob(base, "*/**/*").reject do |f|
|
226
225
|
chef_data_dir?(base, f) || File.directory?(f)
|
227
226
|
end
|
228
227
|
end
|
@@ -235,8 +234,7 @@ module Kitchen
|
|
235
234
|
# @api private
|
236
235
|
def plugins
|
237
236
|
non_suite_dirs = %w{data data_bags environments nodes roles}
|
238
|
-
|
239
|
-
Dir.glob(glob).reject do |d|
|
237
|
+
Util.list_directory(File.join(config[:test_base_path], config[:suite_name])).reject do |d|
|
240
238
|
!File.directory?(d) || non_suite_dirs.include?(File.basename(d))
|
241
239
|
end.map { |d| "busser-#{File.basename(d)}" }.sort.uniq
|
242
240
|
end
|
data/lib/kitchen/version.rb
CHANGED
data/spec/kitchen/config_spec.rb
CHANGED
@@ -335,7 +335,7 @@ describe Kitchen::Configurable do
|
|
335
335
|
it "leaves a nil config value as nil" do
|
336
336
|
config[:success_path] = nil
|
337
337
|
|
338
|
-
subject[:success_path].
|
338
|
+
subject[:success_path].must_be_nil
|
339
339
|
end
|
340
340
|
|
341
341
|
it "leaves a false config value as false" do
|
@@ -90,7 +90,7 @@ describe Kitchen::Driver::Base do
|
|
90
90
|
|
91
91
|
describe ".no_parallel_for" do
|
92
92
|
it "registers no serial actions when none are declared" do
|
93
|
-
Kitchen::Driver::Speedy.serial_actions.
|
93
|
+
Kitchen::Driver::Speedy.serial_actions.must_be_nil
|
94
94
|
end
|
95
95
|
|
96
96
|
it "registers a single serial action method" do
|
@@ -104,7 +104,7 @@ describe Kitchen::Driver::SSHBase do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
it "plugin_version is not set" do
|
107
|
-
driver.diagnose_plugin[:version].
|
107
|
+
driver.diagnose_plugin[:version].must_be_nil
|
108
108
|
end
|
109
109
|
|
110
110
|
describe "configuration" do
|
@@ -778,7 +778,7 @@ describe Kitchen::Driver::SSHBase do
|
|
778
778
|
|
779
779
|
describe ".no_parallel_for" do
|
780
780
|
it "registers no serial actions when none are declared" do
|
781
|
-
Kitchen::Driver::SpeedyCompat.serial_actions.
|
781
|
+
Kitchen::Driver::SpeedyCompat.serial_actions.must_be_nil
|
782
782
|
end
|
783
783
|
|
784
784
|
it "registers a single serial action method" do
|
@@ -31,10 +31,11 @@ require "kitchen/transport/dummy"
|
|
31
31
|
require "kitchen/verifier/dummy"
|
32
32
|
|
33
33
|
class DummyStateFile
|
34
|
-
def initialize(*)
|
34
|
+
def initialize(*)
|
35
|
+
@_state = {}
|
36
|
+
end
|
35
37
|
|
36
38
|
def read
|
37
|
-
@_state = {} unless @_state
|
38
39
|
@_state.dup
|
39
40
|
end
|
40
41
|
|
@@ -43,7 +44,7 @@ class DummyStateFile
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def destroy
|
46
|
-
@_state =
|
47
|
+
@_state = {}
|
47
48
|
end
|
48
49
|
|
49
50
|
def diagnose
|
@@ -56,8 +57,13 @@ class SerialDummyDriver < Kitchen::Driver::Dummy
|
|
56
57
|
|
57
58
|
attr_reader :action_in_mutex
|
58
59
|
|
60
|
+
def initialize(config = {})
|
61
|
+
super(config)
|
62
|
+
@action_in_mutex = {}
|
63
|
+
end
|
64
|
+
|
59
65
|
def track_locked(action)
|
60
|
-
@action_in_mutex
|
66
|
+
@action_in_mutex ||= {}
|
61
67
|
@action_in_mutex[action] = Kitchen::Instance.mutexes[self.class].locked?
|
62
68
|
end
|
63
69
|
|
@@ -599,7 +599,7 @@ describe Kitchen::Loader::YAML do
|
|
599
599
|
|
600
600
|
it "combined config contains a nil filename" do
|
601
601
|
loader.diagnose[:combined_config][:filename]
|
602
|
-
.
|
602
|
+
.must_be_nil
|
603
603
|
end
|
604
604
|
|
605
605
|
it "combined config contains raw data" do
|
@@ -630,12 +630,12 @@ describe Kitchen::Loader::YAML do
|
|
630
630
|
|
631
631
|
it "uses an error hash with the exception" do
|
632
632
|
loader.diagnose[:global_config][:raw_data][:error][:exception]
|
633
|
-
.must_match
|
633
|
+
.must_match(/Kitchen::UserError/)
|
634
634
|
end
|
635
635
|
|
636
636
|
it "uses an error hash with the exception message" do
|
637
637
|
loader.diagnose[:global_config][:raw_data][:error][:message]
|
638
|
-
.must_match
|
638
|
+
.must_match(/Error parsing/)
|
639
639
|
end
|
640
640
|
|
641
641
|
it "uses an error hash with the exception backtrace" do
|
@@ -658,12 +658,12 @@ describe Kitchen::Loader::YAML do
|
|
658
658
|
|
659
659
|
it "uses an error hash with the exception" do
|
660
660
|
loader.diagnose[:project_config][:raw_data][:error][:exception]
|
661
|
-
.must_match
|
661
|
+
.must_match(/Kitchen::UserError/)
|
662
662
|
end
|
663
663
|
|
664
664
|
it "uses an error hash with the exception message" do
|
665
665
|
loader.diagnose[:project_config][:raw_data][:error][:message]
|
666
|
-
.must_match
|
666
|
+
.must_match(/Error parsing/)
|
667
667
|
end
|
668
668
|
|
669
669
|
it "uses an error hash with the exception backtrace" do
|
@@ -686,12 +686,12 @@ describe Kitchen::Loader::YAML do
|
|
686
686
|
|
687
687
|
it "uses an error hash with the exception" do
|
688
688
|
loader.diagnose[:local_config][:raw_data][:error][:exception]
|
689
|
-
.must_match
|
689
|
+
.must_match(/Kitchen::UserError/)
|
690
690
|
end
|
691
691
|
|
692
692
|
it "uses an error hash with the exception message" do
|
693
693
|
loader.diagnose[:local_config][:raw_data][:error][:message]
|
694
|
-
.must_match
|
694
|
+
.must_match(/Error parsing/)
|
695
695
|
end
|
696
696
|
|
697
697
|
it "uses an error hash with the exception backtrace" do
|
@@ -709,17 +709,17 @@ describe Kitchen::Loader::YAML do
|
|
709
709
|
|
710
710
|
it "uses an error hash with nil raw file contents" do
|
711
711
|
loader.diagnose[:combined_config][:raw_data][:error][:raw_file]
|
712
|
-
.
|
712
|
+
.must_be_nil
|
713
713
|
end
|
714
714
|
|
715
715
|
it "uses an error hash with the exception" do
|
716
716
|
loader.diagnose[:combined_config][:raw_data][:error][:exception]
|
717
|
-
.must_match
|
717
|
+
.must_match(/Kitchen::UserError/)
|
718
718
|
end
|
719
719
|
|
720
720
|
it "uses an error hash with the exception message" do
|
721
721
|
loader.diagnose[:combined_config][:raw_data][:error][:message]
|
722
|
-
.must_match
|
722
|
+
.must_match(/Error parsing/)
|
723
723
|
end
|
724
724
|
|
725
725
|
it "uses an error hash with the exception backtrace" do
|
data/spec/kitchen/logger_spec.rb
CHANGED
@@ -44,7 +44,7 @@ describe Kitchen::LoginCommand do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
it "#options defaults to an empty hash" do
|
47
|
-
Kitchen::LoginCommand.new(cmd, argv
|
47
|
+
Kitchen::LoginCommand.new(cmd, argv).options.must_equal Hash.new
|
48
48
|
end
|
49
49
|
|
50
50
|
it "#options returns the options hash from the constructor" do
|
@@ -34,7 +34,7 @@ describe Kitchen::Platform do
|
|
34
34
|
klass.new(name: "p", os_type: "unix").os_type.must_equal "unix"
|
35
35
|
klass.new(name: "p", os_type: "windows").os_type.must_equal "windows"
|
36
36
|
klass.new(name: "p", os_type: "unicorn").os_type.must_equal "unicorn"
|
37
|
-
klass.new(name: "p", os_type: nil).os_type.
|
37
|
+
klass.new(name: "p", os_type: nil).os_type.must_be_nil
|
38
38
|
end
|
39
39
|
|
40
40
|
it "#os_type defaults to `unix` when not provided" do
|
@@ -59,7 +59,7 @@ describe Kitchen::Platform do
|
|
59
59
|
klass.new(name: "p", shell_type: "unicorn")
|
60
60
|
.shell_type.must_equal "unicorn"
|
61
61
|
klass.new(name: "p", shell_type: nil)
|
62
|
-
.shell_type.
|
62
|
+
.shell_type.must_be_nil
|
63
63
|
end
|
64
64
|
|
65
65
|
it "#shell_type defaults to `bourne` when not provided" do
|
@@ -109,24 +109,24 @@ describe Kitchen::Provisioner::Base do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
it ":sudo defaults to nil" do
|
112
|
-
provisioner[:sudo].
|
112
|
+
provisioner[:sudo].must_be_nil
|
113
113
|
end
|
114
114
|
|
115
115
|
it ":sudo_command defaults to nil" do
|
116
|
-
provisioner[:sudo_command].
|
116
|
+
provisioner[:sudo_command].must_be_nil
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
120
|
it ":http_proxy defaults to nil" do
|
121
|
-
provisioner[:http_proxy].
|
121
|
+
provisioner[:http_proxy].must_be_nil
|
122
122
|
end
|
123
123
|
|
124
124
|
it ":http_proxys defaults to nil" do
|
125
|
-
provisioner[:https_proxy].
|
125
|
+
provisioner[:https_proxy].must_be_nil
|
126
126
|
end
|
127
127
|
|
128
128
|
it ":ftp_proxy defaults to nil" do
|
129
|
-
provisioner[:ftp_proxy].
|
129
|
+
provisioner[:ftp_proxy].must_be_nil
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
@@ -61,7 +61,7 @@ describe Kitchen::Provisioner::ChefBase do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
it ":chef_metadata_url defaults to nil" do
|
64
|
-
provisioner[:chef_metadata_url].
|
64
|
+
provisioner[:chef_metadata_url].must_be_nil
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -79,7 +79,7 @@ describe Kitchen::Provisioner::ChefBase do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
it ":chef_omnibus_install_options defaults to nil" do
|
82
|
-
provisioner[:chef_omnibus_install_options].
|
82
|
+
provisioner[:chef_omnibus_install_options].must_be_nil
|
83
83
|
end
|
84
84
|
|
85
85
|
it ":run_list defaults to an empty array" do
|
@@ -91,7 +91,7 @@ describe Kitchen::Provisioner::ChefBase do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
it ":log_file defaults to nil" do
|
94
|
-
provisioner[:log_file].
|
94
|
+
provisioner[:log_file].must_be_nil
|
95
95
|
end
|
96
96
|
|
97
97
|
it ":cookbook_files_glob includes recipes" do
|
@@ -156,7 +156,7 @@ describe Kitchen::Provisioner::ChefBase do
|
|
156
156
|
|
157
157
|
installer.expects(:root).never
|
158
158
|
installer.expects(:install_command).never
|
159
|
-
cmd.
|
159
|
+
cmd.must_be_nil
|
160
160
|
end
|
161
161
|
|
162
162
|
describe "common behaviour" do
|
@@ -96,7 +96,7 @@ describe Kitchen::Provisioner::ChefZero do
|
|
96
96
|
end
|
97
97
|
|
98
98
|
it "does not set :chef_zero_host" do
|
99
|
-
provisioner[:chef_zero_host].
|
99
|
+
provisioner[:chef_zero_host].must_be_nil
|
100
100
|
end
|
101
101
|
|
102
102
|
it "sets :chef_zero_port to 8889" do
|
@@ -385,7 +385,7 @@ describe Kitchen::Provisioner::ChefZero do
|
|
385
385
|
before { config[:require_chef_omnibus] = "11.10" }
|
386
386
|
|
387
387
|
it "returns nil" do
|
388
|
-
cmd.
|
388
|
+
cmd.must_be_nil
|
389
389
|
end
|
390
390
|
end
|
391
391
|
|
@@ -132,11 +132,11 @@ describe Kitchen::Transport::Ssh do
|
|
132
132
|
end
|
133
133
|
|
134
134
|
it "sets :ssh_key to nil by default" do
|
135
|
-
transport[:ssh_key].
|
135
|
+
transport[:ssh_key].must_be_nil
|
136
136
|
end
|
137
137
|
|
138
138
|
it "sets :ssh_key_only to nil by default" do
|
139
|
-
transport[:ssh_key_only].
|
139
|
+
transport[:ssh_key_only].must_be_nil
|
140
140
|
end
|
141
141
|
|
142
142
|
it "expands :ssh_path path if set" do
|
data/spec/kitchen/util_spec.rb
CHANGED
@@ -153,4 +153,98 @@ describe Kitchen::Util do
|
|
153
153
|
Regexp.new("^ +" + Regexp.escape(str) + "$")
|
154
154
|
end
|
155
155
|
end
|
156
|
+
|
157
|
+
describe ".list_directory" do
|
158
|
+
before do
|
159
|
+
@root = Dir.mktmpdir
|
160
|
+
FileUtils.touch(File.join(@root, "foo"))
|
161
|
+
Dir.mkdir(File.join(@root, "bar"))
|
162
|
+
FileUtils.touch(File.join(@root, ".foo"))
|
163
|
+
FileUtils.touch(File.join(@root, "bar", "baz"))
|
164
|
+
FileUtils.touch(File.join(@root, "bar", ".baz"))
|
165
|
+
end
|
166
|
+
|
167
|
+
after do
|
168
|
+
FileUtils.remove_entry(@root)
|
169
|
+
end
|
170
|
+
|
171
|
+
it "returns [] when the directory does not exist" do
|
172
|
+
Kitchen::Util.list_directory(File.join(@root, "notexist")).must_equal []
|
173
|
+
end
|
174
|
+
|
175
|
+
it "lists one level with no dot files by default" do
|
176
|
+
listed = Kitchen::Util.list_directory(@root)
|
177
|
+
expected = %w{
|
178
|
+
foo
|
179
|
+
bar
|
180
|
+
}.map { |f| File.join(@root, f) }
|
181
|
+
(listed - expected).must_equal []
|
182
|
+
(expected - listed).must_equal []
|
183
|
+
end
|
184
|
+
|
185
|
+
it "matches dot files only when include_dot" do
|
186
|
+
listed = Kitchen::Util.list_directory(@root, include_dot: true)
|
187
|
+
expected = [
|
188
|
+
"foo",
|
189
|
+
".foo",
|
190
|
+
"bar",
|
191
|
+
].map { |f| File.join(@root, f) }
|
192
|
+
(listed - expected).must_equal []
|
193
|
+
(expected - listed).must_equal []
|
194
|
+
end
|
195
|
+
|
196
|
+
it "recusivly lists only when recurse" do
|
197
|
+
listed = Kitchen::Util.list_directory(@root, recurse: true)
|
198
|
+
expected = [
|
199
|
+
"foo",
|
200
|
+
"bar",
|
201
|
+
"bar/baz",
|
202
|
+
].map { |f| File.join(@root, f) }
|
203
|
+
(listed - expected).must_equal []
|
204
|
+
(expected - listed).must_equal []
|
205
|
+
end
|
206
|
+
|
207
|
+
it "recusivly lists and provides dots when recurse and include_dot" do
|
208
|
+
listed = Kitchen::Util.list_directory(@root, recurse: true, include_dot: true)
|
209
|
+
expected = [
|
210
|
+
"foo",
|
211
|
+
".foo",
|
212
|
+
"bar",
|
213
|
+
"bar/baz",
|
214
|
+
"bar/.",
|
215
|
+
"bar/.baz",
|
216
|
+
].map { |f| File.join(@root, f) }
|
217
|
+
(listed - expected).must_equal []
|
218
|
+
(expected - listed).must_equal []
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
describe ".safe_glob" do
|
223
|
+
before do
|
224
|
+
@root = Dir.mktmpdir
|
225
|
+
FileUtils.touch(File.join(@root, "foo"))
|
226
|
+
Dir.mkdir(File.join(@root, "bar"))
|
227
|
+
FileUtils.touch(File.join(@root, "foo"))
|
228
|
+
FileUtils.touch(File.join(@root, "foo.rb"))
|
229
|
+
FileUtils.touch(File.join(@root, "bar", "baz.rb"))
|
230
|
+
end
|
231
|
+
|
232
|
+
after do
|
233
|
+
FileUtils.remove_entry(@root)
|
234
|
+
end
|
235
|
+
|
236
|
+
it "globs without parameters" do
|
237
|
+
Kitchen::Util.safe_glob(@root, "**/*").must_equal Dir.glob(File.join(@root, "**/*"))
|
238
|
+
end
|
239
|
+
|
240
|
+
it "globs with parameters" do
|
241
|
+
Kitchen::Util.safe_glob(@root, "**/*", File::FNM_DOTMATCH).must_equal(
|
242
|
+
Dir.glob(File.join(@root, "**/*"), File::FNM_DOTMATCH))
|
243
|
+
end
|
244
|
+
|
245
|
+
it "globs a folder that does not exist" do
|
246
|
+
dne_dir = File.join(@root, "notexist")
|
247
|
+
Kitchen::Util.safe_glob(dne_dir, "**/*").must_equal Dir.glob(File.join(dne_dir, "**/*"))
|
248
|
+
end
|
249
|
+
end
|
156
250
|
end
|
@@ -110,11 +110,11 @@ describe Kitchen::Verifier::Base do
|
|
110
110
|
before { platform.stubs(:os_type).returns("windows") }
|
111
111
|
|
112
112
|
it ":sudo defaults to nil" do
|
113
|
-
verifier[:sudo].
|
113
|
+
verifier[:sudo].must_be_nil
|
114
114
|
end
|
115
115
|
|
116
116
|
it ":sudo_command defaults to nil" do
|
117
|
-
verifier[:sudo_command].
|
117
|
+
verifier[:sudo_command].must_be_nil
|
118
118
|
end
|
119
119
|
|
120
120
|
it ':root_path defaults to $env:TEMP\\verifier' do
|
@@ -127,15 +127,15 @@ describe Kitchen::Verifier::Base do
|
|
127
127
|
end
|
128
128
|
|
129
129
|
it ":http_proxy defaults to nil" do
|
130
|
-
verifier[:http_proxy].
|
130
|
+
verifier[:http_proxy].must_be_nil
|
131
131
|
end
|
132
132
|
|
133
133
|
it ":http_proxys defaults to nil" do
|
134
|
-
verifier[:https_proxy].
|
134
|
+
verifier[:https_proxy].must_be_nil
|
135
135
|
end
|
136
136
|
|
137
137
|
it ":ftp_proxy defaults to nil" do
|
138
|
-
verifier[:ftp_proxy].
|
138
|
+
verifier[:ftp_proxy].must_be_nil
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
@@ -186,7 +186,7 @@ describe Kitchen::Verifier::Busser do
|
|
186
186
|
before { platform.stubs(:shell_type).returns("bourne") }
|
187
187
|
|
188
188
|
it "returns nil" do
|
189
|
-
cmd.
|
189
|
+
cmd.must_be_nil
|
190
190
|
end
|
191
191
|
end
|
192
192
|
|
@@ -197,7 +197,7 @@ describe Kitchen::Verifier::Busser do
|
|
197
197
|
end
|
198
198
|
|
199
199
|
it "returns nil" do
|
200
|
-
cmd.
|
200
|
+
cmd.must_be_nil
|
201
201
|
end
|
202
202
|
end
|
203
203
|
end
|
@@ -321,7 +321,7 @@ describe Kitchen::Verifier::Busser do
|
|
321
321
|
before { platform.stubs(:shell_type).returns("bourne") }
|
322
322
|
|
323
323
|
it "returns nil" do
|
324
|
-
cmd.
|
324
|
+
cmd.must_be_nil
|
325
325
|
end
|
326
326
|
end
|
327
327
|
|
@@ -332,7 +332,7 @@ describe Kitchen::Verifier::Busser do
|
|
332
332
|
end
|
333
333
|
|
334
334
|
it "returns nil" do
|
335
|
-
cmd.
|
335
|
+
cmd.must_be_nil
|
336
336
|
end
|
337
337
|
end
|
338
338
|
end
|
@@ -411,7 +411,7 @@ describe Kitchen::Verifier::Busser do
|
|
411
411
|
before { platform.stubs(:shell_type).returns("bourne") }
|
412
412
|
|
413
413
|
it "returns nil" do
|
414
|
-
cmd.
|
414
|
+
cmd.must_be_nil
|
415
415
|
end
|
416
416
|
end
|
417
417
|
|
@@ -422,7 +422,7 @@ describe Kitchen::Verifier::Busser do
|
|
422
422
|
end
|
423
423
|
|
424
424
|
it "returns nil" do
|
425
|
-
cmd.
|
425
|
+
cmd.must_be_nil
|
426
426
|
end
|
427
427
|
end
|
428
428
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
gem "minitest"
|
20
20
|
|
21
|
-
|
21
|
+
begin
|
22
22
|
require "simplecov"
|
23
23
|
SimpleCov.profiles.define "gem" do
|
24
24
|
command_name "Specs"
|
@@ -30,6 +30,8 @@ if ENV["CODECLIMATE_REPO_TOKEN"] || ENV["COVERAGE"]
|
|
30
30
|
add_group "Libraries", "/lib/"
|
31
31
|
end
|
32
32
|
SimpleCov.start "gem"
|
33
|
+
rescue LoadError
|
34
|
+
puts "add simplecov to Gemfile.local or GEMFILE_MOD to generate code coverage"
|
33
35
|
end
|
34
36
|
|
35
37
|
require "fakefs/safe"
|
data/test-kitchen.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
22
22
|
gem.require_paths = ["lib"]
|
23
23
|
|
24
|
-
gem.required_ruby_version = ">=
|
24
|
+
gem.required_ruby_version = ">= 2.3"
|
25
25
|
|
26
26
|
gem.add_dependency "mixlib-shellout", ">= 1.2", "< 3.0"
|
27
27
|
gem.add_dependency "net-scp", "~> 1.1"
|
@@ -53,9 +53,7 @@ Gem::Specification.new do |gem|
|
|
53
53
|
|
54
54
|
gem.add_development_dependency "countloc", "~> 0.4"
|
55
55
|
gem.add_development_dependency "maruku", "~> 0.6"
|
56
|
-
gem.add_development_dependency "simplecov"
|
57
56
|
gem.add_development_dependency "yard"
|
58
57
|
|
59
|
-
# Replacing finstyle in favor of chefstyle
|
60
58
|
gem.add_development_dependency "chefstyle"
|
61
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-kitchen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fletcher Nichol
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|
@@ -384,20 +384,6 @@ dependencies:
|
|
384
384
|
- - "~>"
|
385
385
|
- !ruby/object:Gem::Version
|
386
386
|
version: '0.6'
|
387
|
-
- !ruby/object:Gem::Dependency
|
388
|
-
name: simplecov
|
389
|
-
requirement: !ruby/object:Gem::Requirement
|
390
|
-
requirements:
|
391
|
-
- - ">="
|
392
|
-
- !ruby/object:Gem::Version
|
393
|
-
version: '0'
|
394
|
-
type: :development
|
395
|
-
prerelease: false
|
396
|
-
version_requirements: !ruby/object:Gem::Requirement
|
397
|
-
requirements:
|
398
|
-
- - ">="
|
399
|
-
- !ruby/object:Gem::Version
|
400
|
-
version: '0'
|
401
387
|
- !ruby/object:Gem::Dependency
|
402
388
|
name: yard
|
403
389
|
requirement: !ruby/object:Gem::Requirement
|
@@ -633,7 +619,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
633
619
|
requirements:
|
634
620
|
- - ">="
|
635
621
|
- !ruby/object:Gem::Version
|
636
|
-
version:
|
622
|
+
version: '2.3'
|
637
623
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
638
624
|
requirements:
|
639
625
|
- - ">="
|
@@ -641,7 +627,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
641
627
|
version: '0'
|
642
628
|
requirements: []
|
643
629
|
rubyforge_project:
|
644
|
-
rubygems_version: 2.
|
630
|
+
rubygems_version: 2.5.2
|
645
631
|
signing_key:
|
646
632
|
specification_version: 4
|
647
633
|
summary: Test Kitchen is an integration tool for developing and testing infrastructure
|