summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-08-24 02:53:17 +0000
committerLuke Kanies <luke@madstop.com>2005-08-24 02:53:17 +0000
commit386ebee31dcc67ac5a7fb569ee58c2365e0666e1 (patch)
tree78db9c5928457c23907f87a2d105185bb6664e51 /test
parent583a9c6e2a7469e4ae3b72264010a5d8d0dab867 (diff)
downloadpuppet-386ebee31dcc67ac5a7fb569ee58c2365e0666e1.tar.gz
puppet-386ebee31dcc67ac5a7fb569ee58c2365e0666e1.tar.xz
puppet-386ebee31dcc67ac5a7fb569ee58c2365e0666e1.zip
replacing if statements with case statement, and adding defaults for both selectors and case statements
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@587 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/executables/tc_puppetd.rb2
-rwxr-xr-xtest/language/tc_snippets.rb30
-rw-r--r--test/parser/tc_parser.rb3
-rwxr-xr-xtest/types/tc_filesources.rb12
4 files changed, 38 insertions, 9 deletions
diff --git a/test/executables/tc_puppetd.rb b/test/executables/tc_puppetd.rb
index 235db386f..264bc80ef 100755
--- a/test/executables/tc_puppetd.rb
+++ b/test/executables/tc_puppetd.rb
@@ -45,7 +45,7 @@ class TestPuppetDExe < Test::Unit::TestCase
file = File.join($puppetbase, "examples", "code", "head")
output = nil
assert_nothing_raised {
- output = %x{puppetmasterd --manifest #{file}}.chomp
+ output = %x{puppetmasterd --port #{Puppet[:masterport]} --manifest #{file}}.chomp
}
assert($? == 0)
@@tmppids << $?.pid
diff --git a/test/language/tc_snippets.rb b/test/language/tc_snippets.rb
index b207d8a92..338755575 100755
--- a/test/language/tc_snippets.rb
+++ b/test/language/tc_snippets.rb
@@ -267,6 +267,23 @@ class TestSnippets < Test::Unit::TestCase
assert(File.stat(file2).mode & 007777 == 0644)
end
+ def snippet_casestatement(trans)
+ files = %w{
+ /tmp/existsfile
+ /tmp/existsfile2
+ /tmp/existsfile3
+ }
+
+ files.each { |file|
+ assert(FileTest.exists?(file), "File %s is missing" % file)
+ assert(File.stat(file).mode & 007777 == 0755, "File %s is not 755" % file)
+ }
+
+ assert_nothing_raised {
+ trans.rollback
+ }
+ end
+
def disabled_snippet_dirchmod(trans)
dirs = %w{a b}.collect { |letter|
"/tmp/dirchmodtest%s" % letter
@@ -306,9 +323,16 @@ class TestSnippets < Test::Unit::TestCase
)
assert(client.local)
- client.getconfig()
- trans = client.config()
- self.send(mname, trans)
+ assert_nothing_raised {
+ client.getconfig()
+ }
+ trans = nil
+ assert_nothing_raised {
+ trans = client.config()
+ }
+ assert_nothing_raised {
+ self.send(mname, trans)
+ }
}
mname = mname.intern
#eval("alias %s %s" % [testname, mname])
diff --git a/test/parser/tc_parser.rb b/test/parser/tc_parser.rb
index b88bd8116..f8075d56c 100644
--- a/test/parser/tc_parser.rb
+++ b/test/parser/tc_parser.rb
@@ -1,7 +1,6 @@
if __FILE__ == $0
$:.unshift '../../lib'
- $:.unshift '../../../../library/trunk/lib/'
- $:.unshift '../../../../library/trunk/test/'
+ $:.unshift '..'
$puppetbase = "../.."
end
diff --git a/test/types/tc_filesources.rb b/test/types/tc_filesources.rb
index ed9a26f38..ba10eaacd 100755
--- a/test/types/tc_filesources.rb
+++ b/test/types/tc_filesources.rb
@@ -310,9 +310,12 @@ class TestFileSources < Test::Unit::TestCase
assert(klass[file3])
end
- def test_zzSimpleNetworkSources
+ def test_SimpleNetworkSources
server = nil
- basedir = "/tmp/networksourcetesting"
+ basedir = "/tmp/simplnetworksourcetesting"
+ if File.exists?(basedir)
+ system("rm -rf %s" % basedir)
+ end
Dir.mkdir(basedir)
Puppet[:puppetconf] = basedir
@@ -384,9 +387,12 @@ class TestFileSources < Test::Unit::TestCase
}
end
- def test_zzNetworkSources
+ def test_NetworkSources
server = nil
basedir = "/tmp/networksourcetesting"
+ if File.exists?(basedir)
+ system("rm -rf %s" % basedir)
+ end
Dir.mkdir(basedir)
Puppet[:puppetconf] = basedir