chefspec 5.4.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -2
- data/CHANGELOG.md +12 -1
- data/README.md +17 -3
- data/chefspec.gemspec +2 -3
- data/examples/apt_package/spec/install_spec.rb +1 -1
- data/examples/apt_package/spec/purge_spec.rb +1 -1
- data/examples/apt_package/spec/reconfig_spec.rb +1 -1
- data/examples/apt_package/spec/remove_spec.rb +1 -1
- data/examples/apt_package/spec/upgrade_spec.rb +1 -1
- data/examples/apt_repository/spec/add_spec.rb +1 -1
- data/examples/apt_repository/spec/remove_spec.rb +1 -1
- data/examples/apt_update/spec/periodic_spec.rb +1 -1
- data/examples/apt_update/spec/update_spec.rb +1 -1
- data/examples/batch/spec/run_spec.rb +1 -1
- data/examples/cab_package/recipes/install.rb +13 -0
- data/examples/cab_package/recipes/remove.rb +13 -0
- data/examples/cab_package/spec/install_spec.rb +26 -0
- data/examples/cab_package/spec/remove_spec.rb +22 -0
- data/examples/chocolatey_package/spec/install_spec.rb +1 -1
- data/examples/chocolatey_package/spec/remove_spec.rb +1 -1
- data/examples/chocolatey_package/spec/upgrade_spec.rb +1 -1
- data/examples/dnf_package/recipes/install.rb +13 -0
- data/examples/dnf_package/recipes/purge.rb +13 -0
- data/examples/dnf_package/recipes/remove.rb +13 -0
- data/examples/dnf_package/recipes/upgrade.rb +13 -0
- data/examples/dnf_package/spec/install_spec.rb +26 -0
- data/examples/dnf_package/spec/purge_spec.rb +22 -0
- data/examples/dnf_package/spec/remove_spec.rb +22 -0
- data/examples/dnf_package/spec/upgrade_spec.rb +22 -0
- data/examples/dpkg_package/spec/install_spec.rb +1 -1
- data/examples/dpkg_package/spec/purge_spec.rb +1 -1
- data/examples/dpkg_package/spec/remove_spec.rb +1 -1
- data/examples/dsc_resource/spec/run_spec.rb +4 -4
- data/examples/dsc_script/spec/run_spec.rb +1 -1
- data/examples/env/spec/create_spec.rb +1 -1
- data/examples/env/spec/delete_spec.rb +1 -1
- data/examples/env/spec/modify_spec.rb +1 -1
- data/examples/freebsd_package/spec/install_spec.rb +1 -1
- data/examples/freebsd_package/spec/remove_spec.rb +1 -1
- data/examples/ips_package/spec/install_spec.rb +1 -1
- data/examples/ips_package/spec/remove_spec.rb +1 -1
- data/examples/ips_package/spec/upgrade_spec.rb +1 -1
- data/examples/msu_package/recipes/install.rb +13 -0
- data/examples/msu_package/recipes/remove.rb +13 -0
- data/examples/msu_package/spec/install_spec.rb +26 -0
- data/examples/msu_package/spec/remove_spec.rb +22 -0
- data/examples/pacman_package/spec/install_spec.rb +1 -1
- data/examples/pacman_package/spec/purge_spec.rb +1 -1
- data/examples/pacman_package/spec/remove_spec.rb +1 -1
- data/examples/pacman_package/spec/upgrade_spec.rb +1 -1
- data/examples/portage_package/spec/install_spec.rb +1 -1
- data/examples/portage_package/spec/purge_spec.rb +1 -1
- data/examples/portage_package/spec/remove_spec.rb +1 -1
- data/examples/portage_package/spec/upgrade_spec.rb +1 -1
- data/examples/powershell_script/spec/run_spec.rb +1 -1
- data/examples/registry_key/spec/create_if_missing_spec.rb +1 -1
- data/examples/registry_key/spec/create_spec.rb +1 -1
- data/examples/registry_key/spec/delete_key_spec.rb +1 -1
- data/examples/registry_key/spec/delete_spec.rb +1 -1
- data/examples/roles/roles/role.rb +2 -2
- data/examples/rpm_package/spec/install_spec.rb +1 -1
- data/examples/rpm_package/spec/remove_spec.rb +1 -1
- data/examples/rpm_package/spec/upgrade_spec.rb +1 -1
- data/examples/server/spec/data_bag_spec.rb +9 -11
- data/examples/smartos_package/spec/install_spec.rb +1 -1
- data/examples/smartos_package/spec/remove_spec.rb +1 -1
- data/examples/smartos_package/spec/upgrade_spec.rb +1 -1
- data/examples/solaris_package/spec/install_spec.rb +1 -1
- data/examples/solaris_package/spec/remove_spec.rb +1 -1
- data/examples/step_into/spec/default_spec.rb +2 -2
- data/examples/use_inline_resources/spec/default_spec.rb +1 -1
- data/examples/windows_package/spec/install_spec.rb +1 -1
- data/examples/windows_package/spec/remove_spec.rb +1 -1
- data/examples/windows_service/spec/configure_startup_spec.rb +1 -1
- data/examples/windows_service/spec/disable_spec.rb +1 -1
- data/examples/windows_service/spec/enable_spec.rb +1 -1
- data/examples/windows_service/spec/reload_spec.rb +1 -1
- data/examples/windows_service/spec/restart_spec.rb +1 -1
- data/examples/windows_service/spec/start_spec.rb +1 -1
- data/examples/windows_service/spec/stop_spec.rb +1 -1
- data/examples/yum_package/spec/install_spec.rb +1 -1
- data/examples/yum_package/spec/purge_spec.rb +1 -1
- data/examples/yum_package/spec/remove_spec.rb +1 -1
- data/examples/yum_package/spec/upgrade_spec.rb +1 -1
- data/examples/yum_repository/spec/add_spec.rb +1 -1
- data/examples/yum_repository/spec/create_spec.rb +1 -1
- data/examples/yum_repository/spec/delete_spec.rb +1 -1
- data/examples/yum_repository/spec/makecache_spec.rb +1 -1
- data/examples/yum_repository/spec/remove_spec.rb +1 -1
- data/features/cab_package.feature +21 -0
- data/features/dnf_package.feature +26 -0
- data/features/msu_package.feature +23 -0
- data/features/support/env.rb +8 -0
- data/lib/chefspec.rb +0 -1
- data/lib/chefspec/api.rb +3 -0
- data/lib/chefspec/api/cab_package.rb +80 -0
- data/lib/chefspec/api/dnf_package.rb +154 -0
- data/lib/chefspec/api/msu_package.rb +81 -0
- data/lib/chefspec/rspec.rb +1 -0
- data/lib/chefspec/server_methods.rb +4 -35
- data/lib/chefspec/server_runner.rb +2 -42
- data/lib/chefspec/version.rb +1 -1
- data/lib/chefspec/zero_server.rb +139 -0
- metadata +31 -6
- data/lib/chefspec/chef_backwards_compat.rb +0 -79
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c39538d26c07878521a8a68a1e8b488c80901e1d
|
4
|
+
data.tar.gz: f95025605f2aaa4d047cb2f193fb6575e9e55144
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24ca89915326c5474ed8802aa2d34c5777661e40d2cfcde76ada3ecf44f131968efd41a7c3f373ac41d4b6f6c0b8c4149b24adac82cd937b05541e80487d5a2d
|
7
|
+
data.tar.gz: 15caa99f8225ec1f17186bab5d7b895a9a1febdec0c3bc050d2077da69948ef9827fcedd6c46d3812acc5a128bc22e099ae0f2a8fc450ab9308e93bcff272d75
|
data/.travis.yml
CHANGED
@@ -6,8 +6,7 @@ before_install:
|
|
6
6
|
- gem install bundler
|
7
7
|
|
8
8
|
rvm:
|
9
|
-
- 2.
|
10
|
-
- 2.2.5
|
9
|
+
- 2.2.6
|
11
10
|
|
12
11
|
branches:
|
13
12
|
only:
|
@@ -19,6 +18,11 @@ gemfile: gemfiles/chefspec.gemfile
|
|
19
18
|
|
20
19
|
env:
|
21
20
|
- CHEF_VERSION=master
|
21
|
+
- CHEF_VERSION=12.18.31
|
22
|
+
- CHEF_VERSION=12.17.44
|
23
|
+
- CHEF_VERSION=12.16.42
|
24
|
+
- CHEF_VERSION=12.15.19
|
25
|
+
- CHEF_VERSION=12.14.89
|
22
26
|
- CHEF_VERSION=12.13.37
|
23
27
|
- CHEF_VERSION=12.12.15
|
24
28
|
- CHEF_VERSION=12.11.18
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# CHANGELOG for ChefSpec
|
2
2
|
|
3
|
+
## 6.0.0 (February 22, 2017)
|
4
|
+
|
5
|
+
BREAKING CHANGES
|
6
|
+
|
7
|
+
ChefSpec now requires Ruby 2.2 or later.
|
8
|
+
|
9
|
+
IMPROVEMENTS
|
10
|
+
|
11
|
+
- Improve ServerRunner speed and reduce process hangs by using a single stand-alone chef-zero server.
|
12
|
+
- Add configuration value to dictate whether cookbooks are re-uploaded before every test context.
|
13
|
+
- Added matchers for dnf_package, msu_package, and cab_package
|
14
|
+
|
3
15
|
## 5.4.0 (February 9, 2017)
|
4
16
|
|
5
17
|
IMPROVEMENTS
|
@@ -10,7 +22,6 @@ UPDATES
|
|
10
22
|
|
11
23
|
- While Chef 12.0 - 12.5 are still supported, they are no longer being tested.
|
12
24
|
|
13
|
-
|
14
25
|
## 5.3.0 (October 29, 2016)
|
15
26
|
|
16
27
|
IMPROVEMENTS
|
data/README.md
CHANGED
@@ -92,9 +92,6 @@ RSpec.configure do |config|
|
|
92
92
|
|
93
93
|
# Specify the operating version to mock Ohai data from (default: nil)
|
94
94
|
config.version = '14.04'
|
95
|
-
|
96
|
-
# When using ChefSpec::ServerRunner, specify the data storage method (options: in_memory, on_disk; default: in_memory)
|
97
|
-
config.server_runner_data_store = :on_disk
|
98
95
|
end
|
99
96
|
```
|
100
97
|
|
@@ -122,6 +119,23 @@ ChefSpec::SoloRunner.new(log_level: :debug).converge(described_recipe)
|
|
122
119
|
|
123
120
|
**NOTE** You do not _need_ to specify a platform and version to use ChefSpec. However, some cookbooks may rely on [Ohai](http://github.com/chef/ohai) data that ChefSpec cannot not automatically generate. Specifying the `platform` and `version` keys instructs ChefSpec to load stubbed Ohai attributes from another platform using [fauxhai](https://github.com/customink/fauxhai).
|
124
121
|
|
122
|
+
### ChefZero Server
|
123
|
+
|
124
|
+
The `ServerRunner` uses a [chef-zero](https://github.com/chef/chef-zero) instance as a stand-in for a full Chef Server. The instance is created at the initiation of the ChefSpec suite and is terminated at its completion. In between each test the state of the ChefZero server is completely reset.
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
RSpec.configure do |config|
|
128
|
+
# When using ChefSpec::ServerRunner, specify the data storage method (options: in_memory, on_disk; default: in_memory)
|
129
|
+
# If you are in a low-memory environment, setting this value to :on_disk may improve speed and/or reliability.
|
130
|
+
config.server_runner_data_store = :on_disk
|
131
|
+
|
132
|
+
# Whether or not to clear the cookbooks on the ChefZero instance in-between each test (default: true)
|
133
|
+
# For most people, not clearing the cookbooks will drastically improve test execution time. This is a
|
134
|
+
# good option for people who are using chefspec within the context of a single Berksfile or Policyfile.
|
135
|
+
config.server_runner_clear_cookbooks = false
|
136
|
+
end
|
137
|
+
```
|
138
|
+
|
125
139
|
### Berkshelf
|
126
140
|
|
127
141
|
If you are using Berkshelf, simply require `chefspec/berkshelf` in your `spec_helper` after requiring `chefspec`:
|
data/chefspec.gemspec
CHANGED
@@ -23,15 +23,14 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
24
24
|
s.require_paths = ['lib']
|
25
25
|
|
26
|
-
|
27
|
-
s.required_ruby_version = '>= 2.1'
|
26
|
+
s.required_ruby_version = '>= 2.2'
|
28
27
|
|
29
28
|
s.add_dependency 'chef', '>= 12.0'
|
30
29
|
s.add_dependency 'fauxhai', '~> 3.6'
|
31
30
|
s.add_dependency 'rspec', '~> 3.0'
|
32
31
|
|
33
32
|
# Development Dependencies
|
34
|
-
s.add_development_dependency 'rake', '<
|
33
|
+
s.add_development_dependency 'rake', '< 13.0'
|
35
34
|
s.add_development_dependency 'redcarpet', '~> 3.3'
|
36
35
|
s.add_development_dependency 'yard', '~> 0.8'
|
37
36
|
|
@@ -3,7 +3,7 @@ require 'chefspec'
|
|
3
3
|
describe 'apt_package::reconfig' do
|
4
4
|
let(:chef_run) do
|
5
5
|
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
|
6
|
-
|
6
|
+
.converge(described_recipe)
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'reconfigs a apt_package with an explicit action' do
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'chefspec'
|
2
|
+
|
3
|
+
describe 'cab_package::install' do
|
4
|
+
let(:chef_run) do
|
5
|
+
ChefSpec::ServerRunner.new(platform: 'windows', version: '2012R2')
|
6
|
+
.converge(described_recipe)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'installs a cab_package with the default action' do
|
10
|
+
expect(chef_run).to install_cab_package('default_action')
|
11
|
+
expect(chef_run).to_not install_cab_package('not_default_action')
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'installs a cab_package with an explicit action' do
|
15
|
+
expect(chef_run).to install_cab_package('explicit_action')
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'installs a cab_package with attributes' do
|
19
|
+
expect(chef_run).to install_cab_package('with_attributes').with(version: '1.2.3')
|
20
|
+
expect(chef_run).to_not install_cab_package('with_attributes').with(version: '1.2.4')
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'installs a cab_package when specifying the identity attribute' do
|
24
|
+
expect(chef_run).to install_cab_package('identity_attribute')
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'chefspec'
|
2
|
+
|
3
|
+
describe 'cab_package::remove' do
|
4
|
+
let(:chef_run) do
|
5
|
+
ChefSpec::ServerRunner.new(platform: 'windows', version: '2012R2')
|
6
|
+
.converge(described_recipe)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'removes a cab_package with an explicit action' do
|
10
|
+
expect(chef_run).to remove_cab_package('explicit_action')
|
11
|
+
expect(chef_run).to_not remove_cab_package('not_explicit_action')
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'removes a cab_package with attributes' do
|
15
|
+
expect(chef_run).to remove_cab_package('with_attributes').with(version: '1.2.3')
|
16
|
+
expect(chef_run).to_not remove_cab_package('with_attributes').with(version: '1.2.4')
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'removes a cab_package when specifying the identity attribute' do
|
20
|
+
expect(chef_run).to remove_cab_package('identity_attribute')
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'chefspec'
|
2
|
+
|
3
|
+
describe 'dnf_package::install' do
|
4
|
+
let(:chef_run) do
|
5
|
+
ChefSpec::ServerRunner.new(platform: 'fedora', version: '25')
|
6
|
+
.converge(described_recipe)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'installs a dnf_package with the default action' do
|
10
|
+
expect(chef_run).to install_dnf_package('default_action')
|
11
|
+
expect(chef_run).to_not install_dnf_package('not_default_action')
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'installs a dnf_package with an explicit action' do
|
15
|
+
expect(chef_run).to install_dnf_package('explicit_action')
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'installs a dnf_package with attributes' do
|
19
|
+
expect(chef_run).to install_dnf_package('with_attributes').with(version: '1.0.0')
|
20
|
+
expect(chef_run).to_not install_dnf_package('with_attributes').with(version: '1.2.3')
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'installs a dnf_package when specifying the identity attribute' do
|
24
|
+
expect(chef_run).to install_dnf_package('identity_attribute')
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'chefspec'
|
2
|
+
|
3
|
+
describe 'dnf_package::purge' do
|
4
|
+
let(:chef_run) do
|
5
|
+
ChefSpec::ServerRunner.new(platform: 'fedora', version: '25')
|
6
|
+
.converge(described_recipe)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'purges a dnf_package with an explicit action' do
|
10
|
+
expect(chef_run).to purge_dnf_package('explicit_action')
|
11
|
+
expect(chef_run).to_not purge_dnf_package('not_explicit_action')
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'purges a dnf_package with attributes' do
|
15
|
+
expect(chef_run).to purge_dnf_package('with_attributes').with(version: '1.0.0')
|
16
|
+
expect(chef_run).to_not purge_dnf_package('with_attributes').with(version: '1.2.3')
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'purges a dnf_package when specifying the identity attribute' do
|
20
|
+
expect(chef_run).to purge_dnf_package('identity_attribute')
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'chefspec'
|
2
|
+
|
3
|
+
describe 'dnf_package::remove' do
|
4
|
+
let(:chef_run) do
|
5
|
+
ChefSpec::ServerRunner.new(platform: 'fedora', version: '25')
|
6
|
+
.converge(described_recipe)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'removes a dnf_package with an explicit action' do
|
10
|
+
expect(chef_run).to remove_dnf_package('explicit_action')
|
11
|
+
expect(chef_run).to_not remove_dnf_package('not_explicit_action')
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'removes a dnf_package with attributes' do
|
15
|
+
expect(chef_run).to remove_dnf_package('with_attributes').with(version: '1.0.0')
|
16
|
+
expect(chef_run).to_not remove_dnf_package('with_attributes').with(version: '1.2.3')
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'removes a dnf_package when specifying the identity attribute' do
|
20
|
+
expect(chef_run).to remove_dnf_package('identity_attribute')
|
21
|
+
end
|
22
|
+
end
|