diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-22 22:24:12 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-22 22:24:12 +0000 |
| commit | 55f2873d454dfb32593171e3f2b16f3b4221d897 (patch) | |
| tree | db92bec4529d3f595ce3bc47a72e8b5785265b70 /test/server | |
| parent | 3aac2e1eb48efa8f97d9c2e00b224c448cb77e8f (diff) | |
| download | puppet-55f2873d454dfb32593171e3f2b16f3b4221d897.tar.gz puppet-55f2873d454dfb32593171e3f2b16f3b4221d897.tar.xz puppet-55f2873d454dfb32593171e3f2b16f3b4221d897.zip | |
Merging the fix to server/master.rb
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1673 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/server')
| -rw-r--r-- | test/server/master.rb | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/test/server/master.rb b/test/server/master.rb index 2d1b9ec2c..b04fc92fd 100644 --- a/test/server/master.rb +++ b/test/server/master.rb @@ -116,6 +116,7 @@ class TestMaster < Test::Unit::TestCase # The client doesn't have a config, so it can't be up to date assert(! client.fresh?, "Client is incorrectly up to date") + Puppet.config.use(:puppet) assert_nothing_raised { client.getconfig client.apply @@ -195,7 +196,7 @@ class TestMaster < Test::Unit::TestCase file_fact = tempfile() certname = "y4yn3ss" - factname = Facter["hostname"].value + factname = Facter.value("hostname") File.open(file, "w") { |f| f.puts %{ @@ -242,6 +243,58 @@ class TestMaster < Test::Unit::TestCase "Found incorrect file") end + # Make sure we're correctly doing clientname manipulations. + # Testing to make sure we always get a hostname and IP address. + def test_clientname + master = nil + file = tempfile() + + File.open(file, "w") { |f| + f.puts %{ + node yay { file { "/something": ensure => file, mode => 755 } } +} + } + # create our master + assert_nothing_raised() { + # this is the default server setup + master = Puppet::Server::Master.new( + :Manifest => file, + :UseNodes => true, + :Local => true + ) + } + + Puppet[:node_name] = "cert" + # First act like we're local + fakename = nil + fakeip = nil + + name = ip = nil + facts = Facter.to_hash + assert_nothing_raised do + name, ip = master.clientname(fakename, fakeip, facts) + end + + assert(facts["hostname"], "Removed hostname fact") + assert(facts["ipaddress"], "Removed ipaddress fact") + + assert_equal(facts["hostname"], name) + assert_equal(facts["ipaddress"], ip) + + # Now set them to something real, and make sure we get them back + fakename = "yayness" + fakeip = "192.168.0.1" + facts = Facter.to_hash + assert_nothing_raised do + name, ip = master.clientname(fakename, fakeip, facts) + end + + assert(facts["hostname"], "Removed hostname fact") + assert(facts["ipaddress"], "Removed ipaddress fact") + + assert_equal(fakename, name) + assert_equal(fakeip, ip) + end end # $Id$ |
