summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-05-25 06:24:44 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-05-25 06:24:44 +0000
commit4cd30194f18cdb792bc551080b95c0a6ce400de5 (patch)
tree8f3a38af03b0980b70e988d52c46088dd77165a1 /test
parent45a9edbe23c43b5e1c8e2c6683502a6a6ef54661 (diff)
downloadpuppet-4cd30194f18cdb792bc551080b95c0a6ce400de5.tar.gz
puppet-4cd30194f18cdb792bc551080b95c0a6ce400de5.tar.xz
puppet-4cd30194f18cdb792bc551080b95c0a6ce400de5.zip
Did some work on making sure object removal actually works, thus stopping some potential memory leaks. Also explicitly removed objects in more places, again hopefully forestalling memory leaks.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1224 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/language/snippets.rb12
-rw-r--r--test/puppettest.rb7
-rw-r--r--test/server/bucket.rb11
-rw-r--r--test/server/pelement.rb2
4 files changed, 22 insertions, 10 deletions
diff --git a/test/language/snippets.rb b/test/language/snippets.rb
index 0ba2fb6ed..f45a5799d 100755
--- a/test/language/snippets.rb
+++ b/test/language/snippets.rb
@@ -25,6 +25,7 @@ require 'puppettest'
class TestSnippets < Test::Unit::TestCase
include TestPuppet
+ include ObjectSpace
$snippetbase = File.join($puppetbase, "examples", "code", "snippets")
def file2ast(file)
@@ -186,7 +187,7 @@ class TestSnippets < Test::Unit::TestCase
assert_nothing_raised {
trans.rollback
}
- assert(! FileTest.exists?(file))
+ assert(! FileTest.exists?(file), "%s still exists" % file)
end
def snippet_simpleselector(trans)
@@ -206,7 +207,7 @@ class TestSnippets < Test::Unit::TestCase
trans.rollback
}
files.each { |file|
- assert(! FileTest.exists?(file))
+ assert(! FileTest.exists?(file), "%s still exists" % file)
}
end
@@ -231,7 +232,7 @@ class TestSnippets < Test::Unit::TestCase
assert_nothing_raised {
trans.rollback
}
- assert(! FileTest.exists?(file))
+ assert(! FileTest.exists?(file), "%s still exists" % file)
end
def snippet_argumentdefaults(trans)
@@ -523,16 +524,17 @@ class TestSnippets < Test::Unit::TestCase
assert(obj.name)
if obj.is_a?(Puppet.type(:file))
- @@tmpfiles << obj.name
+ @@tmpfiles << obj[:path]
end
}
}
assert_nothing_raised {
self.send(mname, trans)
}
+
+ client.clear
}
mname = mname.intern
- #eval("alias %s %s" % [testname, mname])
end
}
end
diff --git a/test/puppettest.rb b/test/puppettest.rb
index ce1a2918a..c65c95f49 100644
--- a/test/puppettest.rb
+++ b/test/puppettest.rb
@@ -7,6 +7,12 @@ require 'puppet'
require 'test/unit'
module TestPuppet
+ include ObjectSpace
+
+ def gcdebug(type)
+ Puppet.warning "%s: %s" % [type, ObjectSpace.each_object(type) { |o| }]
+ end
+
def newcomp(*ary)
name = nil
if ary[0].is_a?(String)
@@ -300,7 +306,6 @@ module TestPuppet
# If there are any fake data files, retrieve them
def fakedata(dir)
-
ary = [$puppetbase, "test"]
ary += dir.split("/")
dir = File.join(ary)
diff --git a/test/server/bucket.rb b/test/server/bucket.rb
index e9e13797d..3169781f8 100644
--- a/test/server/bucket.rb
+++ b/test/server/bucket.rb
@@ -22,9 +22,11 @@ class TestBucket < Test::Unit::TestCase
@num = 1
end
- Puppet.err "#{Process.pid}: %s: %s" % [@num, memory()]
+ #Puppet.err "#{Process.pid}: %s: %s" % [@num, memory()]
GC.start
+ #gcdebug(String)
end
+
# run through all of the files and exercise the filebucket methods
def checkfiles(client)
files = filelist()
@@ -66,6 +68,9 @@ class TestBucket < Test::Unit::TestCase
assert(tsum == osum)
# modify our tmp file
+ unless FileTest.writable?(tmppath)
+ File.chmod(0644, tmppath)
+ end
File.open(tmppath,File::WRONLY|File::TRUNC) { |wf|
wf.print "This is some test text\n"
}
@@ -109,7 +114,7 @@ class TestBucket < Test::Unit::TestCase
end
%w{
- who bash vim sh uname /etc/passwd /etc/syslog.conf /etc/hosts
+ who bash sh uname /etc/passwd /etc/syslog.conf /etc/hosts
}.each { |file|
# if it's fully qualified, just add it
if file =~ /^\//
@@ -234,7 +239,7 @@ class TestBucket < Test::Unit::TestCase
unless pid
raise "Uh, we don't have a child pid"
end
- system("kill %s" % pid)
+ Process.kill("TERM", pid)
end
end
diff --git a/test/server/pelement.rb b/test/server/pelement.rb
index 1a6458768..7bff1cb26 100644
--- a/test/server/pelement.rb
+++ b/test/server/pelement.rb
@@ -196,7 +196,7 @@ class TestPElementServer < Test::Unit::TestCase
Puppet.warning "%s does not respond to :list" % type.name
next
end
- #next unless type.name == :port
+ next unless type.name == :package
Puppet.info "Describing each %s" % type.name
# First do a listing from the server