diff options
author | Luke Kanies <luke@madstop.com> | 2007-11-12 22:08:44 -0600 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2007-11-12 22:08:44 -0600 |
commit | 72510bfaa65e97f4eaaf246ef8f1c155716967b6 (patch) | |
tree | 978aa0e92812f5854978048162c6e2ab752dad72 /test/network/handler/master.rb | |
parent | dd7caa76e160ed51c8b0e123c18f7526b575bfec (diff) | |
download | puppet-72510bfaa65e97f4eaaf246ef8f1c155716967b6.tar.gz puppet-72510bfaa65e97f4eaaf246ef8f1c155716967b6.tar.xz puppet-72510bfaa65e97f4eaaf246ef8f1c155716967b6.zip |
Fixing #800 by refactoring how configurations are retrieved
from the server. The real problem was getting all of the validation
done before any caching, which required a good bit more refactoring
than I expected.
In actuality, this commit is relatively small even though it covers
many files; most of the changes just make the code clearer or shorter.
Diffstat (limited to 'test/network/handler/master.rb')
-rwxr-xr-x | test/network/handler/master.rb | 68 |
1 files changed, 4 insertions, 64 deletions
diff --git a/test/network/handler/master.rb b/test/network/handler/master.rb index 694888f4d..25117030e 100755 --- a/test/network/handler/master.rb +++ b/test/network/handler/master.rb @@ -13,39 +13,11 @@ class TestMaster < Test::Unit::TestCase Puppet::Indirector::Indirection.clear_cache end - def test_defaultmanifest - textfiles { |file| - Puppet[:manifest] = file - client = nil - master = nil - assert_nothing_raised() { - # this is the default server setup - master = Puppet::Network::Handler.master.new( - :Manifest => file, - :UseNodes => false, - :Local => true - ) - } - assert_nothing_raised() { - client = Puppet::Network::Client.master.new( - :Master => master - ) - } - - # pull our configuration - assert_nothing_raised() { - client.getconfig - stopservices - Puppet::Type.allclear - } - - break - } - end - + # Make sure that files are reread when they change. def test_filereread # Start with a normal setting Puppet[:filetimeout] = 15 + manifest = mktestmanifest() facts = Puppet::Network::Client.master.facts @@ -63,35 +35,12 @@ class TestMaster < Test::Unit::TestCase :Local => true ) } - assert_nothing_raised() { - client = Puppet::Network::Client.master.new( - :Master => master - ) - } - assert(client, "did not create master client") - # The client doesn't have a config, so it can't be up to date - assert(! client.fresh?(facts), - "Client is incorrectly up to date") - - Puppet.settings.use(:main) - config = nil - assert_nothing_raised { - config = client.getconfig - config.apply - } - - # Now it should be up to date - assert(client.fresh?(facts), "Client is not up to date") + config = master.getconfig({"hostname" => "blah"}) # Cache this value for later parse1 = master.freshness("mynode") - # Verify the config got applied - assert(FileTest.exists?(@createdfile), - "Created file %s does not exist" % @createdfile) - Puppet::Type.allclear - sleep 1.5 # Create a new manifest File.open(manifest, "w") { |f| @@ -101,7 +50,6 @@ class TestMaster < Test::Unit::TestCase # Verify that the master doesn't immediately reparse the file; we # want to wait through the timeout assert_equal(parse1, master.freshness("mynode"), "Master did not wait through timeout") - assert(client.fresh?(facts), "Client is not up to date") # Then eliminate it Puppet[:filetimeout] = 0 @@ -109,16 +57,8 @@ class TestMaster < Test::Unit::TestCase # Now make sure the master does reparse #Puppet.notice "%s vs %s" % [parse1, master.freshness] assert(parse1 != master.freshness("mynode"), "Master did not reparse file") - assert(! client.fresh?(facts), "Client is incorrectly up to date") - - # Retrieve and apply the new config - assert_nothing_raised { - config = client.getconfig - config.apply - } - assert(client.fresh?(facts), "Client is not up to date") - assert(FileTest.exists?(file2), "Second file %s does not exist" % file2) + assert(master.getconfig({"hostname" => "blah"}) != config, "Did not use reloaded config") end # Make sure we're correctly doing clientname manipulations. |