puppet 6.0.4-universal-darwin → 6.0.5-universal-darwin
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +15 -15
- data/Rakefile +3 -1
- data/ext/solaris/smf/svc-puppetd +8 -1
- data/ext/solaris/smf/svc-puppetmasterd +8 -1
- data/lib/puppet/application/device.rb +48 -32
- data/lib/puppet/application/ssl.rb +31 -17
- data/lib/puppet/defaults.rb +2 -1
- data/lib/puppet/face/config.rb +1 -1
- data/lib/puppet/forge.rb +4 -1
- data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +3 -1
- data/lib/puppet/pops/model/pn_transformer.rb +5 -0
- data/lib/puppet/pops/types/p_timespan_type.rb +2 -2
- data/lib/puppet/pops/types/string_converter.rb +11 -2
- data/lib/puppet/provider/package/dnf.rb +2 -1
- data/lib/puppet/provider/package/windows/exe_package.rb +13 -0
- data/lib/puppet/provider/package/windows/msi_package.rb +8 -0
- data/lib/puppet/provider/package/windows/package.rb +9 -1
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/parsedfile.rb +25 -4
- data/lib/puppet/provider/service/smf.rb +54 -0
- data/lib/puppet/provider/service/systemd.rb +2 -0
- data/lib/puppet/provider/service/upstart.rb +1 -0
- data/lib/puppet/rest/route.rb +1 -1
- data/lib/puppet/ssl/host.rb +23 -11
- data/lib/puppet/transaction.rb +4 -1
- data/lib/puppet/transaction/event_manager.rb +13 -1
- data/lib/puppet/transaction/resource_harness.rb +3 -1
- data/lib/puppet/util/command_line.rb +2 -3
- data/lib/puppet/util/filetype.rb +36 -4
- data/lib/puppet/util/selinux.rb +1 -1
- data/lib/puppet/util/windows/api_types.rb +1 -1
- data/lib/puppet/util/windows/registry.rb +29 -5
- data/lib/puppet/util/windows/service.rb +106 -99
- data/lib/puppet/version.rb +1 -1
- data/locales/ja/puppet.po +232 -183
- data/locales/puppet.pot +145 -117
- data/man/man5/puppet.conf.5 +3 -3
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-config.8 +2 -2
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +23 -19
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +6 -3
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/unit/provider/service/smf/svcs_fmri.out +6 -0
- data/spec/fixtures/unit/provider/service/smf/svcs_multiple_fmris.out +13 -0
- data/spec/integration/ssl/key_spec.rb +0 -4
- data/spec/integration/transaction_spec.rb +559 -0
- data/spec/integration/util/windows/registry_spec.rb +39 -0
- data/spec/unit/application/device_spec.rb +10 -7
- data/spec/unit/application/lookup_spec.rb +2 -1
- data/spec/unit/application/ssl_spec.rb +21 -2
- data/spec/unit/forge/forge_spec.rb +4 -2
- data/spec/unit/functions/logging_spec.rb +10 -3
- data/spec/unit/indirector/yaml_spec.rb +1 -1
- data/spec/unit/pops/loaders/loader_spec.rb +6 -7
- data/spec/unit/pops/model/pn_transformer_spec.rb +4 -0
- data/spec/unit/pops/types/p_timespan_type_spec.rb +22 -0
- data/spec/unit/pops/types/p_timestamp_type_spec.rb +19 -0
- data/spec/unit/pops/types/string_converter_spec.rb +20 -0
- data/spec/unit/provider/group/ldap_spec.rb +22 -25
- data/spec/unit/provider/group/pw_spec.rb +7 -10
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +97 -103
- data/spec/unit/provider/package/aix_spec.rb +5 -8
- data/spec/unit/provider/package/apt_spec.rb +3 -6
- data/spec/unit/provider/package/dnf_spec.rb +36 -37
- data/spec/unit/provider/package/dpkg_spec.rb +18 -21
- data/spec/unit/provider/package/freebsd_spec.rb +4 -7
- data/spec/unit/provider/package/gem_spec.rb +41 -41
- data/spec/unit/provider/package/hpux_spec.rb +7 -10
- data/spec/unit/provider/package/macports_spec.rb +13 -15
- data/spec/unit/provider/package/nim_spec.rb +3 -10
- data/spec/unit/provider/package/openbsd_spec.rb +14 -17
- data/spec/unit/provider/package/pip3_spec.rb +3 -6
- data/spec/unit/provider/package/pip_spec.rb +45 -49
- data/spec/unit/provider/package/pkgin_spec.rb +13 -18
- data/spec/unit/provider/package/pkgng_spec.rb +21 -24
- data/spec/unit/provider/package/puppet_gem_spec.rb +6 -9
- data/spec/unit/provider/package/tdnf_spec.rb +9 -12
- data/spec/unit/provider/package/yum_spec.rb +30 -16
- data/spec/unit/provider/package/zypper_spec.rb +17 -19
- data/spec/unit/provider/service/bsd_spec.rb +7 -9
- data/spec/unit/provider/service/daemontools_spec.rb +12 -16
- data/spec/unit/provider/service/debian_spec.rb +6 -10
- data/spec/unit/provider/service/freebsd_spec.rb +2 -2
- data/spec/unit/provider/service/openbsd_spec.rb +13 -17
- data/spec/unit/provider/service/rcng_spec.rb +2 -4
- data/spec/unit/provider/service/redhat_spec.rb +12 -11
- data/spec/unit/provider/service/runit_spec.rb +7 -14
- data/spec/unit/provider/service/smf_spec.rb +77 -13
- data/spec/unit/provider/service/src_spec.rb +11 -16
- data/spec/unit/provider/service/systemd_spec.rb +18 -0
- data/spec/unit/provider/user/hpux_spec.rb +3 -5
- data/spec/unit/provider/user/ldap_spec.rb +29 -32
- data/spec/unit/provider/user/pw_spec.rb +10 -13
- data/spec/unit/rest/route_spec.rb +1 -1
- data/spec/unit/ssl/host_spec.rb +21 -0
- data/spec/unit/ssl/key_spec.rb +2 -4
- data/spec/unit/transaction/event_manager_spec.rb +12 -1
- data/spec/unit/transaction/resource_harness_spec.rb +18 -0
- data/spec/unit/transaction_spec.rb +25 -0
- data/spec/unit/util/filetype_spec.rb +13 -5
- data/spec/unit/util/logging_spec.rb +0 -41
- data/spec/unit/util/monkey_patches_spec.rb +18 -5
- data/spec/unit/util/selinux_spec.rb +4 -0
- metadata +8 -2
@@ -1,9 +1,6 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
describe provider_class do
|
3
|
+
describe Puppet::Type.type(:package).provider(:puppet_gem) do
|
7
4
|
let(:resource) do
|
8
5
|
Puppet::Type.type(:package).new(
|
9
6
|
:name => 'myresource',
|
@@ -12,7 +9,7 @@ describe provider_class do
|
|
12
9
|
end
|
13
10
|
|
14
11
|
let(:provider) do
|
15
|
-
provider =
|
12
|
+
provider = described_class.new
|
16
13
|
provider.resource = resource
|
17
14
|
provider
|
18
15
|
end
|
@@ -27,9 +24,9 @@ describe provider_class do
|
|
27
24
|
resource.provider = provider
|
28
25
|
end
|
29
26
|
|
30
|
-
|
27
|
+
context "when installing" do
|
31
28
|
it "should use the path to the gem" do
|
32
|
-
|
29
|
+
described_class.expects(:which).with(puppet_gem).returns(puppet_gem)
|
33
30
|
provider.expects(:execute).with { |args| args[0] == puppet_gem }.returns ''
|
34
31
|
provider.install
|
35
32
|
end
|
@@ -46,9 +43,9 @@ describe provider_class do
|
|
46
43
|
end
|
47
44
|
end
|
48
45
|
|
49
|
-
|
46
|
+
context "when uninstalling" do
|
50
47
|
it "should use the path to the gem" do
|
51
|
-
|
48
|
+
described_class.expects(:which).with(puppet_gem).returns(puppet_gem)
|
52
49
|
provider.expects(:execute).with { |args| args[0] == puppet_gem }.returns ''
|
53
50
|
provider.install
|
54
51
|
end
|
@@ -2,17 +2,14 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
# Note that much of the functionality of the tdnf provider is already tested with yum provider tests,
|
4
4
|
# as yum is the parent provider, via dnf
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
context 'default' do
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
describe Puppet::Type.type(:package).provider(:tdnf) do
|
6
|
+
it_behaves_like 'RHEL package provider', described_class, 'tdnf'
|
7
|
+
|
8
|
+
context 'default' do
|
9
|
+
it 'should be the default provider on PhotonOS' do
|
10
|
+
Facter.stubs(:value).with(:osfamily).returns(:redhat)
|
11
|
+
Facter.stubs(:value).with(:operatingsystem).returns("PhotonOS")
|
12
|
+
expect(described_class).to be_default
|
13
|
+
end
|
13
14
|
end
|
14
15
|
end
|
15
|
-
|
16
|
-
describe provider_class do
|
17
|
-
it_behaves_like 'RHEL package provider', provider_class, 'tdnf'
|
18
|
-
end
|
@@ -1,17 +1,15 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
describe provider_class do
|
3
|
+
describe Puppet::Type.type(:package).provider(:yum) do
|
7
4
|
include PuppetSpec::Fixtures
|
8
|
-
|
5
|
+
|
6
|
+
it_behaves_like 'RHEL package provider', described_class, 'yum'
|
9
7
|
|
10
8
|
it "should have lower specificity" do
|
11
9
|
Facter.stubs(:value).with(:osfamily).returns(:redhat)
|
12
10
|
Facter.stubs(:value).with(:operatingsystem).returns(:fedora)
|
13
11
|
Facter.stubs(:value).with(:operatingsystemmajrelease).returns("22")
|
14
|
-
expect(
|
12
|
+
expect(described_class.specificity).to be < 200
|
15
13
|
end
|
16
14
|
|
17
15
|
describe "when supplied the source param" do
|
@@ -25,12 +23,12 @@ describe provider_class do
|
|
25
23
|
end
|
26
24
|
|
27
25
|
let(:provider) do
|
28
|
-
provider =
|
26
|
+
provider = described_class.new
|
29
27
|
provider.resource = resource
|
30
28
|
provider
|
31
29
|
end
|
32
30
|
|
33
|
-
before {
|
31
|
+
before { described_class.stubs(:command).with(:cmd).returns("/usr/bin/yum") }
|
34
32
|
|
35
33
|
context "when installing" do
|
36
34
|
it "should use the supplied source as the explicit path to a package to install" do
|
@@ -58,16 +56,18 @@ describe provider_class do
|
|
58
56
|
end
|
59
57
|
end
|
60
58
|
|
61
|
-
|
62
|
-
|
59
|
+
context "parsing the output of check-update" do
|
60
|
+
context "with no multiline entries" do
|
63
61
|
let(:check_update) { File.read(my_fixture("yum-check-update-simple.txt")) }
|
64
62
|
let(:output) { described_class.parse_updates(check_update) }
|
63
|
+
|
65
64
|
it 'creates an entry for each package keyed on the package name' do
|
66
65
|
expect(output['curl']).to eq([{:name => 'curl', :epoch => '0', :version => '7.32.0', :release => '10.fc20', :arch => 'i686'}, {:name => 'curl', :epoch => '0', :version => '7.32.0', :release => '10.fc20', :arch => 'x86_64'}])
|
67
66
|
expect(output['gawk']).to eq([{:name => 'gawk', :epoch => '0', :version => '4.1.0', :release => '3.fc20', :arch => 'i686'}])
|
68
67
|
expect(output['dhclient']).to eq([{:name => 'dhclient', :epoch => '12', :version => '4.1.1', :release => '38.P1.fc20', :arch => 'i686'}])
|
69
68
|
expect(output['selinux-policy']).to eq([{:name => 'selinux-policy', :epoch => '0', :version => '3.12.1', :release => '163.fc20', :arch => 'noarch'}])
|
70
69
|
end
|
70
|
+
|
71
71
|
it 'creates an entry for each package keyed on the package name and package architecture' do
|
72
72
|
expect(output['curl.i686']).to eq([{:name => 'curl', :epoch => '0', :version => '7.32.0', :release => '10.fc20', :arch => 'i686'}])
|
73
73
|
expect(output['curl.x86_64']).to eq([{:name => 'curl', :epoch => '0', :version => '7.32.0', :release => '10.fc20', :arch => 'x86_64'}])
|
@@ -77,55 +77,69 @@ describe provider_class do
|
|
77
77
|
expect(output['java-1.8.0-openjdk.x86_64']).to eq([{:name => 'java-1.8.0-openjdk', :epoch => '1', :version => '1.8.0.131', :release => '2.b11.el7_3', :arch => 'x86_64'}])
|
78
78
|
end
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
|
+
context "with multiline entries" do
|
81
82
|
let(:check_update) { File.read(my_fixture("yum-check-update-multiline.txt")) }
|
82
83
|
let(:output) { described_class.parse_updates(check_update) }
|
84
|
+
|
83
85
|
it "parses multi-line values as a single package tuple" do
|
84
86
|
expect(output['libpcap']).to eq([{:name => 'libpcap', :epoch => '14', :version => '1.4.0', :release => '1.20130826git2dbcaa1.el6', :arch => 'x86_64'}])
|
85
87
|
end
|
86
88
|
end
|
87
|
-
|
89
|
+
|
90
|
+
context "with obsoleted packages" do
|
88
91
|
let(:check_update) { File.read(my_fixture("yum-check-update-obsoletes.txt")) }
|
89
92
|
let(:output) { described_class.parse_updates(check_update) }
|
93
|
+
|
90
94
|
it "ignores all entries including and after 'Obsoleting Packages'" do
|
91
95
|
expect(output).not_to include("Obsoleting")
|
92
96
|
expect(output).not_to include("NetworkManager-bluetooth.x86_64")
|
93
97
|
expect(output).not_to include("1:1.0.0-14.git20150121.b4ea599c.el7")
|
94
98
|
end
|
95
99
|
end
|
96
|
-
|
100
|
+
|
101
|
+
context "with security notifications" do
|
97
102
|
let(:check_update) { File.read(my_fixture("yum-check-update-security.txt")) }
|
98
103
|
let(:output) { described_class.parse_updates(check_update) }
|
104
|
+
|
99
105
|
it "ignores all entries including and after 'Security'" do
|
100
106
|
expect(output).not_to include("Security")
|
101
107
|
end
|
108
|
+
|
102
109
|
it "includes updates before 'Security'" do
|
103
110
|
expect(output).to include("yum-plugin-fastestmirror.noarch")
|
104
111
|
end
|
105
112
|
end
|
106
|
-
|
113
|
+
|
114
|
+
context "with broken update notices" do
|
107
115
|
let(:check_update) { File.read(my_fixture("yum-check-update-broken-notices.txt")) }
|
108
116
|
let(:output) { described_class.parse_updates(check_update) }
|
117
|
+
|
109
118
|
it "ignores all entries including and after 'Update'" do
|
110
119
|
expect(output).not_to include("Update")
|
111
120
|
end
|
121
|
+
|
112
122
|
it "includes updates before 'Update'" do
|
113
123
|
expect(output).to include("yum-plugin-fastestmirror.noarch")
|
114
124
|
end
|
115
125
|
end
|
116
|
-
|
126
|
+
|
127
|
+
context "with improper package names in output" do
|
117
128
|
it "raises an exception parsing package name" do
|
118
129
|
expect {
|
119
130
|
described_class.update_to_hash('badpackagename', '1')
|
120
131
|
}.to raise_exception(Exception, /Failed to parse/)
|
121
132
|
end
|
122
133
|
end
|
123
|
-
|
134
|
+
|
135
|
+
context "with trailing plugin output" do
|
124
136
|
let(:check_update) { File.read(my_fixture("yum-check-update-plugin-output.txt")) }
|
125
137
|
let(:output) { described_class.parse_updates(check_update) }
|
138
|
+
|
126
139
|
it "parses correctly formatted entries" do
|
127
140
|
expect(output['bash']).to eq([{:name => 'bash', :epoch => '0', :version => '4.2.46', :release => '12.el7', :arch => 'x86_64'}])
|
128
141
|
end
|
142
|
+
|
129
143
|
it "ignores all mentions of plugin output" do
|
130
144
|
expect(output).not_to include("Random plugin")
|
131
145
|
end
|
@@ -1,9 +1,6 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
describe provider_class do
|
3
|
+
describe Puppet::Type.type(:package).provider(:zypper) do
|
7
4
|
before(:each) do
|
8
5
|
# Create a mock resource
|
9
6
|
@resource = stub 'resource'
|
@@ -16,35 +13,35 @@ describe provider_class do
|
|
16
13
|
@resource.stubs(:[]).with(:ensure).returns :installed
|
17
14
|
@resource.stubs(:command).with(:zypper).returns "/usr/bin/zypper"
|
18
15
|
|
19
|
-
@provider =
|
16
|
+
@provider = described_class.new(@resource)
|
20
17
|
end
|
21
18
|
|
22
19
|
it "should have an install method" do
|
23
|
-
@provider =
|
20
|
+
@provider = described_class.new
|
24
21
|
expect(@provider).to respond_to(:install)
|
25
22
|
end
|
26
23
|
|
27
24
|
it "should have an uninstall method" do
|
28
|
-
@provider =
|
25
|
+
@provider = described_class.new
|
29
26
|
expect(@provider).to respond_to(:uninstall)
|
30
27
|
end
|
31
28
|
|
32
29
|
it "should have an update method" do
|
33
|
-
@provider =
|
30
|
+
@provider = described_class.new
|
34
31
|
expect(@provider).to respond_to(:update)
|
35
32
|
end
|
36
33
|
|
37
34
|
it "should have a latest method" do
|
38
|
-
@provider =
|
35
|
+
@provider = described_class.new
|
39
36
|
expect(@provider).to respond_to(:latest)
|
40
37
|
end
|
41
38
|
|
42
39
|
it "should have a install_options method" do
|
43
|
-
@provider =
|
40
|
+
@provider = described_class.new
|
44
41
|
expect(@provider).to respond_to(:install_options)
|
45
42
|
end
|
46
43
|
|
47
|
-
|
44
|
+
context "when installing with zypper version >= 1.0" do
|
48
45
|
it "should use a command-line with versioned package'" do
|
49
46
|
@resource.stubs(:should).with(:ensure).returns "1.2.3-4.5.6"
|
50
47
|
@resource.stubs(:allow_virtual?).returns false
|
@@ -65,7 +62,7 @@ describe provider_class do
|
|
65
62
|
end
|
66
63
|
end
|
67
64
|
|
68
|
-
|
65
|
+
context "when installing with zypper version = 0.6.104" do
|
69
66
|
it "should use a command-line with versioned package'" do
|
70
67
|
@resource.stubs(:should).with(:ensure).returns "1.2.3-4.5.6"
|
71
68
|
@resource.stubs(:allow_virtual?).returns false
|
@@ -86,7 +83,7 @@ describe provider_class do
|
|
86
83
|
end
|
87
84
|
end
|
88
85
|
|
89
|
-
|
86
|
+
context "when installing with zypper version = 0.6.13" do
|
90
87
|
it "should use a command-line with versioned package'" do
|
91
88
|
@resource.stubs(:should).with(:ensure).returns "1.2.3-4.5.6"
|
92
89
|
@resource.stubs(:allow_virtual?).returns false
|
@@ -107,15 +104,16 @@ describe provider_class do
|
|
107
104
|
end
|
108
105
|
end
|
109
106
|
|
110
|
-
|
107
|
+
context "when updating" do
|
111
108
|
it "should call install method of instance" do
|
112
109
|
@provider.expects(:install)
|
113
110
|
@provider.update
|
114
111
|
end
|
115
112
|
end
|
116
113
|
|
117
|
-
|
118
|
-
after
|
114
|
+
context "when getting latest version" do
|
115
|
+
after { described_class.reset! }
|
116
|
+
|
119
117
|
context "when the package has available update" do
|
120
118
|
it "should return a version string with valid list-updates data from SLES11sp1" do
|
121
119
|
fake_data = File.read(my_fixture('zypper-list-updates-SLES11sp1.out'))
|
@@ -144,7 +142,7 @@ describe provider_class do
|
|
144
142
|
end
|
145
143
|
end
|
146
144
|
|
147
|
-
|
145
|
+
context "should install a virtual package" do
|
148
146
|
it "when zypper version = 0.6.13" do
|
149
147
|
@resource.stubs(:should).with(:ensure).returns :installed
|
150
148
|
@resource.stubs(:allow_virtual?).returns true
|
@@ -164,7 +162,7 @@ describe provider_class do
|
|
164
162
|
end
|
165
163
|
end
|
166
164
|
|
167
|
-
|
165
|
+
context "when installing with zypper install options" do
|
168
166
|
it "should install the package without checking keys" do
|
169
167
|
@resource.stubs(:[]).with(:name).returns "php5"
|
170
168
|
@resource.stubs(:[]).with(:install_options).returns ['--no-gpg-check', {'-p' => '/vagrant/files/localrepo/'}]
|
@@ -215,7 +213,7 @@ describe provider_class do
|
|
215
213
|
end
|
216
214
|
end
|
217
215
|
|
218
|
-
|
216
|
+
context 'when uninstalling' do
|
219
217
|
it 'should use remove to uninstall on zypper version 1.6 and above' do
|
220
218
|
@provider.stubs(:zypper_version).returns '1.6.308'
|
221
219
|
@provider.expects(:zypper).with(:remove, '--no-confirm', 'mypackage')
|
@@ -1,11 +1,9 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'spec_helper'
|
4
2
|
|
5
3
|
describe 'Puppet::Type::Service::Provider::Bsd',
|
6
4
|
:unless => Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do
|
7
|
-
|
8
5
|
let(:provider_class) { Puppet::Type.type(:service).provider(:bsd) }
|
6
|
+
|
9
7
|
before :each do
|
10
8
|
Puppet::Type.type(:service).stubs(:defaultprovider).returns provider_class
|
11
9
|
Facter.stubs(:value).with(:operatingsystem).returns :netbsd
|
@@ -15,7 +13,7 @@ describe 'Puppet::Type::Service::Provider::Bsd',
|
|
15
13
|
@provider.stubs(:initscript)
|
16
14
|
end
|
17
15
|
|
18
|
-
|
16
|
+
context "#instances" do
|
19
17
|
it "should have an instances method" do
|
20
18
|
expect(provider_class).to respond_to :instances
|
21
19
|
end
|
@@ -25,7 +23,7 @@ describe 'Puppet::Type::Service::Provider::Bsd',
|
|
25
23
|
end
|
26
24
|
end
|
27
25
|
|
28
|
-
|
26
|
+
context "#disable" do
|
29
27
|
it "should have a disable method" do
|
30
28
|
expect(@provider).to respond_to(:disable)
|
31
29
|
end
|
@@ -46,7 +44,7 @@ describe 'Puppet::Type::Service::Provider::Bsd',
|
|
46
44
|
end
|
47
45
|
end
|
48
46
|
|
49
|
-
|
47
|
+
context "#enable" do
|
50
48
|
it "should have an enable method" do
|
51
49
|
expect(@provider).to respond_to(:enable)
|
52
50
|
end
|
@@ -71,7 +69,7 @@ describe 'Puppet::Type::Service::Provider::Bsd',
|
|
71
69
|
end
|
72
70
|
end
|
73
71
|
|
74
|
-
|
72
|
+
context "#enabled?" do
|
75
73
|
it "should have an enabled? method" do
|
76
74
|
expect(@provider).to respond_to(:enabled?)
|
77
75
|
end
|
@@ -91,7 +89,7 @@ describe 'Puppet::Type::Service::Provider::Bsd',
|
|
91
89
|
end
|
92
90
|
end
|
93
91
|
|
94
|
-
|
92
|
+
context "#startcmd" do
|
95
93
|
it "should have a startcmd method" do
|
96
94
|
expect(@provider).to respond_to(:startcmd)
|
97
95
|
end
|
@@ -110,7 +108,7 @@ describe 'Puppet::Type::Service::Provider::Bsd',
|
|
110
108
|
end
|
111
109
|
end
|
112
110
|
|
113
|
-
|
111
|
+
context "#stopcmd" do
|
114
112
|
it "should have a stopcmd method" do
|
115
113
|
expect(@provider).to respond_to(:stopcmd)
|
116
114
|
end
|
@@ -1,12 +1,7 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# Unit testing for the Daemontools service Provider
|
4
|
-
#
|
5
|
-
# author Brice Figureau
|
6
|
-
#
|
7
1
|
require 'spec_helper'
|
8
2
|
|
9
|
-
describe 'Puppet::Type::Service::Provider::Daemontools',
|
3
|
+
describe 'Puppet::Type::Service::Provider::Daemontools',
|
4
|
+
unless: Puppet::Util::Platform.jruby? do
|
10
5
|
let(:provider_class) { Puppet::Type.type(:service).provider(:daemontools) }
|
11
6
|
|
12
7
|
before(:each) do
|
@@ -62,7 +57,7 @@ describe 'Puppet::Type::Service::Provider::Daemontools', unless: Puppet::Util::P
|
|
62
57
|
expect(@provider).to respond_to(:disable)
|
63
58
|
end
|
64
59
|
|
65
|
-
|
60
|
+
context "when starting" do
|
66
61
|
it "should use 'svc' to start the service" do
|
67
62
|
@provider.stubs(:enabled?).returns :true
|
68
63
|
@provider.expects(:svc).with("-u", "/etc/service/myservice")
|
@@ -80,7 +75,7 @@ describe 'Puppet::Type::Service::Provider::Daemontools', unless: Puppet::Util::P
|
|
80
75
|
end
|
81
76
|
end
|
82
77
|
|
83
|
-
|
78
|
+
context "when stopping" do
|
84
79
|
it "should use 'svc' to stop the service" do
|
85
80
|
@provider.stubs(:disable)
|
86
81
|
@provider.expects(:svc).with("-d", "/etc/service/myservice")
|
@@ -89,7 +84,7 @@ describe 'Puppet::Type::Service::Provider::Daemontools', unless: Puppet::Util::P
|
|
89
84
|
end
|
90
85
|
end
|
91
86
|
|
92
|
-
|
87
|
+
context "when restarting" do
|
93
88
|
it "should use 'svc' to restart the service" do
|
94
89
|
@provider.expects(:svc).with("-t", "/etc/service/myservice")
|
95
90
|
|
@@ -97,7 +92,7 @@ describe 'Puppet::Type::Service::Provider::Daemontools', unless: Puppet::Util::P
|
|
97
92
|
end
|
98
93
|
end
|
99
94
|
|
100
|
-
|
95
|
+
context "when enabling" do
|
101
96
|
it "should create a symlink between daemon dir and service dir", :if => Puppet.features.manages_symlinks? do
|
102
97
|
daemon_path = File.join(@daemondir, "myservice")
|
103
98
|
service_path = File.join(@servicedir, "myservice")
|
@@ -108,7 +103,7 @@ describe 'Puppet::Type::Service::Provider::Daemontools', unless: Puppet::Util::P
|
|
108
103
|
end
|
109
104
|
end
|
110
105
|
|
111
|
-
|
106
|
+
context "when disabling" do
|
112
107
|
it "should remove the symlink between daemon dir and service dir" do
|
113
108
|
FileTest.stubs(:directory?).returns(false)
|
114
109
|
path = File.join(@servicedir,"myservice")
|
@@ -127,7 +122,7 @@ describe 'Puppet::Type::Service::Provider::Daemontools', unless: Puppet::Util::P
|
|
127
122
|
end
|
128
123
|
end
|
129
124
|
|
130
|
-
|
125
|
+
context "when checking if the service is enabled?" do
|
131
126
|
it "should return true if it is running" do
|
132
127
|
@provider.stubs(:status).returns(:running)
|
133
128
|
|
@@ -145,26 +140,27 @@ describe 'Puppet::Type::Service::Provider::Daemontools', unless: Puppet::Util::P
|
|
145
140
|
end
|
146
141
|
end
|
147
142
|
|
148
|
-
|
143
|
+
context "when checking status" do
|
149
144
|
it "should call the external command 'svstat /etc/service/myservice'" do
|
150
145
|
@provider.expects(:svstat).with(File.join(@servicedir,"myservice"))
|
151
146
|
@provider.status
|
152
147
|
end
|
153
148
|
end
|
154
149
|
|
155
|
-
|
150
|
+
context "when checking status" do
|
156
151
|
it "and svstat fails, properly raise a Puppet::Error" do
|
157
152
|
@provider.expects(:svstat).with(File.join(@servicedir,"myservice")).raises(Puppet::ExecutionFailure, "failure")
|
158
153
|
expect { @provider.status }.to raise_error(Puppet::Error, 'Could not get status for service Service[myservice]: failure')
|
159
154
|
end
|
155
|
+
|
160
156
|
it "and svstat returns up, then return :running" do
|
161
157
|
@provider.expects(:svstat).with(File.join(@servicedir,"myservice")).returns("/etc/service/myservice: up (pid 454) 954326 seconds")
|
162
158
|
expect(@provider.status).to eq(:running)
|
163
159
|
end
|
160
|
+
|
164
161
|
it "and svstat returns not running, then return :stopped" do
|
165
162
|
@provider.expects(:svstat).with(File.join(@servicedir,"myservice")).returns("/etc/service/myservice: supervise not running")
|
166
163
|
expect(@provider.status).to eq(:stopped)
|
167
164
|
end
|
168
165
|
end
|
169
|
-
|
170
166
|
end
|