puppet 2.6.2 → 2.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +61 -0
- data/ext/envpuppet +80 -0
- data/ext/puppet-load.rb +62 -26
- data/ext/puppetstoredconfigclean.rb +0 -2
- data/lib/puppet.rb +1 -1
- data/lib/puppet/daemon.rb +2 -2
- data/lib/puppet/defaults.rb +10 -8
- data/lib/puppet/external/pson/pure/generator.rb +5 -12
- data/lib/puppet/indirector/catalog/compiler.rb +8 -4
- data/lib/puppet/network/handler/fileserver.rb +2 -0
- data/lib/puppet/network/server.rb +2 -2
- data/lib/puppet/node/environment.rb +4 -0
- data/lib/puppet/parser/ast/collection.rb +34 -51
- data/lib/puppet/parser/ast/leaf.rb +10 -2
- data/lib/puppet/parser/ast/resource.rb +4 -3
- data/lib/puppet/parser/compiler.rb +2 -2
- data/lib/puppet/parser/functions.rb +4 -2
- data/lib/puppet/parser/lexer.rb +2 -1
- data/lib/puppet/parser/parser_support.rb +3 -3
- data/lib/puppet/provider.rb +2 -2
- data/lib/puppet/provider/confine/exists.rb +1 -4
- data/lib/puppet/provider/mount.rb +1 -1
- data/lib/puppet/provider/nameservice.rb +3 -1
- data/lib/puppet/provider/package/openbsd.rb +6 -10
- data/lib/puppet/provider/service/freebsd.rb +4 -1
- data/lib/puppet/provider/service/launchd.rb +1 -1
- data/lib/puppet/provider/user/user_role_add.rb +8 -6
- data/lib/puppet/provider/user/useradd.rb +7 -8
- data/lib/puppet/rails.rb +2 -6
- data/lib/puppet/rails/host.rb +0 -72
- data/lib/puppet/resource.rb +22 -0
- data/lib/puppet/resource/type.rb +18 -13
- data/lib/puppet/type/exec.rb +1 -7
- data/lib/puppet/type/schedule.rb +5 -5
- data/lib/puppet/util.rb +20 -18
- data/lib/puppet/util/command_line.rb +1 -1
- data/lib/puppet/util/file_locking.rb +6 -3
- data/lib/puppet/util/metric.rb +1 -1
- data/lib/puppet/util/rdoc.rb +5 -4
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +6 -0
- data/lib/puppet/util/reference.rb +1 -10
- data/lib/puppet/util/suidmanager.rb +1 -1
- data/lib/puppet/util/zaml.rb +4 -1
- data/spec/integration/indirector/bucket_file/rest_spec.rb +10 -2
- data/spec/integration/indirector/certificate_revocation_list/rest_spec.rb +10 -2
- data/spec/integration/parser/functions_spec.rb +21 -0
- data/spec/integration/parser/ruby_manifest_spec.rb +1 -1
- data/spec/integration/ssl/certificate_authority_spec.rb +1 -3
- data/spec/integration/util/file_locking_spec.rb +31 -11
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/application/apply_spec.rb +1 -1
- data/spec/unit/daemon_spec.rb +3 -9
- data/spec/unit/indirector/catalog/compiler_spec.rb +9 -8
- data/spec/unit/network/handler/fileserver_spec.rb +2 -4
- data/spec/unit/network/server_spec.rb +3 -10
- data/spec/unit/parser/ast/collection_spec.rb +4 -0
- data/spec/unit/parser/ast/leaf_spec.rb +43 -1
- data/spec/unit/parser/ast/resource_spec.rb +133 -88
- data/spec/unit/parser/compiler_spec.rb +8 -8
- data/spec/unit/parser/lexer_spec.rb +1 -0
- data/spec/unit/parser/parser_spec.rb +9 -2
- data/spec/unit/provider/confine/exists_spec.rb +6 -13
- data/spec/unit/provider/mount_spec.rb +8 -1
- data/spec/unit/provider/service/freebsd_spec.rb +50 -0
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +1 -2
- data/spec/unit/provider/user/user_role_add_spec.rb +1 -1
- data/spec/unit/provider/user/useradd_spec.rb +42 -0
- data/spec/unit/rails_spec.rb +82 -22
- data/spec/unit/resource/type_spec.rb +13 -13
- data/spec/unit/type/schedule_spec.rb +21 -49
- data/spec/unit/util/command_line_spec.rb +2 -2
- data/spec/unit/util/file_locking_spec.rb +28 -24
- data/spec/unit/util/{json_spec.rb → pson_spec.rb} +17 -0
- data/spec/unit/util/rdoc_spec.rb +9 -1
- data/spec/unit/util/storage_spec.rb +2 -3
- data/test/other/provider.rb +1 -12
- data/test/other/report.rb +2 -5
- data/test/puppet/tc_suidmanager.rb +5 -14
- data/test/ral/manager/type.rb +1 -1
- data/test/ral/providers/provider.rb +3 -3
- data/test/util/metrics.rb +2 -2
- metadata +8 -6
- data/spec/integration/indirector/rest_spec.rb +0 -525
|
@@ -580,7 +580,7 @@ describe Puppet::Parser::Compiler do
|
|
|
580
580
|
it "should evaluate each class" do
|
|
581
581
|
@compiler.catalog.stubs(:tag)
|
|
582
582
|
|
|
583
|
-
@class.expects(:
|
|
583
|
+
@class.expects(:ensure_in_catalog).with(@scope)
|
|
584
584
|
@scope.stubs(:class_scope).with(@class)
|
|
585
585
|
|
|
586
586
|
@compiler.evaluate_classes(%w{myclass}, @scope)
|
|
@@ -591,7 +591,7 @@ describe Puppet::Parser::Compiler do
|
|
|
591
591
|
|
|
592
592
|
@resource.expects(:evaluate).never
|
|
593
593
|
|
|
594
|
-
@class.expects(:
|
|
594
|
+
@class.expects(:ensure_in_catalog).returns(@resource)
|
|
595
595
|
@scope.stubs(:class_scope).with(@class)
|
|
596
596
|
|
|
597
597
|
@compiler.evaluate_classes(%w{myclass}, @scope)
|
|
@@ -601,7 +601,7 @@ describe Puppet::Parser::Compiler do
|
|
|
601
601
|
@compiler.catalog.stubs(:tag)
|
|
602
602
|
|
|
603
603
|
@resource.expects(:evaluate)
|
|
604
|
-
@class.expects(:
|
|
604
|
+
@class.expects(:ensure_in_catalog).returns(@resource)
|
|
605
605
|
@scope.stubs(:class_scope).with(@class)
|
|
606
606
|
|
|
607
607
|
@compiler.evaluate_classes(%w{myclass}, @scope, false)
|
|
@@ -638,7 +638,7 @@ describe Puppet::Parser::Compiler do
|
|
|
638
638
|
@scope.stubs(:class_scope).with(@class)
|
|
639
639
|
|
|
640
640
|
Puppet::Parser::Resource.stubs(:new).returns(@resource)
|
|
641
|
-
@class.stubs :
|
|
641
|
+
@class.stubs :ensure_in_catalog
|
|
642
642
|
@compiler.evaluate_classes(%w{myclass notfound}, @scope).should == %w{myclass}
|
|
643
643
|
end
|
|
644
644
|
end
|
|
@@ -678,7 +678,7 @@ describe Puppet::Parser::Compiler do
|
|
|
678
678
|
@compiler.known_resource_types.stubs(:node).with("c").returns(node_class)
|
|
679
679
|
|
|
680
680
|
node_resource = stub 'node resource', :ref => "Node[c]", :evaluate => nil, :type => "node"
|
|
681
|
-
node_class.expects(:
|
|
681
|
+
node_class.expects(:ensure_in_catalog).returns(node_resource)
|
|
682
682
|
|
|
683
683
|
@compiler.compile
|
|
684
684
|
end
|
|
@@ -688,7 +688,7 @@ describe Puppet::Parser::Compiler do
|
|
|
688
688
|
@compiler.known_resource_types.stubs(:node).with("default").returns(node_class)
|
|
689
689
|
|
|
690
690
|
node_resource = stub 'node resource', :ref => "Node[default]", :evaluate => nil, :type => "node"
|
|
691
|
-
node_class.expects(:
|
|
691
|
+
node_class.expects(:ensure_in_catalog).returns(node_resource)
|
|
692
692
|
|
|
693
693
|
@compiler.compile
|
|
694
694
|
end
|
|
@@ -698,7 +698,7 @@ describe Puppet::Parser::Compiler do
|
|
|
698
698
|
@compiler.known_resource_types.stubs(:node).with("c").returns(node_class)
|
|
699
699
|
|
|
700
700
|
node_resource = stub 'node resource', :ref => "Node[c]", :type => "node"
|
|
701
|
-
node_class.expects(:
|
|
701
|
+
node_class.expects(:ensure_in_catalog).returns(node_resource)
|
|
702
702
|
|
|
703
703
|
node_resource.expects(:evaluate)
|
|
704
704
|
|
|
@@ -707,7 +707,7 @@ describe Puppet::Parser::Compiler do
|
|
|
707
707
|
|
|
708
708
|
it "should set the node's scope as the top scope" do
|
|
709
709
|
node_resource = stub 'node resource', :ref => "Node[c]", :evaluate => nil, :type => "node"
|
|
710
|
-
node_class = stub 'node', :name => "c", :
|
|
710
|
+
node_class = stub 'node', :name => "c", :ensure_in_catalog => node_resource
|
|
711
711
|
|
|
712
712
|
@compiler.known_resource_types.stubs(:node).with("c").returns(node_class)
|
|
713
713
|
|
|
@@ -424,6 +424,7 @@ describe Puppet::Parser::Lexer,"when lexing strings" do
|
|
|
424
424
|
%q{'single quoted string with an escaped "\\\\"'} => [[:STRING,'single quoted string with an escaped "\\\\"']],
|
|
425
425
|
%q{"string with an escaped '\\"'"} => [[:STRING,"string with an escaped '\"'"]],
|
|
426
426
|
%q{"string with an escaped '\\$'"} => [[:STRING,"string with an escaped '$'"]],
|
|
427
|
+
%Q{"string with a line ending with a backslash: \\\nfoo"} => [[:STRING,"string with a line ending with a backslash: foo"]],
|
|
427
428
|
%q{"string with $v (but no braces)"} => [[:DQPRE,"string with "],[:VARIABLE,'v'],[:DQPOST,' (but no braces)']],
|
|
428
429
|
%q["string with ${v} in braces"] => [[:DQPRE,"string with "],[:VARIABLE,'v'],[:DQPOST,' in braces']],
|
|
429
430
|
%q["string with ${qualified::var} in braces"] => [[:DQPRE,"string with "],[:VARIABLE,'qualified::var'],[:DQPOST,' in braces']],
|
|
@@ -269,16 +269,23 @@ describe Puppet::Parser do
|
|
|
269
269
|
|
|
270
270
|
it "should prefer provided options over AST context" do
|
|
271
271
|
@class.expects(:new).with { |opts| opts[:file] == "/bar" }
|
|
272
|
-
@
|
|
272
|
+
@lexer.expects(:file).returns "/foo"
|
|
273
273
|
@parser.ast(@class, :file => "/bar")
|
|
274
274
|
end
|
|
275
275
|
|
|
276
276
|
it "should include docs when the AST class uses them" do
|
|
277
277
|
@class.expects(:use_docs).returns true
|
|
278
278
|
@class.stubs(:new)
|
|
279
|
-
@parser.expects(:ast_context).with
|
|
279
|
+
@parser.expects(:ast_context).with{ |a| a[0] == true }.returns({})
|
|
280
280
|
@parser.ast(@class, :file => "/bar")
|
|
281
281
|
end
|
|
282
|
+
|
|
283
|
+
it "should get docs from lexer using the correct AST line number" do
|
|
284
|
+
@class.expects(:use_docs).returns true
|
|
285
|
+
@class.stubs(:new).with{ |a| a[:doc] == "doc" }
|
|
286
|
+
@lexer.expects(:getcomment).with(12).returns "doc"
|
|
287
|
+
@parser.ast(@class, :file => "/bar", :line => 12)
|
|
288
|
+
end
|
|
282
289
|
end
|
|
283
290
|
|
|
284
291
|
describe "when creating a node" do
|
|
@@ -39,25 +39,18 @@ describe Puppet::Provider::Confine::Exists do
|
|
|
39
39
|
|
|
40
40
|
describe "and the confine is for binaries" do
|
|
41
41
|
before { @confine.stubs(:for_binary).returns true }
|
|
42
|
-
it "should use its '
|
|
43
|
-
@confine.expects(:
|
|
42
|
+
it "should use its 'which' method to look up the full path of the file" do
|
|
43
|
+
@confine.expects(:which).returns nil
|
|
44
44
|
@confine.pass?("/my/file")
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
it "should return false if no
|
|
48
|
-
@confine.expects(:
|
|
47
|
+
it "should return false if no executable can be found" do
|
|
48
|
+
@confine.expects(:which).with("/my/file").returns nil
|
|
49
49
|
@confine.pass?("/my/file").should be_false
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
it "should return true if the
|
|
53
|
-
@confine.expects(:
|
|
54
|
-
FileTest.expects(:exist?).with("/my/file").returns true
|
|
55
|
-
@confine.pass?("/my/file").should be_true
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
it "should return false if the binary can be found but the file does not exist" do
|
|
59
|
-
@confine.expects(:binary).with("/my/file").returns "/my/file"
|
|
60
|
-
FileTest.expects(:exist?).with("/my/file").returns true
|
|
52
|
+
it "should return true if the executable can be found" do
|
|
53
|
+
@confine.expects(:which).with("/my/file").returns "/my/file"
|
|
61
54
|
@confine.pass?("/my/file").should be_true
|
|
62
55
|
end
|
|
63
56
|
end
|
|
@@ -113,7 +113,14 @@ describe Puppet::Provider::Mount do
|
|
|
113
113
|
@mounter.should be_mounted
|
|
114
114
|
end
|
|
115
115
|
|
|
116
|
-
it "should match ' on
|
|
116
|
+
it "should match '^<name> on' if the operating system is HP-UX" do
|
|
117
|
+
Facter.stubs(:value).with("operatingsystem").returns("HP-UX")
|
|
118
|
+
@mounter.expects(:mountcmd).returns("/ on /dev/dsk/whatever\n/var on /dev/dsk/other")
|
|
119
|
+
|
|
120
|
+
@mounter.should be_mounted
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
it "should match ' on <name>' if the operating system is not Darwin, Solaris, or HP-UX" do
|
|
117
124
|
Facter.stubs(:value).with("operatingsystem").returns("Debian")
|
|
118
125
|
@mounter.expects(:mountcmd).returns("/dev/dsk/whatever on / and stuff\n/dev/other/disk on /var and stuff")
|
|
119
126
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
4
|
+
|
|
5
|
+
provider_class = Puppet::Type.type(:service).provider(:freebsd)
|
|
6
|
+
|
|
7
|
+
describe provider_class do
|
|
8
|
+
before :each do
|
|
9
|
+
@provider = provider_class.new
|
|
10
|
+
@provider.stubs(:initscript)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "should correctly parse rcvar for FreeBSD < 7" do
|
|
14
|
+
@provider.stubs(:execute).returns <<OUTPUT
|
|
15
|
+
# ntpd
|
|
16
|
+
$ntpd_enable=YES
|
|
17
|
+
OUTPUT
|
|
18
|
+
@provider.rcvar.should == ['# ntpd', 'ntpd_enable=YES']
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "should correctly parse rcvar for FreeBSD 7 to 8" do
|
|
22
|
+
@provider.stubs(:execute).returns <<OUTPUT
|
|
23
|
+
# ntpd
|
|
24
|
+
ntpd_enable=YES
|
|
25
|
+
OUTPUT
|
|
26
|
+
@provider.rcvar.should == ['# ntpd', 'ntpd_enable=YES']
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "should correctly parse rcvar for FreeBSD >= 8.1" do
|
|
30
|
+
@provider.stubs(:execute).returns <<OUTPUT
|
|
31
|
+
# ntpd
|
|
32
|
+
#
|
|
33
|
+
ntpd_enable="YES"
|
|
34
|
+
# (default: "")
|
|
35
|
+
OUTPUT
|
|
36
|
+
@provider.rcvar.should == ['# ntpd', 'ntpd_enable="YES"', '# (default: "")']
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "should find the right rcvar_value for FreeBSD < 7" do
|
|
40
|
+
@provider.stubs(:rcvar).returns(['# ntpd', 'ntpd_enable=YES'])
|
|
41
|
+
|
|
42
|
+
@provider.rcvar_value.should == "YES"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it "should find the right rcvar_value for FreeBSD >= 7" do
|
|
46
|
+
@provider.stubs(:rcvar).returns(['# ntpd', 'ntpd_enable="YES"', '# (default: "")'])
|
|
47
|
+
|
|
48
|
+
@provider.rcvar_value.should == "YES"
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -5,7 +5,6 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
|
5
5
|
require 'puppet_spec/files'
|
|
6
6
|
require 'puppettest/support/utils'
|
|
7
7
|
require 'puppettest/fileparsing'
|
|
8
|
-
require 'tmpdir'
|
|
9
8
|
require 'puppettest/fakes'
|
|
10
9
|
|
|
11
10
|
provider_class = Puppet::Type.type(:ssh_authorized_key).provider(:parsed)
|
|
@@ -19,7 +18,7 @@ describe provider_class do
|
|
|
19
18
|
before :each do
|
|
20
19
|
@sshauthkey_class = Puppet::Type.type(:ssh_authorized_key)
|
|
21
20
|
@provider = @sshauthkey_class.provider(:parsed)
|
|
22
|
-
@keyfile =
|
|
21
|
+
@keyfile = tmpfile('authorized_keys')
|
|
23
22
|
@provider.any_instance.stubs(:target).returns @keyfile
|
|
24
23
|
@user = 'random_bob'
|
|
25
24
|
Puppet::Util.stubs(:uid).with(@user).returns 12345
|
|
@@ -72,7 +72,7 @@ describe provider_class do
|
|
|
72
72
|
@provider = provider_class.new(@resource)
|
|
73
73
|
@provider.stubs(:user_attributes)
|
|
74
74
|
@provider.stubs(:execute)
|
|
75
|
-
@provider.expects(:execute).with { |cmd, *args| args == ["-
|
|
75
|
+
@provider.expects(:execute).with { |cmd, *args| args == ["-n", 5, "-x", 10, "myuser"] }
|
|
76
76
|
@provider.create
|
|
77
77
|
end
|
|
78
78
|
end
|
|
@@ -131,4 +131,46 @@ describe provider_class do
|
|
|
131
131
|
@provider.addcmd.must == ["useradd", "-G", "somegroup", "-o", "-m", "someuser"]
|
|
132
132
|
end
|
|
133
133
|
end
|
|
134
|
+
|
|
135
|
+
describe "when calling passcmd" do
|
|
136
|
+
before do
|
|
137
|
+
@resource.stubs(:allowdupe?).returns true
|
|
138
|
+
@resource.stubs(:managehome?).returns true
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
it "should call command with :pass" do
|
|
142
|
+
@provider.expects(:command).with(:password)
|
|
143
|
+
@provider.passcmd
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
it "should return nil if neither min nor max is set" do
|
|
147
|
+
@resource.stubs(:should).with(:password_min_age).returns nil
|
|
148
|
+
@resource.stubs(:should).with(:password_max_age).returns nil
|
|
149
|
+
@provider.passcmd.must == nil
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
it "should return a chage command array with -m <value> and the user name if password_min_age is set" do
|
|
153
|
+
@provider.stubs(:command).with(:password).returns("chage")
|
|
154
|
+
@resource.stubs(:[]).with(:name).returns("someuser")
|
|
155
|
+
@resource.stubs(:should).with(:password_min_age).returns 123
|
|
156
|
+
@resource.stubs(:should).with(:password_max_age).returns nil
|
|
157
|
+
@provider.passcmd.must == ['chage','-m',123,'someuser']
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
it "should return a chage command array with -M <value> if password_max_age is set" do
|
|
161
|
+
@provider.stubs(:command).with(:password).returns("chage")
|
|
162
|
+
@resource.stubs(:[]).with(:name).returns("someuser")
|
|
163
|
+
@resource.stubs(:should).with(:password_min_age).returns nil
|
|
164
|
+
@resource.stubs(:should).with(:password_max_age).returns 999
|
|
165
|
+
@provider.passcmd.must == ['chage','-M',999,'someuser']
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
it "should return a chage command array with -M <value> -m <value> if both password_min_age and password_max_age are set" do
|
|
169
|
+
@provider.stubs(:command).with(:password).returns("chage")
|
|
170
|
+
@resource.stubs(:[]).with(:name).returns("someuser")
|
|
171
|
+
@resource.stubs(:should).with(:password_min_age).returns 123
|
|
172
|
+
@resource.stubs(:should).with(:password_max_age).returns 999
|
|
173
|
+
@provider.passcmd.must == ['chage','-m',123,'-M',999,'someuser']
|
|
174
|
+
end
|
|
175
|
+
end
|
|
134
176
|
end
|
data/spec/unit/rails_spec.rb
CHANGED
|
@@ -103,9 +103,9 @@ describe Puppet::Rails, "when initializing a mysql connection" do
|
|
|
103
103
|
Puppet.settings.stubs(:value).with(:dbport).returns("")
|
|
104
104
|
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
|
105
105
|
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
|
106
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns((pool_size = 45).to_s)
|
|
106
107
|
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
|
107
108
|
Puppet.settings.stubs(:value).with(:dbsocket).returns("")
|
|
108
|
-
Puppet.settings.stubs(:value).with(:dbconnections).returns(1)
|
|
109
109
|
|
|
110
110
|
Puppet::Rails.database_arguments.should == {
|
|
111
111
|
:adapter => "mysql",
|
|
@@ -113,9 +113,9 @@ describe Puppet::Rails, "when initializing a mysql connection" do
|
|
|
113
113
|
:host => "testserver",
|
|
114
114
|
:username => "testuser",
|
|
115
115
|
:password => "testpassword",
|
|
116
|
+
:pool => pool_size,
|
|
116
117
|
:database => "testname",
|
|
117
|
-
:reconnect => true
|
|
118
|
-
:pool => 1
|
|
118
|
+
:reconnect => true
|
|
119
119
|
}
|
|
120
120
|
end
|
|
121
121
|
|
|
@@ -126,9 +126,9 @@ describe Puppet::Rails, "when initializing a mysql connection" do
|
|
|
126
126
|
Puppet.settings.stubs(:value).with(:dbport).returns("9999")
|
|
127
127
|
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
|
128
128
|
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
|
129
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns((pool_size = 12).to_s)
|
|
129
130
|
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
|
130
131
|
Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
|
|
131
|
-
Puppet.settings.stubs(:value).with(:dbconnections).returns(1)
|
|
132
132
|
|
|
133
133
|
Puppet::Rails.database_arguments.should == {
|
|
134
134
|
:adapter => "mysql",
|
|
@@ -137,10 +137,10 @@ describe Puppet::Rails, "when initializing a mysql connection" do
|
|
|
137
137
|
:port => "9999",
|
|
138
138
|
:username => "testuser",
|
|
139
139
|
:password => "testpassword",
|
|
140
|
+
:pool => pool_size,
|
|
140
141
|
:database => "testname",
|
|
141
142
|
:socket => "testsocket",
|
|
142
|
-
:reconnect => true
|
|
143
|
-
:pool => 1
|
|
143
|
+
:reconnect => true
|
|
144
144
|
}
|
|
145
145
|
end
|
|
146
146
|
|
|
@@ -151,9 +151,9 @@ describe Puppet::Rails, "when initializing a mysql connection" do
|
|
|
151
151
|
Puppet.settings.stubs(:value).with(:dbport).returns("9999")
|
|
152
152
|
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
|
153
153
|
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
|
154
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns((pool_size = 23).to_s)
|
|
154
155
|
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
|
155
156
|
Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
|
|
156
|
-
Puppet.settings.stubs(:value).with(:dbconnections).returns(1)
|
|
157
157
|
|
|
158
158
|
Puppet::Rails.database_arguments.should == {
|
|
159
159
|
:adapter => "mysql",
|
|
@@ -162,12 +162,32 @@ describe Puppet::Rails, "when initializing a mysql connection" do
|
|
|
162
162
|
:port => "9999",
|
|
163
163
|
:username => "testuser",
|
|
164
164
|
:password => "testpassword",
|
|
165
|
+
:pool => pool_size,
|
|
165
166
|
:database => "testname",
|
|
166
167
|
:socket => "testsocket",
|
|
167
|
-
:reconnect => true
|
|
168
|
-
:pool => 1
|
|
168
|
+
:reconnect => true
|
|
169
169
|
}
|
|
170
170
|
end
|
|
171
|
+
|
|
172
|
+
it "should not provide the pool if dbconnections is 0, '0', or ''" do
|
|
173
|
+
Puppet.settings.stubs(:value).with(:dbadapter).returns("mysql")
|
|
174
|
+
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
|
|
175
|
+
Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
|
|
176
|
+
Puppet.settings.stubs(:value).with(:dbport).returns("9999")
|
|
177
|
+
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
|
178
|
+
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
|
179
|
+
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
|
180
|
+
Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
|
|
181
|
+
|
|
182
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns(0)
|
|
183
|
+
Puppet::Rails.database_arguments.should_not be_include(:pool)
|
|
184
|
+
|
|
185
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns('0')
|
|
186
|
+
Puppet::Rails.database_arguments.should_not be_include(:pool)
|
|
187
|
+
|
|
188
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns('')
|
|
189
|
+
Puppet::Rails.database_arguments.should_not be_include(:pool)
|
|
190
|
+
end
|
|
171
191
|
end
|
|
172
192
|
|
|
173
193
|
describe Puppet::Rails, "when initializing a postgresql connection" do
|
|
@@ -180,9 +200,9 @@ describe Puppet::Rails, "when initializing a postgresql connection" do
|
|
|
180
200
|
Puppet.settings.stubs(:value).with(:dbport).returns("9999")
|
|
181
201
|
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
|
182
202
|
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
|
203
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns((pool_size = 200).to_s)
|
|
183
204
|
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
|
184
205
|
Puppet.settings.stubs(:value).with(:dbsocket).returns("")
|
|
185
|
-
Puppet.settings.stubs(:value).with(:dbconnections).returns(1)
|
|
186
206
|
|
|
187
207
|
Puppet::Rails.database_arguments.should == {
|
|
188
208
|
:adapter => "postgresql",
|
|
@@ -191,9 +211,9 @@ describe Puppet::Rails, "when initializing a postgresql connection" do
|
|
|
191
211
|
:port => "9999",
|
|
192
212
|
:username => "testuser",
|
|
193
213
|
:password => "testpassword",
|
|
214
|
+
:pool => pool_size,
|
|
194
215
|
:database => "testname",
|
|
195
|
-
:reconnect => true
|
|
196
|
-
:pool => 1
|
|
216
|
+
:reconnect => true
|
|
197
217
|
}
|
|
198
218
|
end
|
|
199
219
|
|
|
@@ -204,9 +224,9 @@ describe Puppet::Rails, "when initializing a postgresql connection" do
|
|
|
204
224
|
Puppet.settings.stubs(:value).with(:dbport).returns("9999")
|
|
205
225
|
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
|
206
226
|
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
|
227
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns((pool_size = 122).to_s)
|
|
207
228
|
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
|
208
229
|
Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
|
|
209
|
-
Puppet.settings.stubs(:value).with(:dbconnections).returns(1)
|
|
210
230
|
|
|
211
231
|
Puppet::Rails.database_arguments.should == {
|
|
212
232
|
:adapter => "postgresql",
|
|
@@ -215,50 +235,90 @@ describe Puppet::Rails, "when initializing a postgresql connection" do
|
|
|
215
235
|
:port => "9999",
|
|
216
236
|
:username => "testuser",
|
|
217
237
|
:password => "testpassword",
|
|
238
|
+
:pool => pool_size,
|
|
218
239
|
:database => "testname",
|
|
219
240
|
:socket => "testsocket",
|
|
220
|
-
:pool => 1,
|
|
221
241
|
:reconnect => true
|
|
222
242
|
}
|
|
223
243
|
end
|
|
244
|
+
|
|
245
|
+
it "should not provide the pool if dbconnections is 0, '0', or ''" do
|
|
246
|
+
Puppet.settings.stubs(:value).with(:dbadapter).returns("mysql")
|
|
247
|
+
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
|
|
248
|
+
Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
|
|
249
|
+
Puppet.settings.stubs(:value).with(:dbport).returns("9999")
|
|
250
|
+
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
|
251
|
+
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
|
252
|
+
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
|
253
|
+
Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
|
|
254
|
+
|
|
255
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns(0)
|
|
256
|
+
Puppet::Rails.database_arguments.should_not be_include(:pool)
|
|
257
|
+
|
|
258
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns('0')
|
|
259
|
+
Puppet::Rails.database_arguments.should_not be_include(:pool)
|
|
260
|
+
|
|
261
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns('')
|
|
262
|
+
Puppet::Rails.database_arguments.should_not be_include(:pool)
|
|
263
|
+
end
|
|
224
264
|
end
|
|
225
265
|
|
|
226
266
|
describe Puppet::Rails, "when initializing an Oracle connection" do
|
|
227
267
|
confine "Cannot test without ActiveRecord" => Puppet.features.rails?
|
|
228
268
|
|
|
229
|
-
it "should provide the adapter, log_level, and username, password,
|
|
269
|
+
it "should provide the adapter, log_level, and username, password, and database arguments" do
|
|
230
270
|
Puppet.settings.stubs(:value).with(:dbadapter).returns("oracle_enhanced")
|
|
231
271
|
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
|
|
232
272
|
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
|
233
273
|
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
|
274
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns((pool_size = 123).to_s)
|
|
234
275
|
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
|
235
|
-
Puppet.settings.stubs(:value).with(:dbconnections).returns(1)
|
|
236
276
|
|
|
237
277
|
Puppet::Rails.database_arguments.should == {
|
|
238
278
|
:adapter => "oracle_enhanced",
|
|
239
279
|
:log_level => "testlevel",
|
|
240
280
|
:username => "testuser",
|
|
241
281
|
:password => "testpassword",
|
|
242
|
-
:
|
|
243
|
-
:
|
|
282
|
+
:pool => pool_size,
|
|
283
|
+
:database => "testname"
|
|
244
284
|
}
|
|
245
285
|
end
|
|
246
286
|
|
|
247
|
-
it "should provide the adapter, log_level, and host, username, password, database
|
|
287
|
+
it "should provide the adapter, log_level, and host, username, password, database and socket arguments" do
|
|
248
288
|
Puppet.settings.stubs(:value).with(:dbadapter).returns("oracle_enhanced")
|
|
249
289
|
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
|
|
250
290
|
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
|
251
291
|
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
|
292
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns((pool_size = 124).to_s)
|
|
252
293
|
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
|
253
|
-
Puppet.settings.stubs(:value).with(:dbconnections).returns(1)
|
|
254
294
|
|
|
255
295
|
Puppet::Rails.database_arguments.should == {
|
|
256
296
|
:adapter => "oracle_enhanced",
|
|
257
297
|
:log_level => "testlevel",
|
|
258
298
|
:username => "testuser",
|
|
259
299
|
:password => "testpassword",
|
|
260
|
-
:
|
|
261
|
-
:
|
|
300
|
+
:pool => pool_size,
|
|
301
|
+
:database => "testname"
|
|
262
302
|
}
|
|
263
303
|
end
|
|
304
|
+
|
|
305
|
+
it "should not provide the pool if dbconnections is 0, '0', or ''" do
|
|
306
|
+
Puppet.settings.stubs(:value).with(:dbadapter).returns("mysql")
|
|
307
|
+
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
|
|
308
|
+
Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
|
|
309
|
+
Puppet.settings.stubs(:value).with(:dbport).returns("9999")
|
|
310
|
+
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
|
311
|
+
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
|
312
|
+
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
|
313
|
+
Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
|
|
314
|
+
|
|
315
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns(0)
|
|
316
|
+
Puppet::Rails.database_arguments.should_not be_include(:pool)
|
|
317
|
+
|
|
318
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns('0')
|
|
319
|
+
Puppet::Rails.database_arguments.should_not be_include(:pool)
|
|
320
|
+
|
|
321
|
+
Puppet.settings.stubs(:value).with(:dbconnections).returns('')
|
|
322
|
+
Puppet::Rails.database_arguments.should_not be_include(:pool)
|
|
323
|
+
end
|
|
264
324
|
end
|