Sha256: 14bfdb49edc130bed3f84225f3e28edb89296440a3674820c846549ed392a2d2

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

#!/usr/bin/env ruby

$:.unshift("../../lib") if __FILE__ =~ /\.rb$/

require 'puppettest'
require 'mocha'

class TestInterfaceType < PuppetTest::TestCase
    confine "Could not find suitable interface provider" => Puppet::Type.type(:interface).suitableprovider.length > 0

    def setup
        super
        @type = Puppet::Type.type(:interface)
    end

    def test_prefetch
        interface = @type.create(:name => "127.0.0.1", :interface => "lo0", :check => :all)

        @type.suitableprovider.each do |provider|
            assert_nothing_raised("Could not prefetch interfaces from %s provider" % provider.name) do
                provider.prefetch("eth0" => interface)
            end
        end
    end

    def test_instances
        @type.suitableprovider.each do |provider|
            list = nil
            assert_nothing_raised("Could not get instance list from %s" % provider.name) do
                list = provider.instances
            end
            assert(list.length > 0, "Did not get any instances from %s" % provider.name)
            list.each do |interface|
                assert_instance_of(provider, interface, "%s provider returned something other than a provider instance" % provider.name)
            end
        end
    end
end

# $Id: interface.rb 2750 2007-08-06 17:59:37Z luke $

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puppet-0.23.2 test/ral/types/interface.rb