chefspec 7.0.0 → 7.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/Gemfile +6 -0
- data/README.md +43 -11
- data/Rakefile +48 -8
- data/chefspec.gemspec +0 -8
- data/examples/cab_package/spec/install_spec.rb +20 -18
- data/examples/cab_package/spec/remove_spec.rb +17 -15
- data/examples/cached/spec/default_spec.rb +1 -0
- data/examples/compile_time/spec/default_spec.rb +2 -0
- data/examples/custom_matcher/libraries/matcher.rb +1 -23
- data/examples/dnf_package/spec/install_spec.rb +20 -18
- data/examples/dnf_package/spec/purge_spec.rb +17 -15
- data/examples/dnf_package/spec/remove_spec.rb +17 -15
- data/examples/dnf_package/spec/upgrade_spec.rb +17 -15
- data/examples/heavy_provider_light_resource/spec/provider_service_spec.rb +1 -0
- data/examples/msu_package/spec/install_spec.rb +20 -18
- data/examples/msu_package/spec/remove_spec.rb +17 -15
- data/examples/server/spec/exotic_port_spec.rb +15 -2
- data/lib/chefspec.rb +1 -8
- data/lib/chefspec/api.rb +6 -84
- data/lib/chefspec/api/do_nothing.rb +18 -21
- data/lib/chefspec/api/include_recipe.rb +20 -23
- data/lib/chefspec/api/link.rb +20 -99
- data/lib/chefspec/api/notifications.rb +32 -35
- data/lib/chefspec/api/reboot.rb +5 -14
- data/lib/chefspec/api/render_file.rb +29 -32
- data/lib/chefspec/api/state_attrs.rb +22 -25
- data/lib/chefspec/api/subscriptions.rb +29 -32
- data/lib/chefspec/api/user.rb +216 -219
- data/lib/chefspec/extensions.rb +16 -0
- data/lib/chefspec/extensions/chef/resource.rb +90 -8
- data/lib/chefspec/version.rb +1 -1
- data/lib/chefspec/zero_server.rb +20 -18
- metadata +3 -313
- data/examples/custom_resource/libraries/matchers.rb +0 -5
- data/examples/use_inline_resources/libraries/matchers.rb +0 -5
- data/features/apt_package.feature +0 -14
- data/features/apt_repository.feature +0 -15
- data/features/apt_update.feature +0 -13
- data/features/attributes.feature +0 -7
- data/features/batch.feature +0 -10
- data/features/bff_package.feature +0 -12
- data/features/cab_package.feature +0 -21
- data/features/cached.feature +0 -7
- data/features/chef_gem.feature +0 -14
- data/features/chocolatey_package.feature +0 -14
- data/features/compile_time.feature +0 -7
- data/features/cookbook_file.feature +0 -13
- data/features/cron.feature +0 -11
- data/features/custom_matcher.feature +0 -11
- data/features/custom_resource.feature +0 -7
- data/features/deploy.feature +0 -12
- data/features/directory.feature +0 -11
- data/features/dnf_package.feature +0 -26
- data/features/do_nothing.feature +0 -10
- data/features/dpkg_package.feature +0 -12
- data/features/dsc_resource.feature +0 -10
- data/features/dsc_script.feature +0 -10
- data/features/env.feature +0 -12
- data/features/erl_call.feature +0 -10
- data/features/execute.feature +0 -10
- data/features/exotic_zero_port.feature +0 -7
- data/features/expect_exception.feature +0 -12
- data/features/file.feature +0 -13
- data/features/freebsd_package.feature +0 -11
- data/features/gem_package.feature +0 -14
- data/features/git.feature +0 -12
- data/features/group.feature +0 -13
- data/features/guards.feature +0 -10
- data/features/heavy_provider_light_resource.feature +0 -10
- data/features/homebrew_package.feature +0 -12
- data/features/http_request.feature +0 -15
- data/features/ifconfig.feature +0 -13
- data/features/include_recipe.feature +0 -10
- data/features/ips_package.feature +0 -12
- data/features/launchd.feature +0 -17
- data/features/link.feature +0 -12
- data/features/log.feature +0 -10
- data/features/macports_package.feature +0 -13
- data/features/mdadm.feature +0 -12
- data/features/mount.feature +0 -14
- data/features/msu_package.feature +0 -23
- data/features/multiple_actions.feature +0 -12
- data/features/multiple_run_action.feature +0 -7
- data/features/notifications.feature +0 -14
- data/features/ohai.feature +0 -10
- data/features/openbsd_package.feature +0 -12
- data/features/osx_profile.feature +0 -13
- data/features/package.feature +0 -14
- data/features/pacman_package.feature +0 -13
- data/features/paludis_package.feature +0 -12
- data/features/portage_package.feature +0 -13
- data/features/powershell_script.feature +0 -10
- data/features/reboot.feature +0 -12
- data/features/registry_key.feature +0 -13
- data/features/remote_directory.feature +0 -12
- data/features/remote_file.feature +0 -13
- data/features/render_file.feature +0 -11
- data/features/roles.feature +0 -7
- data/features/route.feature +0 -11
- data/features/rpm_package.feature +0 -12
- data/features/ruby_block.feature +0 -11
- data/features/script.feature +0 -16
- data/features/server.feature +0 -16
- data/features/server_on_disk.feature +0 -16
- data/features/service.feature +0 -15
- data/features/smartos_package.feature +0 -12
- data/features/solaris_package.feature +0 -12
- data/features/state_attrs.feature +0 -7
- data/features/step_definitions/background_steps.rb +0 -7
- data/features/step_into.feature +0 -7
- data/features/stub_command.feature +0 -7
- data/features/stub_data_bag.feature +0 -7
- data/features/stub_data_bag_item.feature +0 -7
- data/features/stub_node.feature +0 -7
- data/features/stub_search.feature +0 -7
- data/features/subscribes.feature +0 -14
- data/features/subversion.feature +0 -13
- data/features/support/env.rb +0 -38
- data/features/support/executor.rb +0 -20
- data/features/support/exotic_zero_port.rb +0 -3
- data/features/support/on_disk.rb +0 -7
- data/features/systemd_unit.feature +0 -27
- data/features/template.feature +0 -13
- data/features/use_inline_resources.feature +0 -7
- data/features/user.feature +0 -15
- data/features/windows_package.feature +0 -11
- data/features/windows_service.feature +0 -16
- data/features/yum_package.feature +0 -13
- data/features/yum_repository.feature +0 -23
- data/features/zypper_package.feature +0 -13
- data/lib/chefspec/api/apt_package.rb +0 -192
- data/lib/chefspec/api/apt_repository.rb +0 -56
- data/lib/chefspec/api/apt_update.rb +0 -53
- data/lib/chefspec/api/batch.rb +0 -43
- data/lib/chefspec/api/bff_package.rb +0 -154
- data/lib/chefspec/api/cab_package.rb +0 -80
- data/lib/chefspec/api/chef_gem.rb +0 -191
- data/lib/chefspec/api/chocolatey_package.rb +0 -107
- data/lib/chefspec/api/cookbook_file.rb +0 -166
- data/lib/chefspec/api/cron.rb +0 -80
- data/lib/chefspec/api/deploy.rb +0 -117
- data/lib/chefspec/api/directory.rb +0 -80
- data/lib/chefspec/api/dnf_package.rb +0 -154
- data/lib/chefspec/api/dpkg_package.rb +0 -117
- data/lib/chefspec/api/dsc_resource.rb +0 -49
- data/lib/chefspec/api/dsc_script.rb +0 -37
- data/lib/chefspec/api/easy_install_package.rb +0 -154
- data/lib/chefspec/api/env.rb +0 -117
- data/lib/chefspec/api/erl_call.rb +0 -43
- data/lib/chefspec/api/execute.rb +0 -43
- data/lib/chefspec/api/file.rb +0 -166
- data/lib/chefspec/api/freebsd_package.rb +0 -80
- data/lib/chefspec/api/gem_package.rb +0 -191
- data/lib/chefspec/api/git.rb +0 -117
- data/lib/chefspec/api/group.rb +0 -154
- data/lib/chefspec/api/homebrew_package.rb +0 -154
- data/lib/chefspec/api/http_request.rb +0 -228
- data/lib/chefspec/api/ifconfig.rb +0 -154
- data/lib/chefspec/api/ips_package.rb +0 -117
- data/lib/chefspec/api/launchd.rb +0 -151
- data/lib/chefspec/api/log.rb +0 -43
- data/lib/chefspec/api/macports_package.rb +0 -154
- data/lib/chefspec/api/mdadm.rb +0 -117
- data/lib/chefspec/api/mount.rb +0 -192
- data/lib/chefspec/api/msu_package.rb +0 -81
- data/lib/chefspec/api/ohai.rb +0 -43
- data/lib/chefspec/api/openbsd_package.rb +0 -155
- data/lib/chefspec/api/osx_profile.rb +0 -63
- data/lib/chefspec/api/package.rb +0 -192
- data/lib/chefspec/api/pacman_package.rb +0 -155
- data/lib/chefspec/api/paludis_package.rb +0 -155
- data/lib/chefspec/api/portage_package.rb +0 -155
- data/lib/chefspec/api/powershell_script.rb +0 -43
- data/lib/chefspec/api/registry_key.rb +0 -166
- data/lib/chefspec/api/remote_directory.rb +0 -120
- data/lib/chefspec/api/remote_file.rb +0 -166
- data/lib/chefspec/api/route.rb +0 -80
- data/lib/chefspec/api/rpm_package.rb +0 -117
- data/lib/chefspec/api/ruby_block.rb +0 -68
- data/lib/chefspec/api/script.rb +0 -278
- data/lib/chefspec/api/service.rb +0 -246
- data/lib/chefspec/api/smartos_package.rb +0 -117
- data/lib/chefspec/api/solaris_package.rb +0 -117
- data/lib/chefspec/api/subversion.rb +0 -154
- data/lib/chefspec/api/systemd_unit.rb +0 -353
- data/lib/chefspec/api/template.rb +0 -166
- data/lib/chefspec/api/windows_package.rb +0 -86
- data/lib/chefspec/api/windows_service.rb +0 -286
- data/lib/chefspec/api/yum_package.rb +0 -154
- data/lib/chefspec/api/yum_repository.rb +0 -130
- data/lib/chefspec/api/zypper_package.rb +0 -154
- data/spec/unit/api_spec.rb +0 -18
@@ -1,154 +0,0 @@
|
|
1
|
-
module ChefSpec::API
|
2
|
-
# @since 3.0.0
|
3
|
-
module SubversionMatchers
|
4
|
-
ChefSpec.define_matcher :subversion
|
5
|
-
|
6
|
-
#
|
7
|
-
# Assert that a +subversion+ resource exists in the Chef run with the
|
8
|
-
# action +:checkout+. Given a Chef Recipe that checks out "svn://..." as a
|
9
|
-
# +subversion+:
|
10
|
-
#
|
11
|
-
# subversion 'svn://...' do
|
12
|
-
# action :checkout
|
13
|
-
# end
|
14
|
-
#
|
15
|
-
# The Examples section demonstrates the different ways to test a
|
16
|
-
# +subversion+ resource with ChefSpec.
|
17
|
-
#
|
18
|
-
# @example Assert that a +subversion+ was checked out
|
19
|
-
# expect(chef_run).to checkout_subversion('svn://...')
|
20
|
-
#
|
21
|
-
# @example Assert that a +subversion+ was checked out with predicate matchers
|
22
|
-
# expect(chef_run).to checkout_subversion('svn://...').with_user('svargo')
|
23
|
-
#
|
24
|
-
# @example Assert that a +subversion+ was checked out with attributes
|
25
|
-
# expect(chef_run).to checkout_subversion('svn://...').with(user: 'svargo')
|
26
|
-
#
|
27
|
-
# @example Assert that a +subversion+ was checked out using a regex
|
28
|
-
# expect(chef_run).to checkout_subversion('svn://...').with(user: /sva(.+)/)
|
29
|
-
#
|
30
|
-
# @example Assert that a +subversion+ was _not_ checked out
|
31
|
-
# expect(chef_run).to_not checkout_subversion('svn://...')
|
32
|
-
#
|
33
|
-
#
|
34
|
-
# @param [String, Regex] resource_name
|
35
|
-
# the name of the resource to match
|
36
|
-
#
|
37
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
38
|
-
#
|
39
|
-
def checkout_subversion(resource_name)
|
40
|
-
ChefSpec::Matchers::ResourceMatcher.new(:subversion, :checkout, resource_name)
|
41
|
-
end
|
42
|
-
|
43
|
-
#
|
44
|
-
# Assert that a +subversion+ resource exists in the Chef run with the
|
45
|
-
# action +:export+. Given a Chef Recipe that exports "svn://" as a
|
46
|
-
# +subversion+:
|
47
|
-
#
|
48
|
-
# subversion 'svn://' do
|
49
|
-
# action :export
|
50
|
-
# end
|
51
|
-
#
|
52
|
-
# The Examples section demonstrates the different ways to test a
|
53
|
-
# +subversion+ resource with ChefSpec.
|
54
|
-
#
|
55
|
-
# @example Assert that a +subversion+ was exported
|
56
|
-
# expect(chef_run).to export_subversion('svn://')
|
57
|
-
#
|
58
|
-
# @example Assert that a +subversion+ was exported with predicate matchers
|
59
|
-
# expect(chef_run).to export_subversion('svn://').with_user('svargo')
|
60
|
-
#
|
61
|
-
# @example Assert that a +subversion+ was exported with attributes
|
62
|
-
# expect(chef_run).to export_subversion('svn://').with(user: 'svargo')
|
63
|
-
#
|
64
|
-
# @example Assert that a +subversion+ was exported using a regex
|
65
|
-
# expect(chef_run).to export_subversion('svn://').with(user: /sva(.+)/)
|
66
|
-
#
|
67
|
-
# @example Assert that a +subversion+ was _not_ exported
|
68
|
-
# expect(chef_run).to_not export_subversion('svn://')
|
69
|
-
#
|
70
|
-
#
|
71
|
-
# @param [String, Regex] resource_name
|
72
|
-
# the name of the resource to match
|
73
|
-
#
|
74
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
75
|
-
#
|
76
|
-
def export_subversion(resource_name)
|
77
|
-
ChefSpec::Matchers::ResourceMatcher.new(:subversion, :export, resource_name)
|
78
|
-
end
|
79
|
-
|
80
|
-
#
|
81
|
-
# Assert that a +subversion+ resource exists in the Chef run with the
|
82
|
-
# action +:force_export+. Given a Chef Recipe that force_exports "svn://" as a
|
83
|
-
# +subversion+:
|
84
|
-
#
|
85
|
-
# subversion 'svn://' do
|
86
|
-
# action :force_export
|
87
|
-
# end
|
88
|
-
#
|
89
|
-
# The Examples section demonstrates the different ways to test a
|
90
|
-
# +subversion+ resource with ChefSpec.
|
91
|
-
#
|
92
|
-
# @example Assert that a +subversion+ was force_exported
|
93
|
-
# expect(chef_run).to force_export_subversion('svn://')
|
94
|
-
#
|
95
|
-
# @example Assert that a +subversion+ was force_exported with predicate matchers
|
96
|
-
# expect(chef_run).to force_export_subversion('svn://').with_user('svargo')
|
97
|
-
#
|
98
|
-
# @example Assert that a +subversion+ was force_exported with attributes
|
99
|
-
# expect(chef_run).to force_export_subversion('svn://').with(user: 'svargo')
|
100
|
-
#
|
101
|
-
# @example Assert that a +subversion+ was force_exported using a regex
|
102
|
-
# expect(chef_run).to force_export_subversion('svn://').with(user: /sva(.+)/)
|
103
|
-
#
|
104
|
-
# @example Assert that a +subversion+ was _not_ force_exported
|
105
|
-
# expect(chef_run).to_not force_export_subversion('svn://')
|
106
|
-
#
|
107
|
-
#
|
108
|
-
# @param [String, Regex] resource_name
|
109
|
-
# the name of the resource to match
|
110
|
-
#
|
111
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
112
|
-
#
|
113
|
-
def force_export_subversion(resource_name)
|
114
|
-
ChefSpec::Matchers::ResourceMatcher.new(:subversion, :force_export, resource_name)
|
115
|
-
end
|
116
|
-
|
117
|
-
#
|
118
|
-
# Assert that a +subversion+ resource exists in the Chef run with the
|
119
|
-
# action +:sync+. Given a Chef Recipe that syncs "svn://" as a
|
120
|
-
# +subversion+:
|
121
|
-
#
|
122
|
-
# subversion 'svn://' do
|
123
|
-
# action :sync
|
124
|
-
# end
|
125
|
-
#
|
126
|
-
# The Examples section demonstrates the different ways to test a
|
127
|
-
# +subversion+ resource with ChefSpec.
|
128
|
-
#
|
129
|
-
# @example Assert that a +subversion+ was synced
|
130
|
-
# expect(chef_run).to sync_subversion('svn://')
|
131
|
-
#
|
132
|
-
# @example Assert that a +subversion+ was synced with predicate matchers
|
133
|
-
# expect(chef_run).to sync_subversion('svn://').with_user('svargo')
|
134
|
-
#
|
135
|
-
# @example Assert that a +subversion+ was synced with attributes
|
136
|
-
# expect(chef_run).to sync_subversion('svn://').with(user: 'svargo')
|
137
|
-
#
|
138
|
-
# @example Assert that a +subversion+ was synced using a regex
|
139
|
-
# expect(chef_run).to sync_subversion('svn://').with(user: /sva(.+)/)
|
140
|
-
#
|
141
|
-
# @example Assert that a +subversion+ was _not_ synced
|
142
|
-
# expect(chef_run).to_not sync_subversion('svn://')
|
143
|
-
#
|
144
|
-
#
|
145
|
-
# @param [String, Regex] resource_name
|
146
|
-
# the name of the resource to match
|
147
|
-
#
|
148
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
149
|
-
#
|
150
|
-
def sync_subversion(resource_name)
|
151
|
-
ChefSpec::Matchers::ResourceMatcher.new(:subversion, :sync, resource_name)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|
@@ -1,353 +0,0 @@
|
|
1
|
-
module ChefSpec::API
|
2
|
-
# @since 5.1.0
|
3
|
-
module SystemdUnitMatchers
|
4
|
-
ChefSpec.define_matcher :systemd_unit
|
5
|
-
|
6
|
-
#
|
7
|
-
# Assert that a +systemd_unit+ resource exists in the Chef run with the
|
8
|
-
# action +:create+. Given a Chef Recipe that creates the systemd_unit
|
9
|
-
# "sysstat-collect.timer":
|
10
|
-
#
|
11
|
-
# systemd_unit 'sysstat-collect.timer' do
|
12
|
-
# action :create
|
13
|
-
# end
|
14
|
-
#
|
15
|
-
# The Examples section demonstrates the different ways to test a
|
16
|
-
# +systemd_unit+ resource with ChefSpec.
|
17
|
-
#
|
18
|
-
# @example Assert that a +systemd_unit+ was created
|
19
|
-
# expect(chef_run).to create_systemd_unit('sysstat-collect.timer')
|
20
|
-
#
|
21
|
-
# @example Assert that a +systemd_unit+ was _not_ created
|
22
|
-
# expect(chef_run).to_not create_systemd_unit('sysstat-collect.timer')
|
23
|
-
#
|
24
|
-
#
|
25
|
-
# @param [String, Regex] resource_name
|
26
|
-
# the name of the resource to match
|
27
|
-
#
|
28
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
29
|
-
#
|
30
|
-
|
31
|
-
def create_systemd_unit(resource_name)
|
32
|
-
ChefSpec::Matchers::ResourceMatcher.new(:systemd_unit, :create, resource_name)
|
33
|
-
end
|
34
|
-
|
35
|
-
#
|
36
|
-
# Assert that a +systemd_unit+ resource exists in the Chef run with the
|
37
|
-
# action +:delete+. Given a Chef Recipe that deletes the systemd_unit
|
38
|
-
# "sysstat-collect.timer":
|
39
|
-
#
|
40
|
-
# systemd_unit 'sysstat-collect.timer' do
|
41
|
-
# action :delete
|
42
|
-
# end
|
43
|
-
#
|
44
|
-
# The Examples section demonstrates the different ways to test a
|
45
|
-
# +systemd_unit+ resource with ChefSpec.
|
46
|
-
#
|
47
|
-
# @example Assert that a +systemd_unit+ was deleted
|
48
|
-
# expect(chef_run).to delete_systemd_unit('sysstat-collect.timer')
|
49
|
-
#
|
50
|
-
# @example Assert that a +systemd_unit+ was _not_ deleted
|
51
|
-
# expect(chef_run).to_not delete_systemd_unit('sysstat-collect.timer')
|
52
|
-
#
|
53
|
-
#
|
54
|
-
# @param [String, Regex] resource_name
|
55
|
-
# the name of the resource to match
|
56
|
-
#
|
57
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
58
|
-
#
|
59
|
-
|
60
|
-
def delete_systemd_unit(resource_name)
|
61
|
-
ChefSpec::Matchers::ResourceMatcher.new(:systemd_unit, :delete, resource_name)
|
62
|
-
end
|
63
|
-
|
64
|
-
#
|
65
|
-
# Assert that a +systemd_unit+ resource exists in the Chef run with the
|
66
|
-
# action +:enable+. Given a Chef Recipe that enables the systemd_unit
|
67
|
-
# "sysstat-collect.timer":
|
68
|
-
#
|
69
|
-
# systemd_unit 'sysstat-collect.timer' do
|
70
|
-
# action :enables
|
71
|
-
# end
|
72
|
-
#
|
73
|
-
# The Examples section demonstrates the different ways to test a
|
74
|
-
# +systemd_unit+ resource with ChefSpec.
|
75
|
-
#
|
76
|
-
# @example Assert that a +systemd_unit+ was enabled
|
77
|
-
# expect(chef_run).to enable_systemd_unit('sysstat-collect.timer')
|
78
|
-
#
|
79
|
-
# @example Assert that a +systemd_unit+ was _not_ enabled
|
80
|
-
# expect(chef_run).to_not enable_systemd_unit('sysstat-collect.timer')
|
81
|
-
#
|
82
|
-
#
|
83
|
-
# @param [String, Regex] resource_name
|
84
|
-
# the name of the resource to match
|
85
|
-
#
|
86
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
87
|
-
#
|
88
|
-
|
89
|
-
def enable_systemd_unit(resource_name)
|
90
|
-
ChefSpec::Matchers::ResourceMatcher.new(:systemd_unit, :enable, resource_name)
|
91
|
-
end
|
92
|
-
|
93
|
-
#
|
94
|
-
# Assert that a +systemd_unit+ resource exists in the Chef run with the
|
95
|
-
# action +:disable+. Given a Chef Recipe that disables the systemd_unit
|
96
|
-
# "sysstat-collect.timer":
|
97
|
-
#
|
98
|
-
# systemd_unit 'sysstat-collect.timer' do
|
99
|
-
# action :disable
|
100
|
-
# end
|
101
|
-
#
|
102
|
-
# The Examples section demonstrates the different ways to test a
|
103
|
-
# +systemd_unit+ resource with ChefSpec.
|
104
|
-
#
|
105
|
-
# @example Assert that a +systemd_unit+ was disabled
|
106
|
-
# expect(chef_run).to disable_systemd_unit('sysstat-collect.timer')
|
107
|
-
#
|
108
|
-
# @example Assert that a +systemd_unit+ was _not_ disabled
|
109
|
-
# expect(chef_run).to_not disable_systemd_unit('sysstat-collect.timer')
|
110
|
-
#
|
111
|
-
#
|
112
|
-
# @param [String, Regex] resource_name
|
113
|
-
# the name of the resource to match
|
114
|
-
#
|
115
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
116
|
-
#
|
117
|
-
|
118
|
-
def disable_systemd_unit(resource_name)
|
119
|
-
ChefSpec::Matchers::ResourceMatcher.new(:systemd_unit, :disable, resource_name)
|
120
|
-
end
|
121
|
-
|
122
|
-
#
|
123
|
-
# Assert that a +systemd_unit+ resource exists in the Chef run with the
|
124
|
-
# action +:mask+. Given a Chef Recipe that masks the systemd_unit
|
125
|
-
# "sysstat-collect.timer":
|
126
|
-
#
|
127
|
-
# systemd_unit 'sysstat-collect.timer' do
|
128
|
-
# action :mask
|
129
|
-
# end
|
130
|
-
#
|
131
|
-
# The Examples section demonstrates the different ways to test a
|
132
|
-
# +systemd_unit+ resource with ChefSpec.
|
133
|
-
#
|
134
|
-
# @example Assert that a +systemd_unit+ was masked
|
135
|
-
# expect(chef_run).to mask_systemd_unit('sysstat-collect.timer')
|
136
|
-
#
|
137
|
-
# @example Assert that a +systemd_unit+ was _not_ masked
|
138
|
-
# expect(chef_run).to_not mask_systemd_unit('sysstat-collect.timer')
|
139
|
-
#
|
140
|
-
#
|
141
|
-
# @param [String, Regex] resource_name
|
142
|
-
# the name of the resource to match
|
143
|
-
#
|
144
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
145
|
-
#
|
146
|
-
|
147
|
-
def mask_systemd_unit(resource_name)
|
148
|
-
ChefSpec::Matchers::ResourceMatcher.new(:systemd_unit, :mask, resource_name)
|
149
|
-
end
|
150
|
-
|
151
|
-
#
|
152
|
-
# Assert that a +systemd_unit+ resource exists in the Chef run with the
|
153
|
-
# action +:unmask+. Given a Chef Recipe that masks the systemd_unit
|
154
|
-
# "sysstat-collect.timer":
|
155
|
-
#
|
156
|
-
# systemd_unit 'sysstat-collect.timer' do
|
157
|
-
# action :unmask
|
158
|
-
# end
|
159
|
-
#
|
160
|
-
# The Examples section demonstrates the different ways to test a
|
161
|
-
# +systemd_unit+ resource with ChefSpec.
|
162
|
-
#
|
163
|
-
# @example Assert that a +systemd_unit+ was unmasked
|
164
|
-
# expect(chef_run).to unmask_systemd_unit('sysstat-collect.timer')
|
165
|
-
#
|
166
|
-
# @example Assert that a +systemd_unit+ was _not_ unmasked
|
167
|
-
# expect(chef_run).to_not unmask_systemd_unit('sysstat-collect.timer')
|
168
|
-
#
|
169
|
-
#
|
170
|
-
# @param [String, Regex] resource_name
|
171
|
-
# the name of the resource to match
|
172
|
-
#
|
173
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
174
|
-
#
|
175
|
-
|
176
|
-
def unmask_systemd_unit(resource_name)
|
177
|
-
ChefSpec::Matchers::ResourceMatcher.new(:systemd_unit, :unmask, resource_name)
|
178
|
-
end
|
179
|
-
|
180
|
-
#
|
181
|
-
# Assert that a +systemd_unit+ resource exists in the Chef run with the
|
182
|
-
# action +:start+. Given a Chef Recipe that starts the systemd_unit
|
183
|
-
# "sysstat-collect.timer":
|
184
|
-
#
|
185
|
-
# systemd_unit 'sysstat-collect.timer' do
|
186
|
-
# action :start
|
187
|
-
# end
|
188
|
-
#
|
189
|
-
# The Examples section demonstrates the different ways to test a
|
190
|
-
# +systemd_unit+ resource with ChefSpec.
|
191
|
-
#
|
192
|
-
# @example Assert that a +systemd_unit+ was started
|
193
|
-
# expect(chef_run).to start_systemd_unit('sysstat-collect.timer')
|
194
|
-
#
|
195
|
-
# @example Assert that a +systemd_unit+ was _not_ started
|
196
|
-
# expect(chef_run).to_not start_systemd_unit('sysstat-collect.timer')
|
197
|
-
#
|
198
|
-
#
|
199
|
-
# @param [String, Regex] resource_name
|
200
|
-
# the name of the resource to match
|
201
|
-
#
|
202
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
203
|
-
#
|
204
|
-
|
205
|
-
def start_systemd_unit(resource_name)
|
206
|
-
ChefSpec::Matchers::ResourceMatcher.new(:systemd_unit, :start, resource_name)
|
207
|
-
end
|
208
|
-
|
209
|
-
#
|
210
|
-
# Assert that a +systemd_unit+ resource exists in the Chef run with the
|
211
|
-
# action +:stop+. Given a Chef Recipe that stops the systemd_unit
|
212
|
-
# "sysstat-collect.timer":
|
213
|
-
#
|
214
|
-
# systemd_unit 'sysstat-collect.timer' do
|
215
|
-
# action :stop
|
216
|
-
# end
|
217
|
-
#
|
218
|
-
# The Examples section demonstrates the different ways to test a
|
219
|
-
# +systemd_unit+ resource with ChefSpec.
|
220
|
-
#
|
221
|
-
# @example Assert that a +systemd_unit+ was stopped
|
222
|
-
# expect(chef_run).to stop_systemd_unit('sysstat-collect.timer')
|
223
|
-
#
|
224
|
-
# @example Assert that a +systemd_unit+ was _not_ stopped
|
225
|
-
# expect(chef_run).to_not stop_systemd_unit('sysstat-collect.timer')
|
226
|
-
#
|
227
|
-
#
|
228
|
-
# @param [String, Regex] resource_name
|
229
|
-
# the name of the resource to match
|
230
|
-
#
|
231
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
232
|
-
#
|
233
|
-
|
234
|
-
def stop_systemd_unit(resource_name)
|
235
|
-
ChefSpec::Matchers::ResourceMatcher.new(:systemd_unit, :stop, resource_name)
|
236
|
-
end
|
237
|
-
|
238
|
-
#
|
239
|
-
# Assert that a +systemd_unit+ resource exists in the Chef run with the
|
240
|
-
# action +:restart+. Given a Chef Recipe that restarts the systemd_unit
|
241
|
-
# "sysstat-collect.timer":
|
242
|
-
#
|
243
|
-
# systemd_unit 'sysstat-collect.timer' do
|
244
|
-
# action :restart
|
245
|
-
# end
|
246
|
-
#
|
247
|
-
# The Examples section demonstrates the different ways to test a
|
248
|
-
# +systemd_unit+ resource with ChefSpec.
|
249
|
-
#
|
250
|
-
# @example Assert that a +systemd_unit+ was restarted
|
251
|
-
# expect(chef_run).to restart_systemd_unit('sysstat-collect.timer')
|
252
|
-
#
|
253
|
-
# @example Assert that a +systemd_unit+ was _not_ restarted
|
254
|
-
# expect(chef_run).to_not restart_systemd_unit('sysstat-collect.timer')
|
255
|
-
#
|
256
|
-
#
|
257
|
-
# @param [String, Regex] resource_name
|
258
|
-
# the name of the resource to match
|
259
|
-
#
|
260
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
261
|
-
#
|
262
|
-
|
263
|
-
def restart_systemd_unit(resource_name)
|
264
|
-
ChefSpec::Matchers::ResourceMatcher.new(:systemd_unit, :restart, resource_name)
|
265
|
-
end
|
266
|
-
|
267
|
-
#
|
268
|
-
# Assert that a +systemd_unit+ resource exists in the Chef run with the
|
269
|
-
# action +:try_restart+. Given a Chef Recipe that tries to restarts the
|
270
|
-
# systemd_unit "sysstat-collect.timer":
|
271
|
-
#
|
272
|
-
# systemd_unit 'sysstat-collect.timer' do
|
273
|
-
# action :try_restart
|
274
|
-
# end
|
275
|
-
#
|
276
|
-
# The Examples section demonstrates the different ways to test a
|
277
|
-
# +systemd_unit+ resource with ChefSpec.
|
278
|
-
#
|
279
|
-
# @example Assert that a +systemd_unit+ was try_restart'd
|
280
|
-
# expect(chef_run).to try_restart_systemd_unit('sysstat-collect.timer')
|
281
|
-
#
|
282
|
-
# @example Assert that a +systemd_unit+ was _not_ try_restart'd
|
283
|
-
# expect(chef_run).to_not try_restart_systemd_unit('sysstat-collect.timer')
|
284
|
-
#
|
285
|
-
#
|
286
|
-
# @param [String, Regex] resource_name
|
287
|
-
# the name of the resource to match
|
288
|
-
#
|
289
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
290
|
-
#
|
291
|
-
|
292
|
-
def try_restart_systemd_unit(resource_name)
|
293
|
-
ChefSpec::Matchers::ResourceMatcher.new(:systemd_unit, :try_restart, resource_name)
|
294
|
-
end
|
295
|
-
|
296
|
-
#
|
297
|
-
# Assert that a +systemd_unit+ resource exists in the Chef run with the
|
298
|
-
# action +:reload_or_restart+. Given a Chef Recipe that reloads or restarts
|
299
|
-
# the systemd_unit "sysstat-collect.timer":
|
300
|
-
#
|
301
|
-
# systemd_unit 'sysstat-collect.timer' do
|
302
|
-
# action :reload_or_restart
|
303
|
-
# end
|
304
|
-
#
|
305
|
-
# The Examples section demonstrates the different ways to test a
|
306
|
-
# +systemd_unit+ resource with ChefSpec.
|
307
|
-
#
|
308
|
-
# @example Assert that a +systemd_unit+ was reloaded or restarted
|
309
|
-
# expect(chef_run).to reload_or_restart_systemd_unit('sysstat-collect.timer')
|
310
|
-
#
|
311
|
-
# @example Assert that a +systemd_unit+ was _not_ reloaded or restarted
|
312
|
-
# expect(chef_run).to_not reload_or_restart_systemd_unit('sysstat-collect.timer')
|
313
|
-
#
|
314
|
-
#
|
315
|
-
# @param [String, Regex] resource_name
|
316
|
-
# the name of the resource to match
|
317
|
-
#
|
318
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
319
|
-
#
|
320
|
-
|
321
|
-
def reload_or_restart_systemd_unit(resource_name)
|
322
|
-
ChefSpec::Matchers::ResourceMatcher.new(:systemd_unit, :reload_or_restart, resource_name)
|
323
|
-
end
|
324
|
-
#
|
325
|
-
# Assert that a +systemd_unit+ resource exists in the Chef run with the
|
326
|
-
# action +:reload_or_try_restart+. Given a Chef Recipe that reloads or attempts
|
327
|
-
# to restart the systemd_unit "sysstat-collect.timer":
|
328
|
-
#
|
329
|
-
# systemd_unit 'sysstat-collect.timer' do
|
330
|
-
# action :reload_or_try_restart
|
331
|
-
# end
|
332
|
-
#
|
333
|
-
# The Examples section demonstrates the different ways to test a
|
334
|
-
# +systemd_unit+ resource with ChefSpec.
|
335
|
-
#
|
336
|
-
# @example Assert that a +systemd_unit+ was reloaded or try restarted
|
337
|
-
# expect(chef_run).to reload_or_try_restart_systemd_unit('sysstat-collect.timer')
|
338
|
-
#
|
339
|
-
# @example Assert that a +systemd_unit+ was _not_ reloaded or try restarted
|
340
|
-
# expect(chef_run).to_not reload_or_try_restart_systemd_unit('sysstat-collect.timer')
|
341
|
-
#
|
342
|
-
#
|
343
|
-
# @param [String, Regex] resource_name
|
344
|
-
# the name of the resource to match
|
345
|
-
#
|
346
|
-
# @return [ChefSpec::Matchers::ResourceMatcher]
|
347
|
-
#
|
348
|
-
|
349
|
-
def reload_or_try_restart_systemd_unit(resource_name)
|
350
|
-
ChefSpec::Matchers::ResourceMatcher.new(:systemd_unit, :reload_or_try_restart, resource_name)
|
351
|
-
end
|
352
|
-
end
|
353
|
-
end
|