[prev in list] [next in list] [prev in thread] [next in thread]
List: puppet-commit
Subject: [Puppet-commit] puppet revision 2616
From: svn () madstop ! com
Date: 2007-06-18 21:03:18
Message-ID: 20070618210318.E32C8160060 () puppet ! reductivelabs ! com
[Download RAW message or body]
luke 2007-06-18 23:03:18 +0200 (Mon, 18 Jun 2007)
Fixing some failing tests.
Modified: trunk/lib/puppet/network/handler/master.rb
===================================================================
--- trunk/lib/puppet/network/handler/master.rb 2007-06-18 20:10:35 UTC (rev 2615)
+++ trunk/lib/puppet/network/handler/master.rb 2007-06-18 21:03:18 UTC (rev 2616)
@@ -71,7 +71,7 @@
host = Puppet::Rails::Host.find_or_create_by_name(client)
host.last_freshcheck = Time.now
- if clientip and (! host.ip or host.ip == "")
+ if clientip and (! host.ip or host.ip == "" or host.ip == "NULL")
host.ip = clientip
end
host.save
Modified: trunk/lib/puppet/rails/host.rb
===================================================================
--- trunk/lib/puppet/rails/host.rb 2007-06-18 20:10:35 UTC (rev 2615)
+++ trunk/lib/puppet/rails/host.rb 2007-06-18 21:03:18 UTC (rev 2616)
@@ -95,6 +95,7 @@
ar_hash_merge(get_facts_hash(), facts,
:create => Proc.new { |name, values|
fact_name = Puppet::Rails::FactName.find_or_create_by_name(name)
+ values = [values] unless values.is_a?(Array)
values.each do |value|
fact_values.build(:value => value,
:fact_name => fact_name)
Modified: trunk/test/network/handler/master.rb
===================================================================
--- trunk/test/network/handler/master.rb 2007-06-18 20:10:35 UTC (rev 2615)
+++ trunk/test/network/handler/master.rb 2007-06-18 21:03:18 UTC (rev 2616)
@@ -7,10 +7,6 @@
class TestMaster < Test::Unit::TestCase
include PuppetTest::ServerTest
- def teardown
- super
- #print "
" if Puppet[:debug]
- end
# run through all of the existing test files and make sure everything
# works
@@ -303,49 +299,6 @@
assert_equal(fakename, name)
assert_equal(fakeip, ip)
end
-
- if Puppet.features.rails?
- 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
end
# $Id$
Modified: trunk/test/rails/host.rb
===================================================================
--- trunk/test/rails/host.rb 2007-06-18 20:10:35 UTC (rev 2615)
+++ trunk/test/rails/host.rb 2007-06-18 21:03:18 UTC (rev 2616)
@@ -12,7 +12,8 @@
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 @@
}
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 @@
"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
[Attachment #3 (text/html)]
<p><b>luke</b> 2007-06-18 23:03:18 +0200 (Mon, 18 Jun 2007)</p><p>Fixing some failing tests.<br>
</p><hr noshade><pre><font color="gray">Modified: trunk/lib/puppet/network/handler/master.rb
===================================================================
--- trunk/lib/puppet/network/handler/master.rb 2007-06-18 20:10:35 UTC (rev 2615)
+++ trunk/lib/puppet/network/handler/master.rb 2007-06-18 21:03:18 UTC (rev 2616)
@@ -71,7 +71,7 @@
host = Puppet::Rails::Host.find_or_create_by_name(client)
host.last_freshcheck = Time.now
- if clientip and (! host.ip or host.ip == "")
+ if clientip and (! host.ip or host.ip == "" or host.ip == "NULL")
host.ip = clientip
end
host.save
Modified: trunk/lib/puppet/rails/host.rb
===================================================================
--- trunk/lib/puppet/rails/host.rb 2007-06-18 20:10:35 UTC (rev 2615)
+++ trunk/lib/puppet/rails/host.rb 2007-06-18 21:03:18 UTC (rev 2616)
@@ -95,6 +95,7 @@
ar_hash_merge(get_facts_hash(), facts,
:create => Proc.new { |name, values|
fact_name = Puppet::Rails::FactName.find_or_create_by_name(name)
+ values = [values] unless values.is_a?(Array)
values.each do |value|
fact_values.build(:value => value,
:fact_name => fact_name)
Modified: trunk/test/network/handler/master.rb
===================================================================
--- trunk/test/network/handler/master.rb 2007-06-18 20:10:35 UTC (rev 2615)
+++ trunk/test/network/handler/master.rb 2007-06-18 21:03:18 UTC (rev 2616)
@@ -7,10 +7,6 @@
class TestMaster < Test::Unit::TestCase
include PuppetTest::ServerTest
- def teardown
- super
- #print "</font>
<font color="black"></font>
<font color="black"></font>
<font color="black"></font>
<font color="gray">" if Puppet[:debug]
- end
# run through all of the existing test files and make sure everything
# works
@@ -303,49 +299,6 @@
assert_equal(fakename, name)
assert_equal(fakeip, ip)
end
-
- if Puppet.features.rails?
- 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
end
# $Id$
Modified: trunk/test/rails/host.rb
===================================================================
--- trunk/test/rails/host.rb 2007-06-18 20:10:35 UTC (rev 2615)
+++ trunk/test/rails/host.rb 2007-06-18 21:03:18 UTC (rev 2616)
@@ -12,7 +12,8 @@
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 @@
}
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 @@
"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
</font>
</pre>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic