blob: e513974fccf1fdc7dc221d15f0011415fc24065a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/usr/bin/env ruby
#
# Created by Luke Kanies on 2006-11-12.
# Copyright (c) 2006. All rights reserved.
require File.dirname(__FILE__) + '/../../../lib/puppettest'
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.instances
end
assert(list.length > 0)
list.each do |prov|
assert_instance_of(@provider, prov)
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 { |provider| 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
|