summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-02-15 21:56:54 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-02-15 21:56:54 +0000
commit037b7acab071adc727fbed8cfc3cea1c0399c2e2 (patch)
treea659e17c133ddb93664a67dc16bad9d257bf66ce /test
parent6fe01cedeb2fe00df62bf63d7f7375d18d0663ca (diff)
Changed the parsedtype definition of exists(), and fixed a few smaller bugs. Last code commit before 0.13.2
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@915 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/language/interpreter.rb10
-rwxr-xr-xtest/test15
-rwxr-xr-xtest/types/port.rb2
-rw-r--r--test/types/type.rb9
4 files changed, 30 insertions, 6 deletions
diff --git a/test/language/interpreter.rb b/test/language/interpreter.rb
index 6e8873986..bd112a8da 100755
--- a/test/language/interpreter.rb
+++ b/test/language/interpreter.rb
@@ -72,8 +72,15 @@ class TestInterpreter < Test::Unit::TestCase
# Only test ldap stuff on luke's network, since that's the only place we
# have data for.
if Facter["domain"].value == "madstop.com"
- def ldapconnect
+ begin
require 'ldap'
+ $haveldap = true
+ rescue LoadError
+ $stderr.puts "Missing ldap; skipping ldap source tests"
+ $haveldap = false
+ end
+ if $haveldap
+ def ldapconnect
@ldap = LDAP::Conn.new("ldap", 389)
@ldap.set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, 3 )
@@ -154,4 +161,5 @@ class TestInterpreter < Test::Unit::TestCase
}
end
end
+ end
end
diff --git a/test/test b/test/test
index d7e0e8477..f1ec37723 100755
--- a/test/test
+++ b/test/test
@@ -16,31 +16,38 @@ require 'getoptlong'
#[ "--size", "-s", GetoptLong::REQUIRED_ARGUMENT ],
result = GetoptLong.new(
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
+ [ "-n", GetoptLong::REQUIRED_ARGUMENT ],
[ "--help", "-h", GetoptLong::NO_ARGUMENT ]
)
usage = "USAGE: %s [--help] <testsuite> <testsuite> .." % $0
+opts = []
+
result.each { |opt,arg|
case opt
when "--debug"
- Puppet[:debug] = true
+ Puppet::Log.level = :debug
when "--help"
puts usage
exit
else
- raise "Invalid option '#{opt}'"
+ opts << opt << arg
+ #raise "Invalid option '#{opt}'"
end
}
-
suites = nil
if ARGV.length != 0
- suites = ARGV
+ suites = ARGV.dup
else
suites = PuppetTestSuite.list
end
+ARGV.clear
+
+opts.each { |o| ARGV << o }
+
suites.each { |suite|
PuppetTestSuite.new(suite)
}
diff --git a/test/types/port.rb b/test/types/port.rb
index c37f2dff0..77da6c825 100755
--- a/test/types/port.rb
+++ b/test/types/port.rb
@@ -186,6 +186,8 @@ class TestPort < Test::Unit::TestCase
port.retrieve
}
+ assert_equal(:present, port.is(:ensure))
+
assert(port.state(:alias).is == :absent)
port[:alias] = "yaytest"
diff --git a/test/types/type.rb b/test/types/type.rb
index abb3178c6..bb3a7f629 100644
--- a/test/types/type.rb
+++ b/test/types/type.rb
@@ -190,7 +190,14 @@ class TestType < Test::Unit::TestCase
# Verify that names are aliases, not equivalents
def test_nameasalias
file = nil
- path = tempfile()
+ # Create the parent dir, so we make sure autorequiring the parent dir works
+ parentdir = tempfile()
+ dir = Puppet.type(:file).create(
+ :name => parentdir,
+ :ensure => "directory"
+ )
+ assert_apply(dir)
+ path = File.join(parentdir, "subdir")
name = "a test file"
transport = Puppet::TransObject.new(name, "file")
transport[:path] = path