summaryrefslogtreecommitdiffstats
path: root/test/other
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-30 01:12:38 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-30 01:12:38 +0000
commitdc580cf1258f62ce2cb690f132f231d76fa010ff (patch)
tree9d1b688a9c0d31e6a2bfebe2215bf068fabc6c16 /test/other
parente418691b32f470bf78efd19a792f46b05645d86f (diff)
downloadpuppet-dc580cf1258f62ce2cb690f132f231d76fa010ff.tar.gz
puppet-dc580cf1258f62ce2cb690f132f231d76fa010ff.tar.xz
puppet-dc580cf1258f62ce2cb690f132f231d76fa010ff.zip
Fixing #433. I basically just added checks to all the places where I add edges, to make sure automatic relationships lose out to explicit ones.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2117 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/other')
-rwxr-xr-xtest/other/transactions.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/other/transactions.rb b/test/other/transactions.rb
index c9d0cec1c..866c5551d 100755
--- a/test/other/transactions.rb
+++ b/test/other/transactions.rb
@@ -1027,6 +1027,39 @@ class TestTransactions < Test::Unit::TestCase
assert_apply(obj)
assert(obj.refreshed, "object was not refreshed during transaction")
end
+
+ # Testing #433
+ def test_explicit_dependencies_beat_automatic
+ # Create a couple of different resource sets that have automatic relationships and make sure the manual relationships win
+ rels = {}
+ # First users and groups
+ group = Puppet::Type.type(:group).create(:name => nonrootgroup.name, :ensure => :present)
+ user = Puppet::Type.type(:user).create(:name => nonrootuser.name, :ensure => :present, :gid => group.title)
+
+ # Now add the explicit relationship
+ group[:require] = user
+ rels[group] = user
+ # Now files
+ d = tempfile()
+ f = File.join(d, "file")
+ file = Puppet::Type.newfile(:path => f, :content => "yay")
+ dir = Puppet::Type.newfile(:path => d, :ensure => :directory, :require => file)
+
+ rels[dir] = file
+ rels.each do |after, before|
+ comp = newcomp(before, after)
+ trans = comp.evaluate
+ str = "from %s to %s" % [before, after]
+
+ assert_nothing_raised("Failed to create graph %s" % str) do
+ trans.prepare
+ end
+
+ graph = trans.relgraph
+ assert(graph.edge?(before, after), "did not create manual relationship %s" % str)
+ assert(! graph.edge?(after, before), "created automatic relationship %s" % str)
+ end
+ end
end
# $Id$