summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2008-05-16 16:08:56 +1000
committerJames Turnbull <james@lovedthanlost.net>2008-05-16 16:08:56 +1000
commit7897335318be2bb98187b570fb7c867ebe109c12 (patch)
treec337fc64373fa3424e0449907ca46ea142345ca3 /test
parent83ef1b0cda1b010eea3f7d001716ea52f7081c24 (diff)
parenta1409d73b4bb8acbf5db2f8d7a244c2bca81db14 (diff)
downloadpuppet-7897335318be2bb98187b570fb7c867ebe109c12.tar.gz
puppet-7897335318be2bb98187b570fb7c867ebe109c12.tar.xz
puppet-7897335318be2bb98187b570fb7c867ebe109c12.zip
Merge branch '0.24.x' of git://github.com/lak/puppet into 0.24.x
Diffstat (limited to 'test')
-rwxr-xr-xtest/ral/providers/provider.rb35
1 files changed, 28 insertions, 7 deletions
diff --git a/test/ral/providers/provider.rb b/test/ral/providers/provider.rb
index 2196fafce..70f606a37 100755
--- a/test/ral/providers/provider.rb
+++ b/test/ral/providers/provider.rb
@@ -37,12 +37,13 @@ class TestProvider < Test::Unit::TestCase
cleanup { Puppet::Type.rmtype(:provider_test) }
end
- def test_confine
- provider = newprovider
+ def test_confine_defaults_to_suitable
- assert(provider.suitable?,
- "Marked unsuitable with no confines")
+ provider = newprovider
+ assert(provider.suitable?, "Marked unsuitable with no confines")
+ end
+ def test_confine_results
{
{:true => true} => true,
{:true => false} => false,
@@ -54,6 +55,8 @@ class TestProvider < Test::Unit::TestCase
{:exists => echo} => true,
{:exists => "/this/file/does/not/exist"} => false,
}.each do |hash, result|
+ provider = newprovider
+
# First test :true
hash.each do |test, val|
assert_nothing_raised do
@@ -61,19 +64,25 @@ class TestProvider < Test::Unit::TestCase
end
end
- assert_equal(result, provider.suitable?,
- "Failed for %s" % [hash.inspect])
+ assert_equal(result, provider.suitable?, "Failed for %s" % [hash.inspect])
provider.initvars
end
+ end
+
+ def test_multiple_confines_do_not_override
+ provider = newprovider
# Make sure multiple confines don't overwrite each other
provider.confine :true => false
assert(! provider.suitable?)
provider.confine :true => true
assert(! provider.suitable?)
+ end
- provider.initvars
+ def test_one_failed_confine_is_sufficient
+
+ provider = newprovider
# Make sure we test multiple of them, and that a single false wins
provider.confine :true => true, :false => false
@@ -82,6 +91,18 @@ class TestProvider < Test::Unit::TestCase
assert(! provider.suitable?)
end
+ # #1197 - the binary should not be
+ def test_command_checks_for_binaries_each_time
+ provider = newprovider
+
+ provider.commands :testing => "/no/such/path"
+
+ provider.stubs(:binary).returns "/no/such/path"
+
+ provider.command(:testing)
+ assert_equal("/no/such/path", provider.command(:testing), "Did not return correct binary path")
+ end
+
def test_command
{:echo => "echo", :echo_with_path => echo, :missing => "nosuchcommand", :missing_qualified => "/path/to/nosuchcommand"}.each do |name, command|
provider = newprovider