summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-11 23:32:15 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-11 23:32:15 +0000
commitb3eb9f1a24ec9d0fc294ce0fe57c929df8baedf5 (patch)
tree0db7cb2f4adaace9e460ac31a101058183836910
parente287d1e1f1f4ff912ad8c049f8abe44d085011fa (diff)
downloadpuppet-b3eb9f1a24ec9d0fc294ce0fe57c929df8baedf5.tar.gz
puppet-b3eb9f1a24ec9d0fc294ce0fe57c929df8baedf5.tar.xz
puppet-b3eb9f1a24ec9d0fc294ce0fe57c929df8baedf5.zip
All tests should now pass, with the possible exception of some tests that might fail when all tests are run in one process.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1906 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-xtest/language/snippets.rb114
-rw-r--r--test/lib/puppettest/support/assertions.rb1
-rwxr-xr-xtest/providers/parsedfile.rb13
-rwxr-xr-xtest/types/user.rb4
4 files changed, 42 insertions, 90 deletions
diff --git a/test/language/snippets.rb b/test/language/snippets.rb
index 45137f917..ccf8a3576 100755
--- a/test/language/snippets.rb
+++ b/test/language/snippets.rb
@@ -149,7 +149,7 @@ class TestSnippets < Test::Unit::TestCase
def test_nothing
end
- def snippet_filecreate(trans)
+ def snippet_filecreate
%w{a b c d}.each { |letter|
file = "/tmp/create%stest" % letter
Puppet.info "testing %s" % file
@@ -161,29 +161,16 @@ class TestSnippets < Test::Unit::TestCase
file = "/tmp/create%stest" % letter
assert(File.stat(file).mode & 007777 == 0755)
}
-
- assert_nothing_raised {
- trans.rollback
- }
- %w{a b c d}.each { |letter|
- file = "/tmp/create%stest" % letter
- assert(! FileTest.exists?(file), "File %s still exists" % file)
- }
end
- def snippet_simpledefaults(trans)
+ def snippet_simpledefaults
file = "/tmp/defaulttest"
@@tmpfiles << file
assert(FileTest.exists?(file), "File %s does not exist" % file)
assert(File.stat(file).mode & 007777 == 0755)
-
- assert_nothing_raised {
- trans.rollback
- }
- assert(! FileTest.exists?(file), "%s still exists" % file)
end
- def snippet_simpleselector(trans)
+ def snippet_simpleselector
files = %w{a b c d}.collect { |letter|
"/tmp/snippetselect%stest" % letter
}
@@ -195,16 +182,9 @@ class TestSnippets < Test::Unit::TestCase
"File %s is the incorrect mode" % file)
@@tmpfiles << file
}
-
- assert_nothing_raised {
- trans.rollback
- }
- files.each { |file|
- assert(! FileTest.exists?(file), "%s still exists" % file)
- }
end
- def snippet_classpathtest(trans)
+ def snippet_classpathtest
file = "/tmp/classtest"
@@tmpfiles << file
@@ -221,14 +201,9 @@ class TestSnippets < Test::Unit::TestCase
obj.path)
#Puppet.err obj.path
}
-
- assert_nothing_raised {
- trans.rollback
- }
- assert(! FileTest.exists?(file), "%s still exists" % file)
end
- def snippet_argumentdefaults(trans)
+ def snippet_argumentdefaults
file1 = "/tmp/argumenttest1"
file2 = "/tmp/argumenttest2"
@@tmpfiles << file1
@@ -241,7 +216,7 @@ class TestSnippets < Test::Unit::TestCase
assert(File.stat(file2).mode & 007777 == 0644)
end
- def snippet_casestatement(trans)
+ def snippet_casestatement
files = %w{
/tmp/existsfile
/tmp/existsfile2
@@ -254,13 +229,9 @@ class TestSnippets < Test::Unit::TestCase
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 snippet_implicititeration(trans)
+ def snippet_implicititeration
files = %w{a b c d e f g h}.collect { |l| "/tmp/iteration%stest" % l }
files.each { |file|
@@ -270,17 +241,9 @@ class TestSnippets < Test::Unit::TestCase
"File %s is not 755" % file)
}
-
- assert_nothing_raised {
- trans.rollback
- }
-
- files.each { |file|
- assert(! FileTest.exists?(file), "file %s still exists" % file)
- }
end
- def snippet_multipleinstances(trans)
+ def snippet_multipleinstances
files = %w{a b c}.collect { |l| "/tmp/multipleinstances%s" % l }
files.each { |file|
@@ -290,17 +253,9 @@ class TestSnippets < Test::Unit::TestCase
"File %s is not 755" % file)
}
-
- assert_nothing_raised {
- trans.rollback
- }
-
- files.each { |file|
- assert(! FileTest.exists?(file), "file %s still exists" % file)
- }
end
- def snippet_namevartest(trans)
+ def snippet_namevartest
file = "/tmp/testfiletest"
dir = "/tmp/testdirtest"
@@tmpfiles << file
@@ -309,7 +264,7 @@ class TestSnippets < Test::Unit::TestCase
assert(FileTest.directory?(dir), "Directory %s does not exist" % dir)
end
- def snippet_scopetest(trans)
+ def snippet_scopetest
file = "/tmp/scopetest"
@@tmpfiles << file
assert(FileTest.file?(file), "File %s does not exist" % file)
@@ -317,7 +272,7 @@ class TestSnippets < Test::Unit::TestCase
"File %s is not 755" % file)
end
- def snippet_failmissingexecpath(trans)
+ def snippet_failmissingexecpath
file = "/tmp/exectesting1"
execfile = "/tmp/execdisttesting"
@@tmpfiles << file
@@ -325,7 +280,7 @@ class TestSnippets < Test::Unit::TestCase
assert(!FileTest.exists?(execfile), "File %s exists" % execfile)
end
- def snippet_selectorvalues(trans)
+ def snippet_selectorvalues
nums = %w{1 2 3 4 5}
files = nums.collect { |n|
"/tmp/selectorvalues%s" % n
@@ -339,7 +294,7 @@ class TestSnippets < Test::Unit::TestCase
}
end
- def snippet_singleselector(trans)
+ def snippet_singleselector
nums = %w{1 2 3}
files = nums.collect { |n|
"/tmp/singleselector%s" % n
@@ -353,13 +308,13 @@ class TestSnippets < Test::Unit::TestCase
}
end
- def snippet_falsevalues(trans)
+ def snippet_falsevalues
file = "/tmp/falsevaluesfalse"
@@tmpfiles << file
assert(FileTest.exists?(file), "File %s does not exist" % file)
end
- def disabled_snippet_classargtest(trans)
+ def disabled_snippet_classargtest
[1,2].each { |num|
file = "/tmp/classargtest%s" % num
@@tmpfiles << file
@@ -369,7 +324,7 @@ class TestSnippets < Test::Unit::TestCase
}
end
- def snippet_classheirarchy(trans)
+ def snippet_classheirarchy
[1,2,3].each { |num|
file = "/tmp/classheir%s" % num
@@tmpfiles << file
@@ -379,7 +334,7 @@ class TestSnippets < Test::Unit::TestCase
}
end
- def snippet_singleary(trans)
+ def snippet_singleary
[1,2,3,4].each { |num|
file = "/tmp/singleary%s" % num
@@tmpfiles << file
@@ -387,7 +342,7 @@ class TestSnippets < Test::Unit::TestCase
}
end
- def snippet_classincludes(trans)
+ def snippet_classincludes
[1,2,3].each { |num|
file = "/tmp/classincludes%s" % num
@@tmpfiles << file
@@ -397,19 +352,19 @@ class TestSnippets < Test::Unit::TestCase
}
end
- def snippet_componentmetaparams(trans)
+ def snippet_componentmetaparams
["/tmp/component1", "/tmp/component2"].each { |file|
assert(FileTest.file?(file), "File %s does not exist" % file)
}
end
- def snippet_aliastest(trans)
+ def snippet_aliastest
%w{/tmp/aliastest /tmp/aliastest2 /tmp/aliastest3}.each { |file|
assert(FileTest.file?(file), "File %s does not exist" % file)
}
end
- def snippet_singlequote(trans)
+ def snippet_singlequote
{ 1 => 'a $quote',
2 => 'some "\yayness\"'
}.each { |count, str|
@@ -423,12 +378,12 @@ class TestSnippets < Test::Unit::TestCase
# There's no way to actually retrieve the list of classes from the
# transaction.
- def snippet_tag(trans)
+ def snippet_tag
@@tmpfiles << "/tmp/settestingness"
end
# Make sure that set tags are correctly in place, yo.
- def snippet_tagged(trans)
+ def snippet_tagged
tags = {"testing" => true, "yayness" => false,
"both" => false, "bothtrue" => true, "define" => true}
@@ -441,13 +396,13 @@ class TestSnippets < Test::Unit::TestCase
end
end
- def snippet_defineoverrides(trans)
+ def snippet_defineoverrides
file = "/tmp/defineoverrides1"
assert(FileTest.exists?(file), "File does not exist")
assert_equal(0755, filemode(file))
end
- def snippet_deepclassheirarchy(trans)
+ def snippet_deepclassheirarchy
5.times { |i|
i += 1
file = "/tmp/deepclassheir%s" % i
@@ -455,37 +410,37 @@ class TestSnippets < Test::Unit::TestCase
}
end
- def snippet_emptyclass(trans)
+ def snippet_emptyclass
# There's nothing to check other than that it works
end
- def snippet_emptyexec(trans)
+ def snippet_emptyexec
assert(FileTest.exists?("/tmp/emptyexectest"),
"Empty exec was ignored")
@@tmpfiles << "/tmp/emptyexextest"
end
- def snippet_multisubs(trans)
+ def snippet_multisubs
path = "/tmp/multisubtest"
assert(FileTest.exists?(path), "Did not create file")
assert_equal("sub2", File.read(path), "sub2 did not override content")
assert_equal(0755, filemode(path), "sub1 did not override mode")
end
- def snippet_collection(trans)
+ def snippet_collection
assert(FileTest.exists?("/tmp/colltest1"), "Did not collect file")
assert(! FileTest.exists?("/tmp/colltest2"), "Incorrectly collected file")
end
- def snippet_virtualresources(trans)
+ def snippet_virtualresources
%w{1 2 3 4}.each do |num|
assert(FileTest.exists?("/tmp/virtualtest#{num}"),
"Did not collect file #{num}")
end
end
- def disabled_snippet_dirchmod(trans)
+ def disabled_snippet_dirchmod
dirs = %w{a b}.collect { |letter|
"/tmp/dirchmodtest%s" % letter
}
@@ -498,10 +453,6 @@ class TestSnippets < Test::Unit::TestCase
assert(File.stat("/tmp/dirchmodtesta").mode & 007777 == 0755)
assert(File.stat("/tmp/dirchmodtestb").mode & 007777 == 0700)
-
- assert_nothing_raised {
- trans.rollback
- }
end
# Iterate across each of the snippets and create a test.
@@ -540,7 +491,6 @@ class TestSnippets < Test::Unit::TestCase
assert_nothing_raised {
client.getconfig()
}
- trans = nil
assert_nothing_raised {
trans = client.apply()
}
@@ -560,7 +510,7 @@ class TestSnippets < Test::Unit::TestCase
}
}
assert_nothing_raised {
- self.send(mname, trans)
+ self.send(mname)
}
client.clear
diff --git a/test/lib/puppettest/support/assertions.rb b/test/lib/puppettest/support/assertions.rb
index ac3baf4df..75056b0db 100644
--- a/test/lib/puppettest/support/assertions.rb
+++ b/test/lib/puppettest/support/assertions.rb
@@ -85,6 +85,7 @@ module PuppetTest
assert_nothing_raised("Failed to evaluate transaction") {
events = trans.evaluate.collect { |e| e.event }
}
+ trans.cleanup
Puppet.type(:component).delete(comp)
events
end
diff --git a/test/providers/parsedfile.rb b/test/providers/parsedfile.rb
index e4c68dd0c..252bf26b2 100755
--- a/test/providers/parsedfile.rb
+++ b/test/providers/parsedfile.rb
@@ -5,6 +5,7 @@ $:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/
require 'puppettest'
require 'puppettest/fileparsing'
require 'puppet'
+require 'puppet/filetype'
require 'puppet/provider/parsedfile'
require 'facter'
@@ -12,7 +13,7 @@ class TestParsedFile < Test::Unit::TestCase
include PuppetTest
include PuppetTest::FileParsing
- Puppet::Type.newtype(:parsedfiletype) do
+ Puppet::Type.newtype(:testparsedfiletype) do
ensurable
newstate(:one) do
newvalue(:a)
@@ -57,7 +58,7 @@ class TestParsedFile < Test::Unit::TestCase
def setup
super
- @type = Puppet::Type.type(:parsedfiletype)
+ @type = Puppet::Type.type(:testparsedfiletype)
end
def teardown
@@ -85,7 +86,7 @@ class TestParsedFile < Test::Unit::TestCase
end
# Now make sure they stay around
- fakemodel = fakemodel(:parsedfiletype, "yay")
+ fakemodel = fakemodel(:testparsedfiletype, "yay")
file = prov.new(fakemodel)
@@ -529,7 +530,7 @@ class TestParsedFile < Test::Unit::TestCase
prov.target_object(:yayness).write "bill a c\njill b d"
- list = Puppet::Type.type(:parsedfiletype).list
+ list = @type.list
bill = list.find { |r| r[:name] == "bill" }
jill = list.find { |r| r[:name] == "jill" }
@@ -564,7 +565,7 @@ class TestParsedFile < Test::Unit::TestCase
# Now make a model
bill = nil
assert_nothing_raised do
- bill = Puppet::Type.type(:parsedfiletype).create :name => "bill"
+ bill = @type.create :name => "bill"
end
assert_equal("a", bill.provider.one,
@@ -581,7 +582,7 @@ class TestParsedFile < Test::Unit::TestCase
bill = nil
assert_nothing_raised do
- bill = Puppet::Type.type(:parsedfiletype).create :name => "bill",
+ bill = @type.create :name => "bill",
:one => "a", :two => "c"
end
diff --git a/test/types/user.rb b/test/types/user.rb
index 958434fa5..41231a687 100755
--- a/test/types/user.rb
+++ b/test/types/user.rb
@@ -182,7 +182,7 @@ class TestUser < Test::Unit::TestCase
rescue ArgumentError => detail
next
end
- old != group.gid
+ old != group.gid and group.gid > 0
}
unless newgid
@@ -200,7 +200,7 @@ class TestUser < Test::Unit::TestCase
# then by id
newgid = Etc.getgrnam(newgid).gid
- assert_nothing_raised("Failed to specify group by id") {
+ assert_nothing_raised("Failed to specify group by id for %s" % newgid) {
user[:gid] = newgid
}