Moving some test/ package tests to rspec integration tests
and disabling a gem test that hangs forever for me. Signed-off-by: Luke Kanies <luke@madstop.com>
This commit is contained in:
Родитель
85d3ae02fb
Коммит
54abe7084d
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") }
|
||||
|
||||
describe "Package Provider" do
|
||||
Puppet::Type.type(:package).providers.each do |name|
|
||||
provider = Puppet::Type.type(:package).provider(name)
|
||||
|
||||
describe name do
|
||||
confine "Provider %s is not suitable" % name => provider.suitable?
|
||||
|
||||
it "should fail when asked to install an invalid package" do
|
||||
pending("This test hangs forever with recent versions of RubyGems") if provider.name == :gem
|
||||
pkg = Puppet::Type.newpackage :name => "nosuch%s" % provider.name.to_s, :provider => provider.name
|
||||
lambda { pkg.provider.install }.should raise_error
|
||||
end
|
||||
|
||||
it "should be able to get a list of existing packages" do
|
||||
provider.instances.each do |package|
|
||||
package.should be_instance_of(provider)
|
||||
package.properties[:provider].should == provider.name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -244,36 +244,5 @@ class TestPackageProvider < Test::Unit::TestCase
|
|||
pkg[:adminfile] = "/usr/local/pkg/admin_file"
|
||||
end
|
||||
end
|
||||
|
||||
# Make sure providers throw an error when you tell them to install a
|
||||
# non-existent package.
|
||||
def test_no_such_package
|
||||
Puppet::Type.type(:package).suitableprovider.each do |provider|
|
||||
assert_raise(ArgumentError, Puppet::Error, Puppet::ExecutionFailure,
|
||||
"Successfully installed nonexistent package with %s" % provider.name) {
|
||||
pkg = Puppet::Type.newpackage :name => "nosuch%s" % provider.name.to_s,
|
||||
:provider => provider.name
|
||||
provider = pkg.provider
|
||||
provider.install
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# Make sure all of the suitable providers on our platform can successfully
|
||||
# list.
|
||||
def test_instances
|
||||
Puppet::Type.type(:package).suitableprovider.each do |provider|
|
||||
result = nil
|
||||
assert_nothing_raised("Could not list %s packages" % provider.name) do
|
||||
result = provider.instances
|
||||
end
|
||||
result.each do |pkg|
|
||||
assert_instance_of(provider, pkg,
|
||||
"%s returned non-provider" % provider.name)
|
||||
assert_equal(provider.name, pkg.class.name,
|
||||
"Provider %s returned an instance of a different provider" % provider.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче