diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-06-18 21:03:18 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-06-18 21:03:18 +0000 |
commit | 099bf6c582b8e68263f25c0430fcf3d5ac7b1b7f (patch) | |
tree | 34ac81add7aeb9cd48ac599a02255d15218d6e13 /test/rails | |
parent | f96ec6d7ab9d18d2068f388508d811c39973df1e (diff) | |
download | puppet-099bf6c582b8e68263f25c0430fcf3d5ac7b1b7f.tar.gz puppet-099bf6c582b8e68263f25c0430fcf3d5ac7b1b7f.tar.xz puppet-099bf6c582b8e68263f25c0430fcf3d5ac7b1b7f.zip |
Fixing some failing tests.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2616 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/rails')
-rwxr-xr-x | test/rails/host.rb | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/test/rails/host.rb b/test/rails/host.rb index 3005ac5e2..f3190c047 100755 --- a/test/rails/host.rb +++ b/test/rails/host.rb @@ -12,7 +12,8 @@ require 'puppettest/parsertesting' require 'puppettest/resourcetesting' require 'puppettest/railstesting' -class TestRailsHost < Test::Unit::TestCase +class TestRailsHost < PuppetTest::TestCase + confine "Missing ActiveRecord" => Puppet.features.rails? include PuppetTest::ParserTesting include PuppetTest::ResourceTesting include PuppetTest::RailsTesting @@ -33,8 +34,6 @@ class TestRailsHost < Test::Unit::TestCase } end - # Don't do any tests w/out this class - if Puppet.features.rails? def test_store @interp, @scope, @source = mkclassframing # First make some objects @@ -157,8 +156,46 @@ class TestRailsHost < Test::Unit::TestCase "loglevel was not added") end end - else - $stderr.puts "Install Rails for Rails and Caching tests" + + def test_freshness_connect_update + Puppet::Rails.init + Puppet[:storeconfigs] = true + + # this is the default server setup + master = Puppet::Network::Handler.master.new( + :Code => "", + :UseNodes => true, + :Local => true + ) + + # Create a host + Puppet::Rails::Host.new(:name => "test", :ip => "192.168.0.3").save + + assert_nothing_raised("Failed to update last_connect for unknown host") do + master.freshness("created",'192.168.0.1') + end + + # Make sure it created the host + created = Puppet::Rails::Host.find_by_name("created") + assert(created, "Freshness did not create host") + assert(created.last_freshcheck, + "Did not set last_freshcheck on created host") + assert_equal("192.168.0.1", created.ip, + "Did not set IP address on created host") + + # Now check on the existing host + assert_nothing_raised("Failed to update last_connect for unknown host") do + master.freshness("test",'192.168.0.2') + end + + # Recreate it, so we're not using the cached object. + host = Puppet::Rails::Host.find_by_name("test") + + # Make sure it created the host + assert(host.last_freshcheck, + "Did not set last_freshcheck on existing host") + assert_equal("192.168.0.3", host.ip, + "Overrode IP on found host") end end |