summaryrefslogtreecommitdiffstats
path: root/test/language/snippets.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/language/snippets.rb')
-rwxr-xr-xtest/language/snippets.rb45
1 files changed, 11 insertions, 34 deletions
diff --git a/test/language/snippets.rb b/test/language/snippets.rb
index 7168a81d8..cc3859552 100755
--- a/test/language/snippets.rb
+++ b/test/language/snippets.rb
@@ -449,45 +449,24 @@ class TestSnippets < Test::Unit::TestCase
#eval("alias %s %s" % [testname, mname])
testname = ("test_" + mname).intern
self.send(:define_method, testname) {
+ Puppet[:manifest] = snippet(file)
facts = {
"hostname" => "testhost",
"domain" => "domain.com",
"ipaddress" => "127.0.0.1",
"fqdn" => "testhost.domain.com"
}
- Facter.stubs(:each)
- facts.each do |name, value|
- Facter.stubs(:value).with(name).returns(value)
- end
- # first parse the file
- server = Puppet::Network::Handler.master.new(
- :Manifest => snippet(file),
- :Local => true
- )
- facts = Puppet::Node::Facts.new("testhost", facts)
- Puppet::Node::Facts.stubs(:save)
- Puppet::Node::Facts.stubs(:find).returns(facts)
- client = Puppet::Network::Client.master.new(
- :Master => server,
- :Cache => false
- )
- client.class.stubs(:facts).returns(facts.values)
-
- assert(client.local)
- assert_nothing_raised {
- client.getconfig()
- }
- client = Puppet::Network::Client.master.new(
- :Master => server,
- :Cache => false
- )
+ node = Puppet::Node.new("testhost")
+ node.merge(facts)
- assert(client.local)
- # Now do it again
- Puppet::Type.allclear
- assert_nothing_raised {
- client.getconfig()
+ config = nil
+ assert_nothing_raised("Could not compile configuration") {
+ config = Puppet::Node::Configuration.find(node)
+ }
+
+ assert_nothing_raised("Could not convert configuration") {
+ config = config.extract_to_transportable.to_configuration
}
Puppet::Type.eachtype { |type|
@@ -500,12 +479,10 @@ class TestSnippets < Test::Unit::TestCase
assert(obj.name)
}
}
- @configuration = client.configuration
+ @configuration = config
assert_nothing_raised {
self.send(mname)
}
-
- client.clear
}
mname = mname.intern
end