diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2010-05-12 18:25:14 -0700 |
|---|---|---|
| committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
| commit | ac7efc8f0284d6b35f5428da06ba371cf94998ec (patch) | |
| tree | c1a6a6df5dd2d533c1d0b12b869a0758b8c4cb6f /spec | |
| parent | 5665e3984f73c70b90f65dd8bf4445b5adda5121 (diff) | |
| download | puppet-ac7efc8f0284d6b35f5428da06ba371cf94998ec.tar.gz puppet-ac7efc8f0284d6b35f5428da06ba371cf94998ec.tar.xz puppet-ac7efc8f0284d6b35f5428da06ba371cf94998ec.zip | |
Feature #2935 Puppet::Mode#master?
Use a predicate function on the Mode object instead of comparing with
the executable name everywhere
Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/application/doc.rb | 5 | ||||
| -rwxr-xr-x | spec/unit/indirector/file.rb | 8 | ||||
| -rwxr-xr-x | spec/unit/indirector/yaml.rb | 9 | ||||
| -rwxr-xr-x | spec/unit/network/http/webrick.rb | 8 | ||||
| -rwxr-xr-x | spec/unit/ssl/certificate_authority.rb | 10 |
5 files changed, 20 insertions, 20 deletions
diff --git a/spec/unit/application/doc.rb b/spec/unit/application/doc.rb index c224b0de5..960ef7ac6 100755 --- a/spec/unit/application/doc.rb +++ b/spec/unit/application/doc.rb @@ -190,7 +190,6 @@ describe Puppet::Application::Doc do before :each do @doc.options.stubs(:[]).returns(false) - Puppet.stubs(:[]=).with(:name, "puppetmasterd") Puppet.stubs(:parse_config) Puppet::Util::Log.stubs(:level=) Puppet::Util::Log.stubs(:newdestination) @@ -224,8 +223,8 @@ describe Puppet::Application::Doc do end end - it "should pretend to be puppetmasterd" do - Puppet.expects(:[]=).with(:name, "puppetmasterd") + it "should operate in master mode" do + @doc.class.mode.name.should == :master @doc.setup_rdoc end diff --git a/spec/unit/indirector/file.rb b/spec/unit/indirector/file.rb index fd56aa6c7..207d897bf 100755 --- a/spec/unit/indirector/file.rb +++ b/spec/unit/indirector/file.rb @@ -30,15 +30,15 @@ describe Puppet::Indirector::File do @searcher.should respond_to(:find) end - it "should use the server data directory plus the indirection name if the process name is 'puppetmasterd'" do - Puppet.settings.expects(:value).with(:name).returns "puppetmasterd" + it "should use the server data directory plus the indirection name if the process mode is master" do + Puppet.mode.expects(:master?).returns true Puppet.settings.expects(:value).with(:server_datadir).returns "/my/dir" @searcher.data_directory.should == File.join("/my/dir", "mystuff") end - it "should use the client data directory plus the indirection name if the process name is not 'puppetmasterd'" do - Puppet.settings.expects(:value).with(:name).returns "puppetd" + it "should use the client data directory plus the indirection name if the process mode is not master" do + Puppet.mode.expects(:master?).returns false Puppet.settings.expects(:value).with(:client_datadir).returns "/my/dir" @searcher.data_directory.should == File.join("/my/dir", "mystuff") diff --git a/spec/unit/indirector/yaml.rb b/spec/unit/indirector/yaml.rb index 153b9651b..d93199e1c 100755 --- a/spec/unit/indirector/yaml.rb +++ b/spec/unit/indirector/yaml.rb @@ -22,19 +22,20 @@ describe Puppet::Indirector::Yaml, " when choosing file location" do @dir = "/what/ever" Puppet.settings.stubs(:value).returns("fakesettingdata") Puppet.settings.stubs(:value).with(:clientyamldir).returns(@dir) + Puppet.mode.stubs(:master?).returns false @request = stub 'request', :key => :me, :instance => @subject end describe Puppet::Indirector::Yaml, " when choosing file location" do - it "should use the server_datadir if the process name is 'puppetmasterd'" do - Puppet.settings.expects(:value).with(:name).returns "puppetmasterd" + it "should use the server_datadir if the mode is master" do + Puppet.mode.expects(:master?).returns true Puppet.settings.expects(:value).with(:yamldir).returns "/server/yaml/dir" @store.path(:me).should =~ %r{^/server/yaml/dir} end - it "should use the client yamldir if the process name is not 'puppetmasterd'" do - Puppet.settings.expects(:value).with(:name).returns "cient" + it "should use the client yamldir if the mode is not master" do + Puppet.mode.expects(:master?).returns false Puppet.settings.expects(:value).with(:clientyamldir).returns "/client/yaml/dir" @store.path(:me).should =~ %r{^/client/yaml/dir} end diff --git a/spec/unit/network/http/webrick.rb b/spec/unit/network/http/webrick.rb index b8163fef7..aaab53b0c 100755 --- a/spec/unit/network/http/webrick.rb +++ b/spec/unit/network/http/webrick.rb @@ -211,8 +211,8 @@ describe Puppet::Network::HTTP::WEBrick do @server.setup_logger end - it "should use the masterlog if the process name is 'puppetmasterd'" do - Puppet.settings.stubs(:value).with(:name).returns "puppetmasterd" + it "should use the masterlog if the process mode is master" do + Puppet.mode.stubs(:master?).returns(true) Puppet.settings.expects(:value).with(:masterhttplog).returns "/master/log" File.expects(:open).with("/master/log", "a+").returns @filehandle @@ -220,8 +220,8 @@ describe Puppet::Network::HTTP::WEBrick do @server.setup_logger end - it "should use the httplog if the process name is not 'puppetmasterd'" do - Puppet.settings.stubs(:value).with(:name).returns "other" + it "should use the httplog if the process mode is not master" do + Puppet.mode.stubs(:master?).returns(false) Puppet.settings.expects(:value).with(:httplog).returns "/other/log" File.expects(:open).with("/other/log", "a+").returns @filehandle diff --git a/spec/unit/ssl/certificate_authority.rb b/spec/unit/ssl/certificate_authority.rb index 4d2303a60..3b1b9486f 100755 --- a/spec/unit/ssl/certificate_authority.rb +++ b/spec/unit/ssl/certificate_authority.rb @@ -24,10 +24,10 @@ describe Puppet::SSL::CertificateAuthority do end describe "when finding an existing instance" do - describe "and the host is a CA host and the proces name is 'puppetmasterd'" do + describe "and the host is a CA host and the mode is master" do before do Puppet.settings.stubs(:value).with(:ca).returns true - Puppet.settings.stubs(:value).with(:name).returns "puppetmasterd" + Puppet.mode.stubs(:master?).returns true @ca = mock('ca') Puppet::SSL::CertificateAuthority.stubs(:new).returns @ca @@ -45,7 +45,7 @@ describe Puppet::SSL::CertificateAuthority do describe "and the host is not a CA host" do it "should return nil" do Puppet.settings.stubs(:value).with(:ca).returns false - Puppet.settings.stubs(:value).with(:name).returns "puppetmasterd" + Puppet.mode.stubs(:master?).returns true ca = mock('ca') Puppet::SSL::CertificateAuthority.expects(:new).never @@ -53,10 +53,10 @@ describe Puppet::SSL::CertificateAuthority do end end - describe "and the process name is not 'puppetmasterd'" do + describe "and the mode is not master" do it "should return nil" do Puppet.settings.stubs(:value).with(:ca).returns true - Puppet.settings.stubs(:value).with(:name).returns "puppetd" + Puppet.mode.stubs(:master?).returns false ca = mock('ca') Puppet::SSL::CertificateAuthority.expects(:new).never |
