diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/executables/puppetd.rb | 2 | ||||
-rwxr-xr-x | test/executables/puppetmasterd.rb | 5 | ||||
-rwxr-xr-x | test/language/resource.rb | 10 | ||||
-rw-r--r-- | test/lib/puppettest/exetest.rb | 1 | ||||
-rwxr-xr-x | test/network/client/client.rb | 30 | ||||
-rwxr-xr-x | test/network/client/master.rb | 33 | ||||
-rwxr-xr-x | test/network/server/webrick.rb | 8 | ||||
-rwxr-xr-x | test/network/xmlrpc/client.rb | 39 | ||||
-rwxr-xr-x | test/ral/types/file.rb | 2 | ||||
-rwxr-xr-x | test/ral/types/filesources.rb | 7 |
10 files changed, 27 insertions, 110 deletions
diff --git a/test/executables/puppetd.rb b/test/executables/puppetd.rb index 3dd3856fd..d770ff91e 100755 --- a/test/executables/puppetd.rb +++ b/test/executables/puppetd.rb @@ -12,9 +12,11 @@ class TestPuppetDExe < Test::Unit::TestCase include PuppetTest::ExeTest def setup super + Puppet[:certdnsnames] = "localhost" # start the master @manifest = startmasterd + @cmd = "puppetd" @cmd += " --verbose" @cmd += " --test" diff --git a/test/executables/puppetmasterd.rb b/test/executables/puppetmasterd.rb index 16f7f0f5c..6d4ddf56f 100755 --- a/test/executables/puppetmasterd.rb +++ b/test/executables/puppetmasterd.rb @@ -9,6 +9,11 @@ require 'socket' class TestPuppetMasterD < Test::Unit::TestCase include PuppetTest::ExeTest + def setup + super + Puppet[:certdnsnames] = "localhost" + end + def getcerts include Puppet::Daemon if self.readcerts diff --git a/test/language/resource.rb b/test/language/resource.rb index 9c030d34a..84a30b029 100755 --- a/test/language/resource.rb +++ b/test/language/resource.rb @@ -239,9 +239,9 @@ class TestResource < PuppetTest::TestCase assert_equal("nobody", obj["owner"], "Single-value string was not passed correctly") assert_equal(%w{you me}, obj["group"], "Array of strings was not passed correctly") assert_equal("svn", obj["ignore"], "Array with single string was not turned into single value") - assert_equal(["File", refs[0].title], obj["require"], "Resource reference was not passed correctly") - assert_equal([["File", refs[1].title], ["File", refs[2].title]], obj["subscribe"], "Array of resource references was not passed correctly") - assert_equal(["File", refs[3].title], obj["notify"], "Array with single resource reference was not turned into single value") + assert_equal(["file", refs[0].title], obj["require"], "Resource reference was not passed correctly") + assert_equal([["file", refs[1].title], ["file", refs[2].title]], obj["subscribe"], "Array of resource references was not passed correctly") + assert_equal(["file", refs[3].title], obj["notify"], "Array with single resource reference was not turned into single value") end # FIXME This isn't a great test, but I need to move on. @@ -332,7 +332,7 @@ class TestResource < PuppetTest::TestCase end assert_instance_of(Array, trans["require"]) - assert_equal(["File", "/tmp/ref1"], trans["require"]) + assert_equal(["file", "/tmp/ref1"], trans["require"]) # Now try it when using an array of references. two = Parser::Resource::Reference.new(:type => "file", :title => "/tmp/ref2") @@ -348,7 +348,7 @@ class TestResource < PuppetTest::TestCase assert_instance_of(Array, trans["require"][0]) trans["require"].each do |val| assert_instance_of(Array, val) - assert_equal("File", val[0]) + assert_equal("file", val[0]) assert(val[1] =~ /\/tmp\/ref[0-9]/, "Was %s instead of the file name" % val[1]) end diff --git a/test/lib/puppettest/exetest.rb b/test/lib/puppettest/exetest.rb index be148a169..05de56c0f 100644 --- a/test/lib/puppettest/exetest.rb +++ b/test/lib/puppettest/exetest.rb @@ -54,6 +54,7 @@ module PuppetTest::ExeTest args += " --confdir %s" % Puppet[:confdir] args += " --rundir %s" % File.join(Puppet[:vardir], "run") args += " --vardir %s" % Puppet[:vardir] + args += " --certdnsnames %s" % Puppet[:certdnsnames] args += " --masterport %s" % @@port args += " --user %s" % Puppet::Util::SUIDManager.uid args += " --group %s" % Puppet::Util::SUIDManager.gid diff --git a/test/network/client/client.rb b/test/network/client/client.rb index 2588b9be5..b6b915d31 100755 --- a/test/network/client/client.rb +++ b/test/network/client/client.rb @@ -221,34 +221,4 @@ class TestClient < Test::Unit::TestCase end end end - - # Make sure that reading the cert in also sets up the cert stuff for the driver - def test_read_cert - Puppet::Util::SUIDManager.stubs(:asuser).yields - - ca = Puppet::Network::Handler.ca.new - caclient = Puppet::Network::Client.ca.new :CA => ca - - caclient.request_cert - - # First make sure it doesn't get called when the driver doesn't support :cert_setup - client = FakeClient.new :Test => FakeDriver.new - driver = client.driver - - assert_nothing_raised("Could not read cert") do - client.read_cert - end - - # And then that it does when the driver supports it - client = FakeClient.new :Test => FakeDriver.new - - driver = client.driver - driver.meta_def(:recycle_connection) { |c| } - driver.expects(:recycle_connection).with(client) - - assert_nothing_raised("Could not read cert") do - client.read_cert - end - end end - diff --git a/test/network/client/master.rb b/test/network/client/master.rb index 60058aed9..696d08bfd 100755 --- a/test/network/client/master.rb +++ b/test/network/client/master.rb @@ -333,39 +333,6 @@ end assert(FileTest.exists?(file), "file was not created on second run") end - def test_default_objects - # Make sure they start out missing - assert_nil(Puppet::Type.type(:filebucket)["puppet"], - "default filebucket already exists") - assert_nil(Puppet::Type.type(:schedule)["daily"], - "default schedules already exists") - - master = mkclient() - - # Now make sure they got created - assert(Puppet::Type.type(:filebucket)["puppet"], - "default filebucket not found") - assert(Puppet::Type.type(:schedule)["daily"], - "default schedules not found") - - # clear everything, and make sure we can recreate them - Puppet::Type.allclear - assert_nil(Puppet::Type.type(:filebucket)["puppet"], - "default filebucket not removed") - assert_nil(Puppet::Type.type(:schedule)["daily"], - "default schedules not removed") - assert_nothing_raised { master.mkdefault_objects } - assert(Puppet::Type.type(:filebucket)["puppet"], - "default filebucket not found") - assert(Puppet::Type.type(:schedule)["daily"], - "default schedules not found") - - - # Make sure we've got schedules - assert(Puppet::Type.type(:schedule)["hourly"], "Could not retrieve hourly schedule") - assert(Puppet::Type.type(:filebucket)["puppet"], "Could not retrieve default bucket") - end - # #540 - make sure downloads aren't affected by noop def test_download_in_noop source = tempfile diff --git a/test/network/server/webrick.rb b/test/network/server/webrick.rb index 3561cd41a..d3408c166 100755 --- a/test/network/server/webrick.rb +++ b/test/network/server/webrick.rb @@ -14,6 +14,11 @@ class TestWebrickServer < Test::Unit::TestCase super end + def teardown + super + Puppet::Network::HttpPool.clear_http_instances + end + # Make sure we can create a server, and that it knows how to create its # certs by default. def test_basics @@ -102,7 +107,7 @@ class TestWebrickServer < Test::Unit::TestCase assert_nothing_raised() { client = Puppet::Network::Client.status.new( - :Server => Facter.value(:fqdn), + :Server => "localhost", :Port => @@port ) } @@ -111,6 +116,7 @@ class TestWebrickServer < Test::Unit::TestCase def mk_status_server server = nil + Puppet[:certdnsnames] = "localhost" assert_nothing_raised() { server = Puppet::Network::HTTPServer::WEBrick.new( :Port => @@port, diff --git a/test/network/xmlrpc/client.rb b/test/network/xmlrpc/client.rb index f6d234324..53be5ca07 100755 --- a/test/network/xmlrpc/client.rb +++ b/test/network/xmlrpc/client.rb @@ -42,43 +42,4 @@ class TestXMLRPCClient < Test::Unit::TestCase assert(net, "did not get net client") end - - # Make sure the xmlrpc client is correctly reading all of the cert stuff - # and setting it into the @http var - def test_cert_setup - client = nil - assert_nothing_raised do - client = Puppet::Network::XMLRPCClient.new() - end - - caclient = mock 'client', :cert => :ccert, :key => :ckey - - FileTest.expects(:exist?).with(Puppet[:localcacert]).returns(true) - - store = mock 'sslstore' - OpenSSL::X509::Store.expects(:new).returns(store) - store.expects(:add_file).with(Puppet[:localcacert]) - store.expects(:purpose=).with(OpenSSL::X509::PURPOSE_SSL_CLIENT) - - class << client - attr_accessor :http - end - - http = mock 'http' - client.http = http - - http.expects(:ca_file).returns(false) - http.expects(:ca_file=).with(Puppet[:localcacert]) - http.expects(:cert=).with(:ccert) - http.expects(:key=).with(:ckey) - http.expects(:verify_mode=).with(OpenSSL::SSL::VERIFY_PEER) - http.expects(:cert_store=) - - assert_nothing_raised do - client.cert_setup(caclient) - end - end - - def test_http_cache - end end diff --git a/test/ral/types/file.rb b/test/ral/types/file.rb index fdb2eb656..a3a0c579a 100755 --- a/test/ral/types/file.rb +++ b/test/ral/types/file.rb @@ -1787,8 +1787,6 @@ class TestFile < Test::Unit::TestCase assert_instance_of(Puppet::Network::Client::Dipper, file.bucket, "did not default to a filebucket for backups") - assert_equal(Puppet::Type.type(:filebucket)["puppet"].bucket, file.bucket, - "did not default to the 'puppet' filebucket") end # #515 - make sure 'ensure' other than "link" is deleted during recursion diff --git a/test/ral/types/filesources.rb b/test/ral/types/filesources.rb index 6180eed18..02bf8a5b3 100755 --- a/test/ral/types/filesources.rb +++ b/test/ral/types/filesources.rb @@ -22,6 +22,11 @@ class TestFileSources < Test::Unit::TestCase Puppet[:filetimeout] = -1 Puppet::Util::SUIDManager.stubs(:asuser).yields end + + def teardown + super + Puppet::Network::HttpPool.clear_http_instances + end def use_storage begin @@ -547,6 +552,7 @@ class TestFileSources < Test::Unit::TestCase Puppet[:masterport] = 8762 Puppet[:name] = "puppetmasterd" + Puppet[:certdnsnames] = "localhost" serverpid = nil assert_nothing_raised() { @@ -592,6 +598,7 @@ class TestFileSources < Test::Unit::TestCase Puppet[:autosign] = true Puppet[:masterport] = @port + Puppet[:certdnsnames] = "localhost" serverpid = nil assert_nothing_raised("Could not start on port %s" % @port) { |