summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-07-04 22:14:37 -0500
committerLuke Kanies <luke@madstop.com>2008-07-04 22:14:37 -0500
commitb0febd263c0cb8e61d512898f7c79868ea77e619 (patch)
tree3f35c4b2d7186d3c69c070c9edc684ccdc51f658 /test
parentdf528a66cafc8538c3208bf0b52fdbe1065f6e48 (diff)
parent81be1c5c3f85f514505e99fab5b8a2b2ae6fbec8 (diff)
downloadpuppet-b0febd263c0cb8e61d512898f7c79868ea77e619.tar.gz
puppet-b0febd263c0cb8e61d512898f7c79868ea77e619.tar.xz
puppet-b0febd263c0cb8e61d512898f7c79868ea77e619.zip
Merge branch '0.24.x'
Conflicts: lib/puppet/util/settings.rb spec/integration/defaults.rb spec/unit/node/catalog.rb spec/unit/type/interface.rb spec/unit/type/ssh_authorized_key.rb
Diffstat (limited to 'test')
-rw-r--r--test/lib/puppettest/support/utils.rb2
-rwxr-xr-xtest/other/propertychange.rb140
-rwxr-xr-xtest/other/transactions.rb11
-rwxr-xr-xtest/ral/type/sshkey.rb1
4 files changed, 6 insertions, 148 deletions
diff --git a/test/lib/puppettest/support/utils.rb b/test/lib/puppettest/support/utils.rb
index b749c7931..0d775d184 100644
--- a/test/lib/puppettest/support/utils.rb
+++ b/test/lib/puppettest/support/utils.rb
@@ -82,7 +82,7 @@ module PuppetTest::Support::Utils
newevents = nil
assert_nothing_raised("Transaction %s %s failed" % [type, msg]) {
newevents = trans.send(method).reject { |e| e.nil? }.collect { |e|
- e.event
+ e.name
}
}
diff --git a/test/other/propertychange.rb b/test/other/propertychange.rb
deleted file mode 100755
index eaa4f4082..000000000
--- a/test/other/propertychange.rb
+++ /dev/null
@@ -1,140 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Created by Luke A. Kanies on 2006-12-21.
-# Copyright (c) 2006. All rights reserved.
-
-require File.dirname(__FILE__) + '/../lib/puppettest'
-
-require 'puppettest'
-
-class TestPropertyChange < Test::Unit::TestCase
- include PuppetTest
- class FakeProperty < Puppet::Property
- attr_accessor :is, :should, :resource
- attr_reader :noop
- def change_to_s(currentvalue, newvalue)
- "fake change"
- end
- def insync?(is)
- is == @should
- end
- def log(msg)
- Puppet::Util::Log.create(
- :level => :info,
- :source => self,
- :message => msg
- )
- end
- def noop
- if defined? @noop
- @noop
- else
- false
- end
- end
- def path
- "fakechange"
- end
- def should_to_s(newvalue)
- newvalue.to_s
- end
- def sync
- if insync?(@is)
- return nil
- else
- @is = @should
- return :fake_change
- end
- end
- def to_s
- path
- end
- end
-
- def mkchange
- property = FakeProperty.new :resource => "fakeparent"
- property.is = :start
- property.should = :finish
- property.resource = :parent
- change = nil
- assert_nothing_raised do
- change = Puppet::PropertyChange.new(property, :start)
- end
- change.transaction = :trans
-
- assert_equal(:start, change.is, "@is did not get copied")
- assert_equal(:finish, change.should, "@should did not get copied")
- assert_equal(%w{fakechange change}, change.path, "path did not get set correctly")
-
- assert(! change.changed?, "change defaulted to already changed")
-
- return change
- end
-
- def test_go
- change = mkchange
-
- coll = logcollector()
-
- events = nil
- # First make sure we get an immediate return
- assert_nothing_raised do
- events = change.go
- end
- assert_instance_of(Array, events, "events were not returned in an array")
- assert_instance_of(Puppet::Event, events[0], "event array did not contain events")
-
- event = events.shift
- {:event => :fake_change, :transaction => :trans, :source => :parent}.each do |method, val|
- assert_equal(val, event.send(method), "Event did not set %s correctly" % method)
- end
-
- # Disabled, because it fails when running the whole suite at once.
- #assert(coll.detect { |l| l.message == "fake change" }, "Did not log change")
- assert_equal(change.property.is, change.property.should, "did not call sync method")
-
- # Now make sure that proxy sources can be set.
- assert_nothing_raised do
- change.proxy = :other
- end
- # Reset, so we change again
- change.property.is = :start
- change.is = :start
- assert_nothing_raised do
- events = change.go
- end
-
- assert_instance_of(Array, events, "events were not returned in an array")
- assert_instance_of(Puppet::Event, events[0], "event array did not contain events")
-
- event = events.shift
- {:event => :fake_change, :transaction => :trans, :source => :other}.each do |method, val|
- assert_equal(val, event.send(method), "Event did not set %s correctly" % method)
- end
-
- #assert(coll.detect { |l| l.message == "fake change" }, "Did not log change")
- assert_equal(change.property.is, change.property.should, "did not call sync method")
- end
-
- # Related to #542. Make sure changes in noop mode produce the :noop event.
- def test_noop_event
- change = mkchange
-
- assert(! change.skip?, "Change is already being skipped")
-
- Puppet[:noop] = true
-
- change.property.noop = true
- assert(change.noop, "did not set noop")
- assert(change.skip?, "setting noop did not mark change for skipping")
-
- event = nil
- assert_nothing_raised("Could not generate noop event") do
- event = change.forward
- end
-
- assert_equal(1, event.length, "got wrong number of events")
- assert_equal(:noop, event[0].event, "did not generate noop mode when in noop")
- end
-end
-
diff --git a/test/other/transactions.rb b/test/other/transactions.rb
index 28f0d2940..2dce5aa6a 100755
--- a/test/other/transactions.rb
+++ b/test/other/transactions.rb
@@ -792,7 +792,7 @@ class TestTransactions < Test::Unit::TestCase
def test_proxy_resources
type = mkreducer do
def evaluate
- return Puppet::PropertyChange.new(Fakeprop.new(
+ return Puppet::Transaction::Change.new(Fakeprop.new(
:path => :path, :is => :is, :should => :should, :name => self.name, :resource => "a parent"), :is)
end
end
@@ -811,7 +811,7 @@ class TestTransactions < Test::Unit::TestCase
assert(changes.length > 0, "did not get any changes")
changes.each do |change|
- assert_equal(resource, change.source, "change did not get proxy set correctly")
+ assert_equal(resource, change.resource, "change did not get proxy set correctly")
end
end
@@ -901,10 +901,9 @@ class TestTransactions < Test::Unit::TestCase
assert(result, "c did not trigger anything")
assert_instance_of(Array, result)
event = result.shift
- assert_instance_of(Puppet::Event, event)
- assert_equal(:triggered, event.event, "event was not set correctly")
+ assert_instance_of(Puppet::Transaction::Event, event)
+ assert_equal(:triggered, event.name, "event was not set correctly")
assert_equal(c, event.source, "source was not set correctly")
- assert_equal(trans, event.transaction, "transaction was not set correctly")
assert(trans.triggered?(c, :refresh),
"Transaction did not store the trigger")
@@ -991,7 +990,7 @@ class TestTransactions < Test::Unit::TestCase
newparam(:name) {}
newproperty(:testing) do
def sync
- self.is = self.should
+ # noop
:ran_testing
end
end
diff --git a/test/ral/type/sshkey.rb b/test/ral/type/sshkey.rb
index 333bc377d..46c9f92de 100755
--- a/test/ral/type/sshkey.rb
+++ b/test/ral/type/sshkey.rb
@@ -3,7 +3,6 @@
require File.dirname(__FILE__) + '/../../lib/puppettest'
require 'puppettest'
-require 'puppet/type/sshkey'
require 'facter'
class TestSSHKey < Test::Unit::TestCase