summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-11-13 04:20:57 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-11-13 04:20:57 +0000
commit4e96031745a215b84f1ae45916050f35741f9201 (patch)
tree929ae6e35efe6ffcd417dad1a43bb1d22061b841 /test
parent064ddbc218c56de91318c9dfedc481e67ed60750 (diff)
downloadpuppet-4e96031745a215b84f1ae45916050f35741f9201.tar.gz
puppet-4e96031745a215b84f1ae45916050f35741f9201.tar.xz
puppet-4e96031745a215b84f1ae45916050f35741f9201.zip
Adding a NetInfo provider for hosts. Yay!
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1865 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/providers/netinfo_host.rb58
1 files changed, 58 insertions, 0 deletions
diff --git a/test/providers/netinfo_host.rb b/test/providers/netinfo_host.rb
new file mode 100755
index 000000000..e6bbc22d6
--- /dev/null
+++ b/test/providers/netinfo_host.rb
@@ -0,0 +1,58 @@
+#!/usr/bin/env ruby
+#
+# Created by Luke Kanies on 2006-11-12.
+# Copyright (c) 2006. All rights reserved.
+
+$:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/
+
+require 'puppettest'
+
+if Puppet::Type.type(:host).provider(:netinfo).suitable?
+class TestNetinfoHostProvider < Test::Unit::TestCase
+ include PuppetTest
+
+ def setup
+ super
+ @host = Puppet::Type.type(:host)
+ @provider = @host.provider(:netinfo)
+ end
+
+ def test_list
+ list = nil
+ assert_nothing_raised do
+ list = @provider.list
+ end
+ assert(list.length > 0)
+ list.each do |obj|
+ prov = obj.provider
+ assert_instance_of(@host, obj)
+ assert(prov.name, "objects do not have names")
+ assert(prov.ip, "Did not get value for device in %s" % prov.ip)
+ end
+
+ assert(list.detect { |m| m.provider.name == "localhost"}, "Could not find localhost")
+ end
+
+ if Process.uid == 0
+ def test_simple
+ localhost = nil
+ assert_nothing_raised do
+ localhost = @host.create :name => "localhost", :check => [:ip], :provider => :netinfo
+ end
+
+ assert_nothing_raised do
+ localhost.retrieve
+ end
+
+ prov = localhost.provider
+
+ assert_nothing_raised do
+ assert(prov.ip, "Did not find value for ip")
+ assert(prov.ip != :absent, "Netinfo thinks the localhost is missing")
+ end
+ end
+end
+end
+end
+
+# $Id$ \ No newline at end of file