diff options
Diffstat (limited to 'test')
50 files changed, 327 insertions, 327 deletions
diff --git a/test/certmgr/certmgr.rb b/test/certmgr/certmgr.rb index 307420d6c..3cf743a85 100755 --- a/test/certmgr/certmgr.rb +++ b/test/certmgr/certmgr.rb @@ -32,7 +32,7 @@ class TestCertMgr < Test::Unit::TestCase ) } assert_nothing_raised { - cert = newcert.call() + cert = newcert.call } assert_nothing_raised { cert.mkselfsigned @@ -53,7 +53,7 @@ class TestCertMgr < Test::Unit::TestCase } assert_nothing_raised { - cert = newcert.call() + cert = newcert.call } assert_nothing_raised { cert.mkselfsigned @@ -110,13 +110,13 @@ class TestCertMgr < Test::Unit::TestCase def testCreateCA ca = nil assert_nothing_raised { - ca = Puppet::SSLCertificates::CA.new() + ca = Puppet::SSLCertificates::CA.new } # make the CA again and verify it doesn't fail because everything # still exists assert_nothing_raised { - ca = Puppet::SSLCertificates::CA.new() + ca = Puppet::SSLCertificates::CA.new } end diff --git a/test/certmgr/inventory.rb b/test/certmgr/inventory.rb index 71035ba03..1b2caf2c7 100755 --- a/test/certmgr/inventory.rb +++ b/test/certmgr/inventory.rb @@ -54,7 +54,7 @@ class TestCertInventory < Test::Unit::TestCase cert = mksignedcert(ca, "host.domain.com") assert_nothing_raised do - file = mock() + file = mock file.expects(:puts).with do |written| written.include? cert.subject.to_s end diff --git a/test/language/functions.rb b/test/language/functions.rb index 83bfe6e8e..eedcd35b0 100755 --- a/test/language/functions.rb +++ b/test/language/functions.rb @@ -173,7 +173,7 @@ class TestLangFunctions < Test::Unit::TestCase # Now make sure we can fully qualify files, and specify just one def test_singletemplates - template = tempfile() + template = tempfile File.open(template, "w") do |f| f.puts "template <%= @yay.nil?() ? raise('yay undefined') : @yay %>" @@ -215,7 +215,7 @@ class TestLangFunctions < Test::Unit::TestCase # Make sure that legacy template variable access works as expected. def test_legacyvariables - template = tempfile() + template = tempfile File.open(template, "w") do |f| f.puts "template <%= deprecated %>" @@ -257,7 +257,7 @@ class TestLangFunctions < Test::Unit::TestCase # Make sure that problems with kernel method visibility still exist. def test_kernel_module_shadows_deprecated_var_lookup - template = tempfile() + template = tempfile File.open(template, "w").puts("<%= binding %>") func = nil @@ -283,7 +283,7 @@ class TestLangFunctions < Test::Unit::TestCase end def test_tempatefunction_cannot_see_scopes - template = tempfile() + template = tempfile File.open(template, "w") do |f| f.puts "<%= lookupvar('myvar') %>" @@ -312,13 +312,13 @@ class TestLangFunctions < Test::Unit::TestCase end def test_template_reparses - template = tempfile() + template = tempfile File.open(template, "w") do |f| f.puts "original text" end - file = tempfile() + file = tempfile Puppet[:code] = %{file { "#{file}": content => template("#{template}") }} Puppet[:environment] = "yay" @@ -355,7 +355,7 @@ class TestLangFunctions < Test::Unit::TestCase end def test_template_defined_vars - template = tempfile() + template = tempfile File.open(template, "w") do |f| f.puts "template <%= @yayness %>" @@ -400,7 +400,7 @@ class TestLangFunctions < Test::Unit::TestCase #assert_equal(false, Puppet::Parser::Functions.function(:autofunc), # "Got told autofunc already exists") - dir = tempfile() + dir = tempfile $LOAD_PATH << dir newpath = File.join(dir, "puppet", "parser", "functions") FileUtils.mkdir_p(newpath) diff --git a/test/language/parser.rb b/test/language/parser.rb index a6ce8cf3f..70827634f 100755 --- a/test/language/parser.rb +++ b/test/language/parser.rb @@ -15,7 +15,7 @@ class TestParser < Test::Unit::TestCase def setup super Puppet[:parseonly] = true - #@lexer = Puppet::Parser::Lexer.new() + #@lexer = Puppet::Parser::Lexer.new end def teardown @@ -28,7 +28,7 @@ class TestParser < Test::Unit::TestCase Puppet::Node::Environment.clear parser = mkparser Puppet.debug("parsing #{file}") if __FILE__ == $0 - assert_nothing_raised() { + assert_nothing_raised { parser.file = file parser.parse } @@ -52,7 +52,7 @@ class TestParser < Test::Unit::TestCase def test_arrayrvalues parser = mkparser ret = nil - file = tempfile() + file = tempfile assert_nothing_raised { parser.string = "file { \"#{file}\": mode => [755, 640] }" } @@ -65,7 +65,7 @@ class TestParser < Test::Unit::TestCase def test_arrayrvalueswithtrailingcomma parser = mkparser ret = nil - file = tempfile() + file = tempfile assert_nothing_raised { parser.string = "file { \"#{file}\": mode => [755, 640,] }" } @@ -85,7 +85,7 @@ class TestParser < Test::Unit::TestCase end def test_importglobbing - basedir = File.join(tmpdir(), "importesting") + basedir = File.join(tmpdir, "importesting") @@tmpfiles << basedir Dir.mkdir(basedir) @@ -109,7 +109,7 @@ class TestParser < Test::Unit::TestCase end def test_nonexistent_import - basedir = File.join(tmpdir(), "importesting") + basedir = File.join(tmpdir, "importesting") @@tmpfiles << basedir Dir.mkdir(basedir) manifest = File.join(basedir, "manifest") @@ -124,7 +124,7 @@ class TestParser < Test::Unit::TestCase end def test_trailingcomma - path = tempfile() + path = tempfile str = %{file { "#{path}": ensure => file, } } @@ -137,10 +137,10 @@ class TestParser < Test::Unit::TestCase end def test_importedclasses - imported = tempfile() - importer = tempfile() + imported = tempfile + importer = tempfile - made = tempfile() + made = tempfile File.open(imported, "w") do |f| f.puts %{class foo { file { "#{made}": ensure => file }}} @@ -164,7 +164,7 @@ class TestParser < Test::Unit::TestCase # Make sure fully qualified and unqualified files can be imported def test_fqfilesandlocalfiles - dir = tempfile() + dir = tempfile Dir.mkdir(dir) importer = File.join(dir, "site.pp") fullfile = File.join(dir, "full.pp") @@ -176,14 +176,14 @@ class TestParser < Test::Unit::TestCase f.puts %{import "#{fullfile}"\ninclude full\nimport "local.pp"\ninclude local} end - fullmaker = tempfile() + fullmaker = tempfile files << fullmaker File.open(fullfile, "w") do |f| f.puts %{class full { file { "#{fullmaker}": ensure => file }}} end - localmaker = tempfile() + localmaker = tempfile files << localmaker File.open(localfile, "w") do |f| @@ -204,7 +204,7 @@ class TestParser < Test::Unit::TestCase # Make sure the parser adds '.pp' when necessary def test_addingpp - dir = tempfile() + dir = tempfile Dir.mkdir(dir) importer = File.join(dir, "site.pp") localfile = File.join(dir, "local.pp") @@ -215,7 +215,7 @@ class TestParser < Test::Unit::TestCase f.puts %{import "local"\ninclude local} end - file = tempfile() + file = tempfile files << file File.open(localfile, "w") do |f| @@ -232,7 +232,7 @@ class TestParser < Test::Unit::TestCase # Make sure that file importing changes file relative names. def test_changingrelativenames - dir = tempfile() + dir = tempfile Dir.mkdir(dir) Dir.mkdir(File.join(dir, "subdir")) top = File.join(dir, "site.pp") @@ -240,14 +240,14 @@ class TestParser < Test::Unit::TestCase subtwo = File.join(dir, "subdir/subtwo") files = [] - file = tempfile() + file = tempfile files << file File.open(subone + ".pp", "w") do |f| f.puts %{class one { file { "#{file}": ensure => file }}} end - otherfile = tempfile() + otherfile = tempfile files << otherfile File.open(subtwo + ".pp", "w") do |f| f.puts %{import "subone"\n class two inherits one { @@ -294,7 +294,7 @@ class TestParser < Test::Unit::TestCase end def test_emptyfile - file = tempfile() + file = tempfile File.open(file, "w") do |f| f.puts %{} end @@ -306,8 +306,8 @@ class TestParser < Test::Unit::TestCase end def test_multiple_nodes_named - file = tempfile() - other = tempfile() + file = tempfile + other = tempfile File.open(file, "w") do |f| f.puts %{ diff --git a/test/language/scope.rb b/test/language/scope.rb index 09bf8a1c5..0e99aa5ae 100755 --- a/test/language/scope.rb +++ b/test/language/scope.rb @@ -66,7 +66,7 @@ class TestScope < Test::Unit::TestCase "Recursive and non-recursive hash is identical for topscope") # Check the variable we expect is present. - assert_equal({"first" => "topval"}, topscope.to_hash(), "topscope returns the expected hash of variables") + assert_equal({"first" => "topval"}, topscope.to_hash, "topscope returns the expected hash of variables") # Now, check that midscope does the right thing in all cases. diff --git a/test/language/snippets.rb b/test/language/snippets.rb index fe22e46bf..d55b75e50 100755 --- a/test/language/snippets.rb +++ b/test/language/snippets.rb @@ -51,7 +51,7 @@ class TestSnippets < Test::Unit::TestCase end def file2ast(file) - parser = Puppet::Parser::Parser.new() + parser = Puppet::Parser::Parser.new parser.file = file ast = parser.parse @@ -59,7 +59,7 @@ class TestSnippets < Test::Unit::TestCase end def snippet2ast(text) - parser = Puppet::Parser::Parser.new() + parser = Puppet::Parser::Parser.new parser.string = text ast = parser.parse @@ -74,7 +74,7 @@ class TestSnippets < Test::Unit::TestCase end def ast2scope(ast) - scope = Puppet::Parser::Scope.new() + scope = Puppet::Parser::Scope.new ast.evaluate(scope) scope diff --git a/test/lib/puppettest.rb b/test/lib/puppettest.rb index 46d557341..c8a76267e 100755 --- a/test/lib/puppettest.rb +++ b/test/lib/puppettest.rb @@ -181,8 +181,8 @@ module PuppetTest ) unless defined? $user and $group - $user = nonrootuser().uid.to_s - $group = nonrootgroup().gid.to_s + $user = nonrootuser.uid.to_s + $group = nonrootgroup.gid.to_s end Puppet.settings.clear @@ -194,7 +194,7 @@ module PuppetTest Dir.mkdir(@configpath) unless File.exists?(@configpath) - @@tmpfiles << @configpath << tmpdir() + @@tmpfiles << @configpath << tmpdir @@tmppids = [] @@cleaners = [] @@ -216,7 +216,7 @@ module PuppetTest #else # Puppet::Util::Log.close # Puppet::Util::Log.newdestination(@logs) - # Puppet[:httplog] = tempfile() + # Puppet[:httplog] = tempfile #end Puppet[:ignoreschedules] = true @@ -234,7 +234,7 @@ module PuppetTest @@tmpfilenum = 1 end - f = File.join(self.tmpdir(), "tempfile_" + @@tmpfilenum.to_s) + f = File.join(self.tmpdir, "tempfile_" + @@tmpfilenum.to_s) @@tmpfiles ||= [] @@tmpfiles << f f @@ -245,7 +245,7 @@ module PuppetTest end def tstdir - dir = tempfile() + dir = tempfile Dir.mkdir(dir) dir end @@ -287,7 +287,7 @@ module PuppetTest def teardown #@stop = Time.now #File.open("/tmp/test_times.log", ::File::WRONLY|::File::CREAT|::File::APPEND) { |f| f.puts "%0.4f %s %s" % [@stop - @start, @method_name, self.class] } - @@cleaners.each { |cleaner| cleaner.call() } + @@cleaners.each { |cleaner| cleaner.call } remove_tmp_files diff --git a/test/lib/puppettest/certificates.rb b/test/lib/puppettest/certificates.rb index 9ab64d762..501e36a0f 100644 --- a/test/lib/puppettest/certificates.rb +++ b/test/lib/puppettest/certificates.rb @@ -19,7 +19,7 @@ module PuppetTest::Certificates def mkCA ca = nil assert_nothing_raised { - ca = Puppet::SSLCertificates::CA.new() + ca = Puppet::SSLCertificates::CA.new } ca diff --git a/test/lib/puppettest/exetest.rb b/test/lib/puppettest/exetest.rb index 105ebc11c..67b4b818c 100644 --- a/test/lib/puppettest/exetest.rb +++ b/test/lib/puppettest/exetest.rb @@ -36,7 +36,7 @@ module PuppetTest::ExeTest cmd = cmd.unshift(@ruby).join(" ") out = nil - Dir.chdir(bindir()) { + Dir.chdir(bindir) { out = %x{#{@ruby} #{cmd}} } out @@ -45,7 +45,7 @@ module PuppetTest::ExeTest def startmasterd(args = "") output = nil - manifest = mktestmanifest() + manifest = mktestmanifest args += " --manifest #{manifest}" args += " --confdir #{Puppet[:confdir]}" args += " --rundir #{File.join(Puppet[:vardir], "run")}" diff --git a/test/lib/puppettest/parsertesting.rb b/test/lib/puppettest/parsertesting.rb index 3935322e6..fe85fe95e 100644 --- a/test/lib/puppettest/parsertesting.rb +++ b/test/lib/puppettest/parsertesting.rb @@ -29,11 +29,11 @@ module PuppetTest::ParserTesting end def safeevaluate(*args) - evaluate() + evaluate end def evaluate_match(othervalue, scope, options={}) - value = evaluate() + value = evaluate othervalue == value end end @@ -154,7 +154,7 @@ module PuppetTest::ParserTesting return AST::Name.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :value => name @@ -167,7 +167,7 @@ module PuppetTest::ParserTesting return AST::Type.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :value => name @@ -180,7 +180,7 @@ module PuppetTest::ParserTesting return AST::NodeDef.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :names => nameobj(name), @@ -205,7 +205,7 @@ module PuppetTest::ParserTesting return AST::ResourceInstance.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :children => params @@ -220,7 +220,7 @@ module PuppetTest::ParserTesting return AST::ResourceParam.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :param => param, @@ -233,7 +233,7 @@ module PuppetTest::ParserTesting AST::String.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :value => value @@ -246,7 +246,7 @@ module PuppetTest::ParserTesting return AST::VarDef.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :name => nameobj(name), @@ -383,7 +383,7 @@ module PuppetTest::ParserTesting bucket = top - file = tempfile() + file = tempfile depth.times do |i| resources = [] width.times do |j| @@ -419,7 +419,7 @@ module PuppetTest::ParserTesting trans = nil scope = nil assert_nothing_raised { - scope = Puppet::Parser::Scope.new() + scope = Puppet::Parser::Scope.new trans = scope.evaluate(:ast => top) } diff --git a/test/lib/puppettest/servertest.rb b/test/lib/puppettest/servertest.rb index df78159c8..4efcedddf 100644 --- a/test/lib/puppettest/servertest.rb +++ b/test/lib/puppettest/servertest.rb @@ -16,9 +16,9 @@ module PuppetTest::ServerTest # create a simple manifest that just creates a file def mktestmanifest file = File.join(Puppet[:confdir], "#{(self.class.to_s + "test")}site.pp") - #@createdfile = File.join(tmpdir(), self.class.to_s + "manifesttesting" + + #@createdfile = File.join(tmpdir, self.class.to_s + "manifesttesting" + # "_#{@method_name}") - @createdfile = tempfile() + @createdfile = tempfile File.open(file, "w") { |f| f.puts "file { \"%s\": ensure => file, mode => 755 }\n" % @createdfile @@ -38,7 +38,7 @@ module PuppetTest::ServerTest handlers = { :CA => {}, # so that certs autogenerate :Master => { - :Manifest => mktestmanifest(), + :Manifest => mktestmanifest, :UseNodes => false }, } diff --git a/test/network/authconfig.rb b/test/network/authconfig.rb index 6437aefea..18445bc8e 100755 --- a/test/network/authconfig.rb +++ b/test/network/authconfig.rb @@ -18,7 +18,7 @@ class TestAuthConfig < Test::Unit::TestCase end def test_parsingconfigfile - file = tempfile() + file = tempfile assert(Puppet[:authconfig], "No config path") Puppet[:authconfig] = file diff --git a/test/network/handler/ca.rb b/test/network/handler/ca.rb index 6a4506a86..401b8d5fe 100755 --- a/test/network/handler/ca.rb +++ b/test/network/handler/ca.rb @@ -171,7 +171,7 @@ class TestCA < Test::Unit::TestCase def test_nodefaultautosign caserv = nil assert_nothing_raised { - caserv = Puppet::Network::Handler.ca.new() + caserv = Puppet::Network::Handler.ca.new } # make sure we know what's going on @@ -204,13 +204,13 @@ class TestCA < Test::Unit::TestCase def test_autosign_true_beats_file caserv = nil assert_nothing_raised { - caserv = Puppet::Network::Handler.ca.new() + caserv = Puppet::Network::Handler.ca.new } host = "hostname.domain.com" # Create an autosign file - file = tempfile() + file = tempfile Puppet[:autosign] = file File.open(file, "w") { |f| @@ -239,7 +239,7 @@ class TestCA < Test::Unit::TestCase # Make sure that a CSR created with keys that don't match the existing # cert throws an exception on the server. def test_mismatched_public_keys_throws_exception - ca = Puppet::Network::Handler.ca.new() + ca = Puppet::Network::Handler.ca.new # First initialize the server client = Puppet::Network::Client.ca.new :CA => ca diff --git a/test/network/handler/fileserver.rb b/test/network/handler/fileserver.rb index 667adb853..bfe76d078 100755 --- a/test/network/handler/fileserver.rb +++ b/test/network/handler/fileserver.rb @@ -11,7 +11,7 @@ class TestFileServer < Test::Unit::TestCase def mkmount(path = nil) mount = nil name = "yaytest" - base = path || tempfile() + base = path || tempfile Dir.mkdir(base) unless FileTest.exists?(base) # Create a test file File.open(File.join(base, "file"), "w") { |f| f.puts "bazoo" } @@ -23,7 +23,7 @@ class TestFileServer < Test::Unit::TestCase end # make a simple file source def mktestdir - testdir = File.join(tmpdir(), "remotefilecopytesting") + testdir = File.join(tmpdir, "remotefilecopytesting") @@tmpfiles << testdir # create a tmpfile @@ -89,7 +89,7 @@ class TestFileServer < Test::Unit::TestCase # verify that listing the root behaves as expected def test_listroot server = nil - testdir, pattern, tmpfile = mktestdir() + testdir, pattern, tmpfile = mktestdir file = nil checks = Puppet::Network::Handler.fileserver::CHECKPARAMS @@ -128,7 +128,7 @@ class TestFileServer < Test::Unit::TestCase # test listing individual files def test_getfilelist server = nil - testdir, pattern, tmpfile = mktestdir() + testdir, pattern, tmpfile = mktestdir file = nil @@ -180,7 +180,7 @@ class TestFileServer < Test::Unit::TestCase # check that the fileserver is seeing newly created files def test_seenewfiles server = nil - testdir, pattern, tmpfile = mktestdir() + testdir, pattern, tmpfile = mktestdir newfile = File.join(testdir, "newfile") @@ -244,7 +244,7 @@ class TestFileServer < Test::Unit::TestCase server.mount("/", "root") } - testdir, pattern, tmpfile = mktestdir() + testdir, pattern, tmpfile = mktestdir list = nil assert_nothing_raised { @@ -273,7 +273,7 @@ class TestFileServer < Test::Unit::TestCase } # make our deep recursion - basedir = File.join(tmpdir(), "recurseremotetesting") + basedir = File.join(tmpdir, "recurseremotetesting") testdir = "#{basedir}/with/some/sub/directories/for/the/purposes/of/testing" oldfile = File.join(testdir, "oldfile") assert_nothing_raised { @@ -328,7 +328,7 @@ class TestFileServer < Test::Unit::TestCase # create a deep dir - basedir = tempfile() + basedir = tempfile testdir = "#{basedir}/with/some/sub/directories/for/testing" oldfile = File.join(testdir, "oldfile") assert_nothing_raised { @@ -372,7 +372,7 @@ class TestFileServer < Test::Unit::TestCase ) } - basedir = tempfile() + basedir = tempfile dirs = %w{a set of directories} assert_nothing_raised { Dir.mkdir(basedir) @@ -399,7 +399,7 @@ class TestFileServer < Test::Unit::TestCase # verify that 'describe' works as advertised def test_describe server = nil - testdir = tstdir() + testdir = tstdir files = mktestfiles(testdir) file = nil @@ -597,7 +597,7 @@ class TestFileServer < Test::Unit::TestCase # Test that we smoothly handle invalid config files def test_configfailures # create an example file with each of them - conffile = tempfile() + conffile = tempfile invalidmounts = { "noexist" => "[noexist] @@ -676,8 +676,8 @@ class TestFileServer < Test::Unit::TestCase def test_filereread server = nil - conffile = tempfile() - dir = tstdir() + conffile = tempfile + dir = tstdir files = mktestfiles(dir) File.open(conffile, "w") { |f| @@ -744,7 +744,7 @@ class TestFileServer < Test::Unit::TestCase def test_mountstring mount = nil name = "yaytest" - path = tmpdir() + path = tmpdir assert_nothing_raised { mount = Puppet::Network::Handler.fileserver::Mount.new(name, path) } @@ -756,7 +756,7 @@ class TestFileServer < Test::Unit::TestCase # Disable the checking, so changes propagate immediately. Puppet[:filetimeout] = -5 server = nil - source = tempfile() + source = tempfile file = File.join(source, "file") link = File.join(source, "link") Dir.mkdir(source) @@ -813,7 +813,7 @@ class TestFileServer < Test::Unit::TestCase ip = "127.0.0.1" # Setup a directory hierarchy for the tests - fsdir = File.join(tmpdir(), "host-specific") + fsdir = File.join(tmpdir, "host-specific") @@tmpfiles << fsdir hostdir = File.join(fsdir, "host") fqdndir = File.join(fsdir, "fqdn") @@ -830,7 +830,7 @@ class TestFileServer < Test::Unit::TestCase f.print contents[d] end end - conffile = tempfile() + conffile = tempfile File.open(conffile, "w") do |f| f.print(" [host] @@ -931,7 +931,7 @@ allow * # Make sure the 'subdir' method in Mount works. def test_mount_subdir mount = nil - base = tempfile() + base = tempfile Dir.mkdir(base) subdir = File.join(base, "subdir") Dir.mkdir(subdir) @@ -940,7 +940,7 @@ allow * end mount = mkmount(base) - assert_equal(base, mount.subdir(), "Did not default to base path") + assert_equal(base, mount.subdir, "Did not default to base path") assert_equal(subdir, mount.subdir("subdir"), "Did not default to base path") end @@ -948,10 +948,10 @@ allow * # the path. def test_expandable name = "yaytest" - dir = tempfile() + dir = tempfile Dir.mkdir(dir) - mount = mkmount() + mount = mkmount assert_nothing_raised { mount.path = dir } @@ -980,7 +980,7 @@ allow * end def test_mount_expand - mount = mkmount() + mount = mkmount check = proc do |client, pattern, repl| path = "/my/#{pattern}/file" @@ -1037,7 +1037,7 @@ allow * ) } - dir = tempfile() + dir = tempfile # When mocks attack, part 2 kernel_fact = Facter.value(:kernel) diff --git a/test/network/handler/report.rb b/test/network/handler/report.rb index fa55137bc..ed7a96f57 100755 --- a/test/network/handler/report.rb +++ b/test/network/handler/report.rb @@ -16,13 +16,13 @@ class TestReportServer < Test::Unit::TestCase def mkserver server = nil assert_nothing_raised { - server = Puppet::Network::Handler.report.new() + server = Puppet::Network::Handler.report.new } server end def mkclient(server = nil) - server ||= mkserver() + server ||= mkserver client = nil assert_nothing_raised { client = Puppet::Network::Client.report.new(:Report => server) diff --git a/test/network/server/webrick.rb b/test/network/server/webrick.rb index 7fd362b39..cdc682043 100755 --- a/test/network/server/webrick.rb +++ b/test/network/server/webrick.rb @@ -75,7 +75,7 @@ class TestWebrickServer < Test::Unit::TestCase def mk_status_client client = nil - assert_nothing_raised() { + assert_nothing_raised { client = Puppet::Network::Client.status.new( @@ -90,7 +90,7 @@ class TestWebrickServer < Test::Unit::TestCase def mk_status_server server = nil Puppet[:certdnsnames] = "localhost" - assert_nothing_raised() { + assert_nothing_raised { server = Puppet::Network::HTTPServer::WEBrick.new( @@ -106,7 +106,7 @@ class TestWebrickServer < Test::Unit::TestCase pid = fork { Puppet.run_mode.stubs(:master?).returns true - assert_nothing_raised() { + assert_nothing_raised { trap(:INT) { server.shutdown } server.start } diff --git a/test/network/xmlrpc/processor.rb b/test/network/xmlrpc/processor.rb index 69f4c2fdc..3bf7b7fa3 100755 --- a/test/network/xmlrpc/processor.rb +++ b/test/network/xmlrpc/processor.rb @@ -35,7 +35,7 @@ class TestXMLRPCProcessor < Test::Unit::TestCase @processor.send(:setup_processor) assert(! @processor.handler_loaded?(:ca), "already have ca handler loaded") assert_nothing_raised do - @processor.add_handler(ca.interface, ca.new()) + @processor.add_handler(ca.interface, ca.new) end assert(@processor.handler_loaded?(:puppetca), "ca handler not loaded by symbol") @@ -46,7 +46,7 @@ class TestXMLRPCProcessor < Test::Unit::TestCase ca = Puppet::Network::Handler.ca @processor.send(:setup_processor) assert_nothing_raised do - @processor.add_handler(ca.interface, ca.new()) + @processor.add_handler(ca.interface, ca.new) end fakeparser = Class.new do diff --git a/test/other/puppet.rb b/test/other/puppet.rb index 1f81bb781..7caba8996 100755 --- a/test/other/puppet.rb +++ b/test/other/puppet.rb @@ -61,8 +61,8 @@ class TestPuppetModule < Test::Unit::TestCase $LOAD_PATH.delete(dir) unless oldlibs.include?(dir) end end - one = tempfile() - two = tempfile() + one = tempfile + two = tempfile Dir.mkdir(one) Dir.mkdir(two) diff --git a/test/other/relationships.rb b/test/other/relationships.rb index 3ca944670..c270be75e 100755 --- a/test/other/relationships.rb +++ b/test/other/relationships.rb @@ -13,7 +13,7 @@ class TestRelationships < Test::Unit::TestCase end def newfile - assert_nothing_raised() { + assert_nothing_raised { return Puppet::Type.type(:file).new( @@ -57,7 +57,7 @@ class TestRelationships < Test::Unit::TestCase def test_autorequire # We know that execs autorequire their cwd, so we'll use that - path = tempfile() + path = tempfile file = Puppet::Type.type(:file).new( diff --git a/test/other/report.rb b/test/other/report.rb index d15fb5505..862e50672 100755 --- a/test/other/report.rb +++ b/test/other/report.rb @@ -16,7 +16,7 @@ class TestReports < Test::Unit::TestCase # First do some work objects = [] 6.times do |i| - file = tempfile() + file = tempfile # Make every third file File.open(file, "w") { |f| f.puts "" } if i % 3 == 0 @@ -50,7 +50,7 @@ class TestReports < Test::Unit::TestCase } # Now make a file for testing logging - file = Puppet::Type.type(:file).new(:path => tempfile(), :ensure => "file") + file = Puppet::Type.type(:file).new(:path => tempfile, :ensure => "file") file.finish log = nil diff --git a/test/other/transactions.rb b/test/other/transactions.rb index dd5348e33..26fc0b642 100755 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -13,7 +13,7 @@ class TestTransactions < Test::Unit::TestCase include PuppetTest::Support::Resources include PuppetTest::Support::Utils class Fakeprop <Puppet::Property - initvars() + initvars attr_accessor :path, :is, :should, :name def should_to_s(value) @@ -56,7 +56,7 @@ class TestTransactions < Test::Unit::TestCase # Create a new type that generates instances with shorter names. def mkreducer(&block) - type = mkgenerator() do + type = mkgenerator do def eval_generate ret = [] if title.length > 1 @@ -105,7 +105,7 @@ class TestTransactions < Test::Unit::TestCase assert_equal({inst.title => inst}, $prefetched, "type prefetch was not called") - # Now make sure it gets called from within evaluate() + # Now make sure it gets called from within evaluate $prefetched = false assert_nothing_raised do trans.evaluate @@ -117,7 +117,7 @@ class TestTransactions < Test::Unit::TestCase # We need to generate resources before we prefetch them, else generated # resources that require prefetching don't work. def test_generate_before_prefetch - config = mk_catalog() + config = mk_catalog trans = Puppet::Transaction.new(config) generate = nil @@ -127,7 +127,7 @@ class TestTransactions < Test::Unit::TestCase trans.prepare return - resource = Puppet::Type.type(:file).new :ensure => :present, :path => tempfile() + resource = Puppet::Type.type(:file).new :ensure => :present, :path => tempfile other_resource = mock 'generated' def resource.generate [other_resource] @@ -186,8 +186,8 @@ class TestTransactions < Test::Unit::TestCase # Make sure changes in contained files still generate callback events. def test_generated_callbacks - dir = tempfile() - maker = tempfile() + dir = tempfile + maker = tempfile Dir.mkdir(dir) file = File.join(dir, "file") File.open(file, "w") { |f| f.puts "" } @@ -203,7 +203,7 @@ class TestTransactions < Test::Unit::TestCase assert(FileTest.exists?(maker), "Did not make callback file") end - # Testing #401 -- transactions are calling refresh() on classes that don't support it. + # Testing #401 -- transactions are calling refresh on classes that don't support it. def test_callback_availability $called = [] klass = Puppet::Type.newtype(:norefresh) do @@ -217,7 +217,7 @@ class TestTransactions < Test::Unit::TestCase Puppet::Type.rmtype(:norefresh) end - file = Puppet::Type.type(:file).new :path => tempfile(), :content => "yay" + file = Puppet::Type.type(:file).new :path => tempfile, :content => "yay" one = klass.new :name => "one", :subscribe => file assert_apply(file, one) @@ -291,7 +291,7 @@ class TestTransactions < Test::Unit::TestCase rels = {} # Now add the explicit relationship # Now files - d = tempfile() + d = tempfile f = File.join(d, "file") file = Puppet::Type.type(:file).new(:path => f, :content => "yay") dir = Puppet::Type.type(:file).new(:path => d, :ensure => :directory, :require => file) diff --git a/test/ral/manager/type.rb b/test/ral/manager/type.rb index 5190bc7c7..5fd4fd622 100755 --- a/test/ral/manager/type.rb +++ b/test/ral/manager/type.rb @@ -238,7 +238,7 @@ class TestType < Test::Unit::TestCase file = nil fileclass = Puppet::Type.type(:file) - path = tempfile() + path = tempfile assert_nothing_raised do file = fileclass.create( @@ -301,7 +301,7 @@ class TestType < Test::Unit::TestCase # Now do files, since they are. This should fail. file1 = file2 = nil - path = tempfile() + path = tempfile file1 = Puppet::Type.type(:file).new( @@ -324,7 +324,7 @@ class TestType < Test::Unit::TestCase end def test_tags - obj = Puppet::Type.type(:file).new(:path => tempfile()) + obj = Puppet::Type.type(:file).new(:path => tempfile) tags = ["some", "test", "tags"] @@ -336,7 +336,7 @@ class TestType < Test::Unit::TestCase end def test_to_hash - file = Puppet::Type.newfile :path => tempfile(), :owner => "luke", + file = Puppet::Type.newfile :path => tempfile, :owner => "luke", :recurse => true, :loglevel => "warning" hash = nil @@ -350,7 +350,7 @@ class TestType < Test::Unit::TestCase end def test_ref - path = tempfile() + path = tempfile Puppet::Type.type(:exec) # uggh, the methods need to load the types file = Puppet::Type.newfile(:path => path) assert_equal("File[#{path}]", file.ref) diff --git a/test/ral/providers/cron/crontab.rb b/test/ral/providers/cron/crontab.rb index 0da9cc232..3a996cb4e 100755 --- a/test/ral/providers/cron/crontab.rb +++ b/test/ral/providers/cron/crontab.rb @@ -259,7 +259,7 @@ class TestCronParsedProvider < Test::Unit::TestCase # A simple test to see if we can load the cron from disk. def test_load - setme() + setme records = nil assert_nothing_raised { records = @provider.retrieve(@me) @@ -271,7 +271,7 @@ class TestCronParsedProvider < Test::Unit::TestCase # it directly def test_simple_to_cron # make the cron - setme() + setme name = "yaytest" args = {:name => name, diff --git a/test/ral/providers/group.rb b/test/ral/providers/group.rb index ceba65ac4..829e7dfa2 100755 --- a/test/ral/providers/group.rb +++ b/test/ral/providers/group.rb @@ -158,7 +158,7 @@ class TestGroupProvider < Test::Unit::TestCase # Iterate over each of our groups and try to grab the gid. def test_ownprovidergroups - groupnames().each { |group| + groupnames.each { |group| gobj = nil comp = nil fakeresource = fakeresource(:group, group) diff --git a/test/ral/providers/host/parsed.rb b/test/ral/providers/host/parsed.rb index d14e33f7b..5b21abc6b 100755 --- a/test/ral/providers/host/parsed.rb +++ b/test/ral/providers/host/parsed.rb @@ -51,7 +51,7 @@ class TestParsedHostProvider < Test::Unit::TestCase end def mkhost - hash = mkhosthash() + hash = mkhosthash fakeresource = fakeresource(:host, hash[:name]) @@ -86,7 +86,7 @@ class TestParsedHostProvider < Test::Unit::TestCase # Make sure parsing gets comments, blanks, and hosts def test_blanks_and_comments - mkfaketype() + mkfaketype text = %{# comment one 192.168.43.56\tmyhost\tanother\thost @@ -191,14 +191,14 @@ class TestParsedHostProvider < Test::Unit::TestCase # Make sure we can modify the file elsewhere and those modifications will # get taken into account. def test_modifyingfile - hostfile = tempfile() + hostfile = tempfile @provider.default_target = hostfile file = @provider.target_object(hostfile) hosts = [] 3.times { - h = mkhost() + h = mkhost hosts << h } @@ -206,11 +206,11 @@ class TestParsedHostProvider < Test::Unit::TestCase host.flush end - newhost = mkhost() + newhost = mkhost hosts << newhost # Now store our new host - newhost.flush() + newhost.flush # Verify we can retrieve that info assert_nothing_raised("Could not retrieve after second write") { diff --git a/test/ral/providers/package.rb b/test/ral/providers/package.rb index b91f5d92d..6a8489c88 100755 --- a/test/ral/providers/package.rb +++ b/test/ral/providers/package.rb @@ -16,7 +16,7 @@ class TestPackageProvider < Test::Unit::TestCase # Load the testpackages hash. def self.load_test_packages require 'yaml' - file = File.join(PuppetTest.datadir(), "providers", "package", "testpackages.yaml") + file = File.join(PuppetTest.datadir, "providers", "package", "testpackages.yaml") raise "Could not find file #{file}" unless FileTest.exists?(file) array = YAML::load(File.read(file)).collect { |hash| # Stupid ruby 1.8.1. YAML is sometimes broken such that diff --git a/test/ral/providers/parsedfile.rb b/test/ral/providers/parsedfile.rb index 93716a3ce..53a37cfc2 100755 --- a/test/ral/providers/parsedfile.rb +++ b/test/ral/providers/parsedfile.rb @@ -120,7 +120,7 @@ class TestParsedFile < Test::Unit::TestCase def test_fileobject prov = mkprovider - path = tempfile() + path = tempfile obj = nil assert_nothing_raised do obj = prov.target_object(path) @@ -295,17 +295,17 @@ class TestParsedFile < Test::Unit::TestCase files = {} # Set the default target - default = tempfile() + default = tempfile files[:default] = default prov.default_target = default # Create a file object - inmem = tempfile() + inmem = tempfile files[:inmemory] = inmem prov.target_object(inmem).write("inmem yay ness") # Lastly, create a resource with separate is and should values - mtarget = tempfile() + mtarget = tempfile files[:resources] = mtarget resource = mkresource "yay", :target => mtarget @@ -497,7 +497,7 @@ class TestParsedFile < Test::Unit::TestCase "Did not get default ensure value") # Try creating the object - assert_nothing_raised { notdisk.provider.create() } + assert_nothing_raised { notdisk.provider.create } # Now make sure all of the data is copied over correctly. notdisk.class.validproperties.each do |property| @@ -519,7 +519,7 @@ class TestParsedFile < Test::Unit::TestCase assert_equal(:present, ondisk.provider.ensure) # Now destroy the object - assert_nothing_raised { notdisk.provider.destroy() } + assert_nothing_raised { notdisk.provider.destroy } assert_nothing_raised { notdisk.flush } diff --git a/test/ral/providers/provider.rb b/test/ral/providers/provider.rb index 3ffbfd985..2ea08e068 100755 --- a/test/ral/providers/provider.rb +++ b/test/ral/providers/provider.rb @@ -185,7 +185,7 @@ class TestProvider < Test::Unit::TestCase def test_outputonfailure provider = newprovider - dir = tstdir() + dir = tstdir file = File.join(dir, "mycmd") sh = Puppet::Util.binary("sh") File.open(file, "w") { |f| @@ -345,7 +345,7 @@ class TestProvider < Test::Unit::TestCase assert_equal(:one, prov.name, "did not get name from hash") assert_nothing_raised("Could not init with no argument") do - prov = test.new() + prov = test.new end assert_raise(Puppet::DevError, "did not fail when no name is present") do diff --git a/test/ral/providers/service/base.rb b/test/ral/providers/service/base.rb index f1db0470d..ffaf5987e 100755 --- a/test/ral/providers/service/base.rb +++ b/test/ral/providers/service/base.rb @@ -11,7 +11,7 @@ class TestBaseServiceProvider < Test::Unit::TestCase include PuppetTest def test_base - running = tempfile() + running = tempfile commands = {} %w{touch rm test}.each do |c| diff --git a/test/ral/providers/user.rb b/test/ral/providers/user.rb index 7769e3a26..628d88acf 100755 --- a/test/ral/providers/user.rb +++ b/test/ral/providers/user.rb @@ -11,7 +11,7 @@ class TestUserProvider < Test::Unit::TestCase def setup super - setme() + setme @@tmpusers = [] @provider = nil assert_nothing_raised { @@ -114,7 +114,7 @@ class TestUserProvider < Test::Unit::TestCase when :ensure; :present when :comment; "Puppet's Testing User #{name}" # use a single quote a la #375 when :gid; nonrootgroup.gid - when :shell; findshell() + when :shell; findshell when :home; "/home/#{name}" else return nil diff --git a/test/ral/type/cron.rb b/test/ral/type/cron.rb index 384a6ad32..1bf8bafc0 100755 --- a/test/ral/type/cron.rb +++ b/test/ral/type/cron.rb @@ -12,7 +12,7 @@ class TestCron < Test::Unit::TestCase def setup super - setme() + setme @crontype = Puppet::Type.type(:cron) @provider = @crontype.defaultprovider diff --git a/test/ral/type/exec.rb b/test/ral/type/exec.rb index 7ddb4650d..eacb12a07 100755 --- a/test/ral/type/exec.rb +++ b/test/ral/type/exec.rb @@ -113,7 +113,7 @@ class TestExec < Test::Unit::TestCase def test_refreshonly_functional file = nil cmd = nil - tmpfile = tempfile() + tmpfile = tempfile @@tmpfiles.push tmpfile trans = nil @@ -127,7 +127,7 @@ class TestExec < Test::Unit::TestCase assert_apply(file) # Now make an exec - maker = tempfile() + maker = tempfile assert_nothing_raised { cmd = Puppet::Type.type(:exec).new( @@ -180,7 +180,7 @@ class TestExec < Test::Unit::TestCase end def test_creates - file = tempfile() + file = tempfile exec = nil assert(! FileTest.exists?(file), "File already exists") assert_nothing_raised { @@ -201,8 +201,8 @@ class TestExec < Test::Unit::TestCase # Verify that we can download the file that we're going to execute. def test_retrievethenmkexe - exe = tempfile() - oexe = tempfile() + exe = tempfile + oexe = tempfile sh = %x{which sh} File.open(exe, "w") { |f| f.puts "#!#{sh}\necho yup" } @@ -230,8 +230,8 @@ class TestExec < Test::Unit::TestCase # Verify that we auto-require any managed scripts. def test_autorequire_files - exe = tempfile() - oexe = tempfile() + exe = tempfile + oexe = tempfile sh = %x{which sh} File.open(exe, "w") { |f| f.puts "#!#{sh}\necho yup" } @@ -304,8 +304,8 @@ class TestExec < Test::Unit::TestCase end def test_ifonly - afile = tempfile() - bfile = tempfile() + afile = tempfile + bfile = tempfile exec = nil assert_nothing_raised { @@ -328,8 +328,8 @@ class TestExec < Test::Unit::TestCase end def test_unless - afile = tempfile() - bfile = tempfile() + afile = tempfile + bfile = tempfile exec = nil assert_nothing_raised { @@ -399,14 +399,14 @@ class TestExec < Test::Unit::TestCase end def test_userngroup - file = tempfile() + file = tempfile [ - [nonrootuser()], # just user, by name - [nonrootuser(), nil, true], # user, by uid - [nil, nonrootgroup()], # just group - [nil, nonrootgroup(), true], # just group, by id - [nonrootuser(), nonrootgroup()], # user and group, by name - [nonrootuser(), nonrootgroup(), true], # user and group, by id + [nonrootuser], # just user, by name + [nonrootuser, nil, true], # user, by uid + [nil, nonrootgroup], # just group + [nil, nonrootgroup, true], # just group, by id + [nonrootuser, nonrootgroup], # user and group, by name + [nonrootuser, nonrootgroup, true], # user and group, by id ].each { |ary| mknverify(file, *ary) { } @@ -448,7 +448,7 @@ class TestExec < Test::Unit::TestCase def test_execthenfile exec = nil file = nil - basedir = tempfile() + basedir = tempfile path = File.join(basedir, "subfile") assert_nothing_raised { @@ -503,8 +503,8 @@ class TestExec < Test::Unit::TestCase def test_createcwdandexe exec1 = exec2 = nil - dir = tempfile() - file = tempfile() + dir = tempfile + file = tempfile assert_nothing_raised { @@ -550,7 +550,7 @@ class TestExec < Test::Unit::TestCase def test_checkarrays exec = nil - file = tempfile() + file = tempfile test = "test -f #{file}" @@ -756,8 +756,8 @@ and stuff" end def test_checks_apply_to_refresh - file = tempfile() - maker = tempfile() + file = tempfile + maker = tempfile exec = Puppet::Type.type(:exec).new( @@ -798,8 +798,8 @@ and stuff" end def test_explicit_refresh - refresher = tempfile() - maker = tempfile() + refresher = tempfile + maker = tempfile exec = Puppet::Type.type(:exec).new( diff --git a/test/ral/type/file.rb b/test/ral/type/file.rb index 726dcb72f..06795de7d 100755 --- a/test/ral/type/file.rb +++ b/test/ral/type/file.rb @@ -20,7 +20,7 @@ class TestFile < Test::Unit::TestCase end def mktestfile - tmpfile = tempfile() + tmpfile = tempfile File.open(tmpfile, "w") { |f| f.puts rand(100) } @@tmpfiles.push tmpfile mkfile(:name => tmpfile) @@ -50,7 +50,7 @@ class TestFile < Test::Unit::TestCase end def test_owner - file = mktestfile() + file = mktestfile users = {} count = 0 @@ -82,10 +82,10 @@ class TestFile < Test::Unit::TestCase us[uid] = name users.each { |uid, name| assert_apply(file) - assert_nothing_raised() { + assert_nothing_raised { file[:owner] = name } - assert_nothing_raised() { + assert_nothing_raised { file.retrieve } assert_apply(file) @@ -93,9 +93,9 @@ class TestFile < Test::Unit::TestCase end def test_group - file = mktestfile() + file = mktestfile [%x{groups}.chomp.split(/ /), Process.groups].flatten.each { |group| - assert_nothing_raised() { + assert_nothing_raised { file[:group] = group } assert(file.property(:group)) @@ -111,9 +111,9 @@ class TestFile < Test::Unit::TestCase if Puppet.features.root? def test_createasuser - dir = tmpdir() + dir = tmpdir - user = nonrootuser() + user = nonrootuser path = File.join(tmpdir, "createusertesting") @@tmpfiles << path @@ -136,7 +136,7 @@ class TestFile < Test::Unit::TestCase end def test_nofollowlinks - basedir = tempfile() + basedir = tempfile Dir.mkdir(basedir) file = File.join(basedir, "file") link = File.join(basedir, "link") @@ -145,7 +145,7 @@ class TestFile < Test::Unit::TestCase File.symlink(file, link) # First test 'user' - user = nonrootuser() + user = nonrootuser inituser = File.lstat(link).uid File.lchown(inituser, nil, link) @@ -205,7 +205,7 @@ class TestFile < Test::Unit::TestCase end def test_ownerasroot - file = mktestfile() + file = mktestfile users = {} count = 0 @@ -234,13 +234,13 @@ class TestFile < Test::Unit::TestCase end users.each { |uid, name| - assert_nothing_raised() { + assert_nothing_raised { file[:owner] = name } assert_apply(file) currentvalue = file.retrieve assert(file.insync?(currentvalue)) - assert_nothing_raised() { + assert_nothing_raised { file[:owner] = uid } assert_apply(file) @@ -261,10 +261,10 @@ class TestFile < Test::Unit::TestCase end def test_groupasroot - file = mktestfile() + file = mktestfile [%x{groups}.chomp.split(/ /), Process.groups].flatten.each { |group| next unless Puppet::Util.gid(group) # grr. - assert_nothing_raised() { + assert_nothing_raised { file[:group] = group } assert(file.property(:group)) @@ -272,7 +272,7 @@ class TestFile < Test::Unit::TestCase assert_apply(file) currentvalue = file.retrieve assert(file.insync?(currentvalue)) - assert_nothing_raised() { + assert_nothing_raised { file.delete(:group) } } @@ -280,7 +280,7 @@ class TestFile < Test::Unit::TestCase if Facter.value(:operatingsystem) == "Darwin" def test_sillyowner - file = tempfile() + file = tempfile File.open(file, "w") { |f| f.puts "" } File.chown(-2, nil, file) @@ -304,9 +304,9 @@ class TestFile < Test::Unit::TestCase end def test_create - %w{a b c d}.collect { |name| tempfile() + name.to_s }.each { |path| + %w{a b c d}.collect { |name| tempfile + name.to_s }.each { |path| file =nil - assert_nothing_raised() { + assert_nothing_raised { file = Puppet::Type.type(:file).new( @@ -323,11 +323,11 @@ class TestFile < Test::Unit::TestCase end def test_create_dir - basedir = tempfile() + basedir = tempfile Dir.mkdir(basedir) %w{a b c d}.collect { |name| "#{basedir}/#{name}" }.each { |path| file = nil - assert_nothing_raised() { + assert_nothing_raised { file = Puppet::Type.type(:file).new( @@ -349,13 +349,13 @@ class TestFile < Test::Unit::TestCase # Set it to something else initially File.chmod(0775, file.title) [0644,0755,0777,0641].each { |mode| - assert_nothing_raised() { + assert_nothing_raised { file[:mode] = mode } assert_events([:mode_changed], file) assert_events([], file) - assert_nothing_raised() { + assert_nothing_raised { file.delete(:mode) } } @@ -403,7 +403,7 @@ class TestFile < Test::Unit::TestCase file = Puppet::Type.type(:file).new( - :name => tmpdir(), + :name => tmpdir, :check => :type ) @@ -416,7 +416,7 @@ class TestFile < Test::Unit::TestCase file = Puppet::Type.type(:file).new( - :name => tempfile(), + :name => tempfile, :ensure => "file" ) @@ -430,7 +430,7 @@ class TestFile < Test::Unit::TestCase end def test_path - dir = tempfile() + dir = tempfile path = File.join(dir, "subdir") @@ -467,7 +467,7 @@ class TestFile < Test::Unit::TestCase end def test_autorequire - basedir = tempfile() + basedir = tempfile subfile = File.join(basedir, "subfile") @@ -496,7 +496,7 @@ class TestFile < Test::Unit::TestCase # Unfortunately, I know this fails def disabled_test_recursivemkdir - path = tempfile() + path = tempfile subpath = File.join(path, "this", "is", "a", "dir") file = nil assert_nothing_raised { @@ -520,7 +520,7 @@ class TestFile < Test::Unit::TestCase # Make sure that content updates the checksum on the same run def test_checksumchange_for_content - dest = tempfile() + dest = tempfile File.open(dest, "w") { |f| f.puts "yayness" } file = nil @@ -545,7 +545,7 @@ class TestFile < Test::Unit::TestCase # Make sure that content updates the checksum on the same run def test_checksumchange_for_ensure - dest = tempfile() + dest = tempfile file = nil assert_nothing_raised { @@ -567,7 +567,7 @@ class TestFile < Test::Unit::TestCase end def test_nameandpath - path = tempfile() + path = tempfile file = nil assert_nothing_raised { @@ -593,7 +593,7 @@ class TestFile < Test::Unit::TestCase file = Puppet::Type.type(:file).new( - :path => tempfile(), + :path => tempfile, :group => "fakegroup" ) @@ -603,7 +603,7 @@ class TestFile < Test::Unit::TestCase end def test_modecreation - path = tempfile() + path = tempfile file = Puppet::Type.type(:file).new( @@ -624,7 +624,7 @@ class TestFile < Test::Unit::TestCase # If both 'ensure' and 'content' are used, make sure that all of the other # properties are handled correctly. def test_contentwithmode - path = tempfile() + path = tempfile file = nil assert_nothing_raised { @@ -644,8 +644,8 @@ class TestFile < Test::Unit::TestCase end def test_replacefilewithlink - path = tempfile() - link = tempfile() + path = tempfile + link = tempfile File.open(path, "w") { |f| f.puts "yay" } File.open(link, "w") { |f| f.puts "a file" } @@ -670,7 +670,7 @@ class TestFile < Test::Unit::TestCase end def test_file_with_spaces - dir = tempfile() + dir = tempfile Dir.mkdir(dir) source = File.join(dir, "file spaces") dest = File.join(dir, "another space") @@ -692,8 +692,8 @@ class TestFile < Test::Unit::TestCase # Testing #274. Make sure target can be used without 'ensure'. def test_target_without_ensure - source = tempfile() - dest = tempfile() + source = tempfile + dest = tempfile File.open(source, "w") { |f| f.puts "funtest" } obj = nil @@ -705,7 +705,7 @@ class TestFile < Test::Unit::TestCase end def test_autorequire_owner_and_group - file = tempfile() + file = tempfile comp = nil user = nil group =nil @@ -759,7 +759,7 @@ class TestFile < Test::Unit::TestCase # Testing #364. def test_writing_in_directories_with_no_write_access # Make a directory that our user does not have access to - dir = tempfile() + dir = tempfile Dir.mkdir(dir) # Get a fake user @@ -796,7 +796,7 @@ class TestFile < Test::Unit::TestCase # #366 def test_replace_aliases - file = Puppet::Type.newfile :path => tempfile() + file = Puppet::Type.newfile :path => tempfile file[:replace] = :yes assert_equal(:true, file[:replace], ":replace did not alias :true to :yes") file[:replace] = :no @@ -804,7 +804,7 @@ class TestFile < Test::Unit::TestCase end def test_pathbuilder - dir = tempfile() + dir = tempfile Dir.mkdir(dir) file = File.join(dir, "file") File.open(file, "w") { |f| f.puts "" } @@ -822,7 +822,7 @@ class TestFile < Test::Unit::TestCase # Testing #403 def test_removal_with_content_set - path = tempfile() + path = tempfile File.open(path, "w") { |f| f.puts "yay" } file = Puppet::Type.newfile(:name => path, :ensure => :absent, :content => "foo", :backup => false) @@ -832,9 +832,9 @@ class TestFile < Test::Unit::TestCase # Testing #438 def test_creating_properties_conflict - file = tempfile() - first = tempfile() - second = tempfile() + file = tempfile + first = tempfile + second = tempfile params = [:content, :source, :target] params.each do |param| assert_nothing_raised("#{param} conflicted with ensure") do @@ -852,14 +852,14 @@ class TestFile < Test::Unit::TestCase # Testing #508 if Process.uid == 0 def test_files_replace_with_right_attrs - source = tempfile() + source = tempfile File.open(source, "w") { |f| f.puts "some text" } File.chmod(0755, source) user = nonrootuser group = nonrootgroup - path = tempfile() + path = tempfile good = {:uid => user.uid, :gid => group.gid, :mode => 0640} run = Proc.new do |obj, msg| diff --git a/test/ral/type/file/target.rb b/test/ral/type/file/target.rb index 20e68a578..ac3b7474f 100755 --- a/test/ral/type/file/target.rb +++ b/test/ral/type/file/target.rb @@ -17,8 +17,8 @@ class TestFileTarget < Test::Unit::TestCase # Make sure we can create symlinks def test_symlinks - path = tempfile() - link = tempfile() + path = tempfile + link = tempfile File.open(path, "w") { |f| f.puts "yay" } @@ -47,8 +47,8 @@ class TestFileTarget < Test::Unit::TestCase end def test_simplerecursivelinking - source = tempfile() - path = tempfile() + source = tempfile + path = tempfile subdir = File.join(source, "subdir") file = File.join(subdir, "file") @@ -79,8 +79,8 @@ class TestFileTarget < Test::Unit::TestCase end def test_recursivelinking - source = tempfile() - dest = tempfile() + source = tempfile + dest = tempfile files = [] dirs = [] @@ -132,7 +132,7 @@ class TestFileTarget < Test::Unit::TestCase end def test_localrelativelinks - dir = tempfile() + dir = tempfile Dir.mkdir(dir) source = File.join(dir, "source") File.open(source, "w") { |f| f.puts "yay" } @@ -156,8 +156,8 @@ class TestFileTarget < Test::Unit::TestCase end def test_recursivelinkingmissingtarget - source = tempfile() - dest = tempfile() + source = tempfile + dest = tempfile resources = [] @@ -186,8 +186,8 @@ class TestFileTarget < Test::Unit::TestCase end def test_insync? - source = tempfile() - dest = tempfile() + source = tempfile + dest = tempfile obj = @file.create(:path => source, :target => dest) @@ -220,8 +220,8 @@ class TestFileTarget < Test::Unit::TestCase def test_replacedirwithlink Puppet[:trace] = false - path = tempfile() - link = tempfile() + path = tempfile + link = tempfile File.open(path, "w") { |f| f.puts "yay" } Dir.mkdir(link) @@ -254,7 +254,7 @@ class TestFileTarget < Test::Unit::TestCase end def test_replace_links_with_files - base = tempfile() + base = tempfile Dir.mkdir(base) @@ -282,7 +282,7 @@ class TestFileTarget < Test::Unit::TestCase end def test_no_erase_linkedto_files - base = tempfile() + base = tempfile Dir.mkdir(base) @@ -329,9 +329,9 @@ class TestFileTarget < Test::Unit::TestCase end def test_replace_links - dest = tempfile() - otherdest = tempfile() - link = tempfile() + dest = tempfile + otherdest = tempfile + link = tempfile File.open(dest, "w") { |f| f.puts "boo" } File.open(otherdest, "w") { |f| f.puts "yay" } diff --git a/test/ral/type/fileignoresource.rb b/test/ral/type/fileignoresource.rb index 19f510957..89e51a7fb 100755 --- a/test/ral/type/fileignoresource.rb +++ b/test/ral/type/fileignoresource.rb @@ -36,7 +36,7 @@ class TestFileIgnoreSources < Test::Unit::TestCase def test_ignore_simple_source #Temp directory to run tests in - path = tempfile() + path = tempfile @@tmpfiles.push path #source directory @@ -101,7 +101,7 @@ class TestFileIgnoreSources < Test::Unit::TestCase def test_ignore_with_wildcard #Temp directory to run tests in - path = tempfile() + path = tempfile @@tmpfiles.push path #source directory @@ -177,7 +177,7 @@ class TestFileIgnoreSources < Test::Unit::TestCase def test_ignore_array #Temp directory to run tests in - path = tempfile() + path = tempfile @@tmpfiles.push path #source directory diff --git a/test/ral/type/filesources.rb b/test/ral/type/filesources.rb index 2b43424ac..605704b0a 100755 --- a/test/ral/type/filesources.rb +++ b/test/ral/type/filesources.rb @@ -42,12 +42,12 @@ class TestFileSources < Test::Unit::TestCase # Make a simple recursive tree. def mk_sourcetree - source = tempfile() + source = tempfile sourcefile = File.join(source, "file") Dir.mkdir source File.open(sourcefile, "w") { |f| f.puts "yay" } - dest = tempfile() + dest = tempfile destfile = File.join(dest, "file") return source, dest, sourcefile, destfile end @@ -73,7 +73,7 @@ class TestFileSources < Test::Unit::TestCase end def run_complex_sources(networked = false) - path = tempfile() + path = tempfile # first create the source directory FileUtils.mkdir_p path @@ -181,7 +181,7 @@ class TestFileSources < Test::Unit::TestCase # Make sure added files get correctly caught during recursion def test_RecursionWithAddedFiles - basedir = tempfile() + basedir = tempfile Dir.mkdir(basedir) @@tmpfiles << basedir file1 = File.join(basedir, "file1") @@ -216,7 +216,7 @@ class TestFileSources < Test::Unit::TestCase end def mkfileserverconf(mounts) - file = tempfile() + file = tempfile File.open(file, "w") { |f| mounts.each { |path, name| f.puts "[#{name}]\n\tpath #{path}\n\tallow *\n" @@ -258,7 +258,7 @@ class TestFileSources < Test::Unit::TestCase } serverpid = fork { - assert_nothing_raised() { + assert_nothing_raised { #trap(:INT) { server.shutdown; Kernel.exit! } trap(:INT) { server.shutdown } server.start @@ -268,7 +268,7 @@ class TestFileSources < Test::Unit::TestCase sleep(1) - name = File.join(tmpdir(), "nosourcefile") + name = File.join(tmpdir, "nosourcefile") file = Puppet::Type.type(:file).new( @@ -290,10 +290,10 @@ class TestFileSources < Test::Unit::TestCase def test_sourcepaths files = [] 3.times { - files << tempfile() + files << tempfile } - to = tempfile() + to = tempfile File.open(files[-1], "w") { |f| f.puts "yee-haw" } @@ -321,8 +321,8 @@ class TestFileSources < Test::Unit::TestCase # Make sure that source-copying updates the checksum on the same run def test_sourcebeatsensure - source = tempfile() - dest = tempfile() + source = tempfile + dest = tempfile File.open(source, "w") { |f| f.puts "yay" } file = nil @@ -346,9 +346,9 @@ class TestFileSources < Test::Unit::TestCase end def test_sourcewithlinks - source = tempfile() - link = tempfile() - dest = tempfile() + source = tempfile + link = tempfile + dest = tempfile File.open(source, "w") { |f| f.puts "yay" } File.symlink(source, link) @@ -370,7 +370,7 @@ class TestFileSources < Test::Unit::TestCase # Make sure files aren't replaced when replace is false, but otherwise # are. def test_replace - dest = tempfile() + dest = tempfile file = Puppet::Type.newfile( @@ -400,11 +400,11 @@ class TestFileSources < Test::Unit::TestCase end def test_sourceselect - dest = tempfile() + dest = tempfile sources = [] 2.times { |i| i = i + 1 - source = tempfile() + source = tempfile sources << source file = File.join(source, "file#{i}") Dir.mkdir(source) @@ -452,9 +452,9 @@ class TestFileSources < Test::Unit::TestCase end def test_recursive_sourceselect - dest = tempfile() - source1 = tempfile() - source2 = tempfile() + dest = tempfile + source1 = tempfile + source2 = tempfile files = [] [source1, source2, File.join(source1, "subdir"), File.join(source2, "subdir")].each_with_index do |dir, i| Dir.mkdir(dir) @@ -482,8 +482,8 @@ class TestFileSources < Test::Unit::TestCase # #594 def test_purging_missing_remote_files - source = tempfile() - dest = tempfile() + source = tempfile + dest = tempfile s1 = File.join(source, "file1") s2 = File.join(source, "file2") d1 = File.join(dest, "file1") diff --git a/test/ral/type/host.rb b/test/ral/type/host.rb index 2715f6438..d05d67c67 100755 --- a/test/ral/type/host.rb +++ b/test/ral/type/host.rb @@ -27,7 +27,7 @@ class TestHost < Test::Unit::TestCase cleanup do @provider.default_target = @default_file end - @target = tempfile() + @target = tempfile @provider.default_target = @target end end @@ -98,7 +98,7 @@ class TestHost < Test::Unit::TestCase end def test_moddinghost - host = mkhost() + host = mkhost cleanup do host[:ensure] = :absent assert_apply(host) @@ -119,7 +119,7 @@ class TestHost < Test::Unit::TestCase end def test_invalid_ipaddress - host = mkhost() + host = mkhost assert_raise(Puppet::Error) { host[:ip] = "abc.def.ghi.jkl" @@ -127,7 +127,7 @@ class TestHost < Test::Unit::TestCase end def test_invalid_hostname - host = mkhost() + host = mkhost assert_raise(Puppet::Error) { host[:name] = "!invalid.hostname.$PID$" @@ -147,7 +147,7 @@ class TestHost < Test::Unit::TestCase end def test_valid_hostname - host = mkhost() + host = mkhost assert_nothing_raised { host[:name] = "yayness" diff --git a/test/ral/type/mailalias.rb b/test/ral/type/mailalias.rb index ff0e62e09..4d98a8f2a 100755 --- a/test/ral/type/mailalias.rb +++ b/test/ral/type/mailalias.rb @@ -26,7 +26,7 @@ class TestMailAlias < Test::Unit::TestCase cleanup do @provider.default_target = @default_file end - @target = tempfile() + @target = tempfile @provider.default_target = @target end end diff --git a/test/ral/type/port.rb b/test/ral/type/port.rb index d48aa8c2a..85592d14a 100755 --- a/test/ral/type/port.rb +++ b/test/ral/type/port.rb @@ -27,7 +27,7 @@ require 'puppettest' # cleanup do # @provider.default_target = oldpath # end -# @provider.default_target = tempfile() +# @provider.default_target = tempfile # end # end # @@ -105,7 +105,7 @@ require 'puppettest' # end # # def test_removal -# port = mkport() +# port = mkport # assert_nothing_raised { # port[:ensure] = :present # } @@ -123,7 +123,7 @@ require 'puppettest' # end # # def test_addingproperties -# port = mkport() +# port = mkport # assert_events([:port_created], port) # # port.delete(:alias) diff --git a/test/ral/type/resources.rb b/test/ral/type/resources.rb index 50d6839e7..d6c6c60ba 100755 --- a/test/ral/type/resources.rb +++ b/test/ral/type/resources.rb @@ -66,7 +66,7 @@ class TestResources < Test::Unit::TestCase assert_nothing_raised { assert(res.check("A String"), "String failed check") - assert(res.check(Puppet::Type.type(:file).new(:path => tempfile())), "File failed check") + assert(res.check(Puppet::Type.type(:file).new(:path => tempfile)), "File failed check") assert(res.check(Puppet::Type.type(:user).new(:name => "yayness")), "User failed check in package") } diff --git a/test/ral/type/sshkey.rb b/test/ral/type/sshkey.rb index 4e5525bd3..a23ddf151 100755 --- a/test/ral/type/sshkey.rb +++ b/test/ral/type/sshkey.rb @@ -26,7 +26,7 @@ class TestSSHKey < Test::Unit::TestCase cleanup do @provider.default_target = oldpath end - @provider.default_target = tempfile() + @provider.default_target = tempfile end end @@ -78,7 +78,7 @@ class TestSSHKey < Test::Unit::TestCase def test_simplekey key = mkkey - file = tempfile() + file = tempfile key[:target] = file key[:provider] = :parsed @@ -100,7 +100,7 @@ class TestSSHKey < Test::Unit::TestCase end def test_removal - sshkey = mkkey() + sshkey = mkkey assert_nothing_raised { sshkey[:ensure] = :present } @@ -121,7 +121,7 @@ class TestSSHKey < Test::Unit::TestCase keys = [] names = [] 3.times { - k = mkkey() + k = mkkey #h[:ensure] = :present #h.retrieve keys << k @@ -133,7 +133,7 @@ class TestSSHKey < Test::Unit::TestCase @catalog.clear(true) @catalog = nil - newkey = mkkey() + newkey = mkkey #newkey[:ensure] = :present names << newkey.name assert_apply(newkey) diff --git a/test/ral/type/user.rb b/test/ral/type/user.rb index 26cf7b1e8..9927d705e 100755 --- a/test/ral/type/user.rb +++ b/test/ral/type/user.rb @@ -70,7 +70,7 @@ class TestUser < Test::Unit::TestCase :name => name, :comment => "Puppet Testing User", :gid => Puppet::Util::SUIDManager.gid, - :shell => findshell(), + :shell => findshell, :home => "/home/#{name}" ) @@ -82,7 +82,7 @@ class TestUser < Test::Unit::TestCase end def test_autorequire - file = tempfile() + file = tempfile comp = nil user = nil group =nil @@ -116,11 +116,11 @@ class TestUser < Test::Unit::TestCase } rels = nil - assert_nothing_raised() { rels = user.autorequire } + assert_nothing_raised { rels = user.autorequire } assert(rels.detect { |r| r.source == group }, "User did not require group") assert(rels.detect { |r| r.source == ogroup }, "User did not require other groups") - assert_nothing_raised() { rels = home.autorequire } + assert_nothing_raised { rels = home.autorequire } assert(rels.detect { |r| r.source == user }, "Homedir did not require user") end diff --git a/test/ral/type/yumrepo.rb b/test/ral/type/yumrepo.rb index 8efa83518..5469ae485 100755 --- a/test/ral/type/yumrepo.rb +++ b/test/ral/type/yumrepo.rb @@ -10,7 +10,7 @@ class TestYumRepo < Test::Unit::TestCase def setup super - @yumdir = tempfile() + @yumdir = tempfile Dir.mkdir(@yumdir) @yumconf = File.join(@yumdir, "yum.conf") File.open(@yumconf, "w") do |f| @@ -33,7 +33,7 @@ class TestYumRepo < Test::Unit::TestCase assert_equal('New description', devel.property(:descr).should) assert_apply(devel) - inifile = Puppet::Type.type(:yumrepo).read() + inifile = Puppet::Type.type(:yumrepo).read assert_equal('New description', inifile['development']['name']) assert_equal('Fedora Core $releasever - $basearch - Base', inifile['base']['name']) assert_equal("foo\n bar\n baz", inifile['base']['exclude']) @@ -56,7 +56,7 @@ class TestYumRepo < Test::Unit::TestCase repo = make_repo("base", values) assert_apply(repo) - inifile = Puppet::Type.type(:yumrepo).read() + inifile = Puppet::Type.type(:yumrepo).read sections = all_sections(inifile) assert_equal(['base', 'main'], sections) text = inifile["base"].format @@ -75,7 +75,7 @@ class TestYumRepo < Test::Unit::TestCase :baseurl => baseurl }) devel.retrieve assert_apply(devel) - inifile = Puppet::Type.type(:yumrepo).read() + inifile = Puppet::Type.type(:yumrepo).read sec = inifile["development"] assert_nil(sec["mirrorlist"]) assert_equal(baseurl, sec["baseurl"]) diff --git a/test/ral/type/zone.rb b/test/ral/type/zone.rb index f6ef98a6e..21440168c 100755 --- a/test/ral/type/zone.rb +++ b/test/ral/type/zone.rb @@ -16,7 +16,7 @@ class TestZone < PuppetTest::TestCase def mkzone(name) zone = nil - base = tempfile() + base = tempfile Dir.mkdir(base) File.chmod(0700, base) root = File.join(base, "zonebase") @@ -214,7 +214,7 @@ class TestZoneAsRoot < TestZone def test_getconfig zone = mkzone("configtesting") - base = tempfile() + base = tempfile zone[:path] = base ip = "192.168.0.1" @@ -223,7 +223,7 @@ class TestZoneAsRoot < TestZone IO.popen("zonecfg -z configtesting -f -", "w") do |f| f.puts %{create -b -set zonepath=#{tempfile()} +set zonepath=#{tempfile} set autoboot=true add inherit-pkg-dir set dir=/lib diff --git a/test/util/inifile.rb b/test/util/inifile.rb index 2d5841ca0..f465dfd58 100755 --- a/test/util/inifile.rb +++ b/test/util/inifile.rb @@ -131,7 +131,7 @@ class TestFileType < Test::Unit::TestCase end def mkfile(content) - file = tempfile() + file = tempfile File.open(file, "w") { |f| f.print(content) } file end diff --git a/test/util/log.rb b/test/util/log.rb index cbaa71a55..8d5c8c558 100755 --- a/test/util/log.rb +++ b/test/util/log.rb @@ -23,7 +23,7 @@ class TestLog < Test::Unit::TestCase def getlevels levels = nil - assert_nothing_raised() { + assert_nothing_raised { levels = [] Puppet::Util::Log.eachlevel { |level| levels << level } } @@ -34,7 +34,7 @@ class TestLog < Test::Unit::TestCase def mkmsgs(levels) levels.collect { |level| next if level == :alert - assert_nothing_raised() { + assert_nothing_raised { Puppet::Util::Log.new( @@ -52,9 +52,9 @@ class TestLog < Test::Unit::TestCase levels = nil Puppet::Util::Log.level = :debug levels = getlevels - logfile = tempfile() + logfile = tempfile fact = nil - assert_nothing_raised() { + assert_nothing_raised { Puppet::Util::Log.newdestination(logfile) } msgs = mkmsgs(levels) @@ -64,7 +64,7 @@ class TestLog < Test::Unit::TestCase assert(FileTest.exists?(logfile), "Did not create logfile") - assert_nothing_raised() { + assert_nothing_raised { File.open(logfile) { |of| count = of.readlines.length } @@ -74,12 +74,12 @@ class TestLog < Test::Unit::TestCase def test_syslog levels = nil - assert_nothing_raised() { + assert_nothing_raised { levels = getlevels.reject { |level| level == :emerg || level == :crit } } - assert_nothing_raised() { + assert_nothing_raised { Puppet::Util::Log.newdestination("syslog") } # there's really no way to verify that we got syslog messages... @@ -88,11 +88,11 @@ class TestLog < Test::Unit::TestCase end def test_levelmethods - assert_nothing_raised() { + assert_nothing_raised { Puppet::Util::Log.newdestination("/dev/null") } getlevels.each { |level| - assert_nothing_raised() { + assert_nothing_raised { Puppet.send(level,"Testing for #{level}") } } @@ -108,7 +108,7 @@ class TestLog < Test::Unit::TestCase end def test_creatingdirs - dir = tempfile() + dir = tempfile file = File.join(dir, "logfile") Puppet::Util::Log.newdestination file Puppet.info "testing logs" @@ -137,7 +137,7 @@ class TestLog < Test::Unit::TestCase file = Puppet::Type.type(:file).new( - :path => tempfile(), + :path => tempfile, :check => %w{owner group} ) diff --git a/test/util/settings.rb b/test/util/settings.rb index 2e2d0b019..d05f555ec 100755 --- a/test/util/settings.rb +++ b/test/util/settings.rb @@ -60,7 +60,7 @@ class TestSettings < Test::Unit::TestCase newc[name] = true end - newfile = tempfile() + newfile = tempfile File.open(newfile, "w") { |f| @config.to_config.split("\n").each do |line| # Uncomment the settings, so they actually take. @@ -207,7 +207,7 @@ class TestSettings < Test::Unit::TestCase attr3 = $attrdir/other } - file = tempfile() + file = tempfile File.open(file, "w") { |f| f.puts text } result = nil @@ -338,7 +338,7 @@ class TestSettings < Test::Unit::TestCase end def test_groupsetting - cfile = tempfile() + cfile = tempfile group = "yayness" @@ -363,15 +363,15 @@ class TestSettings < Test::Unit::TestCase def test_writingfiles File.umask(0022) - path = tempfile() + path = tempfile mode = 0644 config = mkconfig args = { :default => path, :mode => mode, :desc => "yay" } - user = nonrootuser() - group = nonrootgroup() + user = nonrootuser + group = nonrootgroup if Puppet.features.root? args[:owner] = user.name @@ -403,15 +403,15 @@ class TestSettings < Test::Unit::TestCase def test_mkdir File.umask(0022) - path = tempfile() + path = tempfile mode = 0755 config = mkconfig args = { :default => path, :mode => mode, :desc => "a file" } - user = nonrootuser() - group = nonrootgroup() + user = nonrootuser + group = nonrootgroup if Puppet.features.root? args[:owner] = user.name @@ -442,7 +442,7 @@ class TestSettings < Test::Unit::TestCase # Make sure that tags are ignored when configuring def test_configs_ignore_tags config = mkconfig - file = tempfile() + file = tempfile config.setdefaults( @@ -517,13 +517,13 @@ class TestSettings < Test::Unit::TestCase end def test_parse_removes_quotes - config = mkconfig() + config = mkconfig config.setdefaults(:mysection, :singleq => ["single", "yay"]) config.setdefaults(:mysection, :doubleq => ["double", "yay"]) config.setdefaults(:mysection, :none => ["noquote", "yay"]) config.setdefaults(:mysection, :middle => ["midquote", "yay"]) - file = tempfile() + file = tempfile # Set one parameter in the file File.open(file, "w") { |f| f.puts %{[main]\n @@ -549,7 +549,7 @@ class TestSettings < Test::Unit::TestCase # Test that config parameters correctly call passed-in blocks when the value # is set. def test_paramblocks - config = mkconfig() + config = mkconfig testing = nil assert_nothing_raised do @@ -603,7 +603,7 @@ class TestSettings < Test::Unit::TestCase config.setdefaults( :yay, - :mydir => {:default => tempfile(), + :mydir => {:default => tempfile, :mode => 0644, :owner => "root", @@ -642,8 +642,8 @@ class TestSettings < Test::Unit::TestCase # #415 def test_remove_trailing_spaces - config = mkconfig() - file = tempfile() + config = mkconfig + file = tempfile File.open(file, "w") { |f| f.puts "rah = something " } config.setdefaults(:yay, :config => [file, "eh"], :rah => ["testing", "a desc"]) @@ -654,9 +654,9 @@ class TestSettings < Test::Unit::TestCase # #484 def test_parsing_unknown_variables - logstore() - config = mkconfig() - file = tempfile() + logstore + config = mkconfig + file = tempfile File.open(file, "w") { |f| f.puts %{[main]\n one = one diff --git a/test/util/storage.rb b/test/util/storage.rb index ae28bf992..cde5d6414 100755 --- a/test/util/storage.rb +++ b/test/util/storage.rb @@ -9,7 +9,7 @@ class TestStorage < Test::Unit::TestCase include PuppetTest def mkfile - path = tempfile() + path = tempfile File.open(path, "w") { |f| f.puts :yayness } @@ -24,9 +24,9 @@ class TestStorage < Test::Unit::TestCase end def test_storeandretrieve - path = tempfile() + path = tempfile - f = mkfile() + f = mkfile # Load first, since that's what we do in the code base; this creates # all of the necessary directories. @@ -72,7 +72,7 @@ class TestStorage < Test::Unit::TestCase Puppet::Util::Storage.clear Puppet::Util::Storage.load - f = mkfile() + f = mkfile state = Puppet::Util::Storage.cache(f) assert_same Hash, state.class assert_equal 0, state.size diff --git a/test/util/subclass_loader.rb b/test/util/subclass_loader.rb index d2b035f6c..946bc2b34 100755 --- a/test/util/subclass_loader.rb +++ b/test/util/subclass_loader.rb @@ -16,7 +16,7 @@ class TestPuppetUtilSubclassLoader < Test::Unit::TestCase def mk_subclass(name, path, parent) # Make a fake client unless defined?(@basedir) - @basedir ||= tempfile() + @basedir ||= tempfile $LOAD_PATH << @basedir cleanup { $LOAD_PATH.delete(@basedir) if $LOAD_PATH.include?(@basedir) } end diff --git a/test/util/utiltest.rb b/test/util/utiltest.rb index a66b175e5..45c48727d 100755 --- a/test/util/utiltest.rb +++ b/test/util/utiltest.rb @@ -11,7 +11,7 @@ class TestPuppetUtil < Test::Unit::TestCase def test_withumask oldmask = File.umask - path = tempfile() + path = tempfile # FIXME this fails on FreeBSD with a mode of 01777 Puppet::Util.withumask(000) do @@ -23,7 +23,7 @@ class TestPuppetUtil < Test::Unit::TestCase end def test_benchmark - path = tempfile() + path = tempfile str = "yayness" File.open(path, "w") do |f| f.print "yayness" end @@ -119,7 +119,7 @@ class TestPuppetUtil < Test::Unit::TestCase end def test_execute - command = tempfile() + command = tempfile File.open(command, "w") { |f| f.puts %{#!/bin/sh\n/bin/echo "$1">&1; echo "$2">&2} } @@ -148,7 +148,7 @@ class TestPuppetUtil < Test::Unit::TestCase end # And that we can tell it not to fail - assert_nothing_raised() do + assert_nothing_raised do out = Puppet::Util.execute(["touch", "/no/such/file/could/exist"], :failonfail => false) end @@ -156,7 +156,7 @@ class TestPuppetUtil < Test::Unit::TestCase # Make sure we correctly set our uid and gid user = nonrootuser group = nonrootgroup - file = tempfile() + file = tempfile assert_nothing_raised do Puppet::Util.execute(["touch", file], :uid => user.name, :gid => group.name) end @@ -170,7 +170,7 @@ class TestPuppetUtil < Test::Unit::TestCase end # (#565) Test the case of patricide. - patricidecommand = tempfile() + patricidecommand = tempfile File.open(patricidecommand, "w") { |f| f.puts %{#!/bin/bash\n/bin/bash -c 'kill -TERM \$PPID' &;\n while [ 1 ]; do echo -n ''; done;\n} } @@ -220,7 +220,7 @@ class TestPuppetUtil < Test::Unit::TestCase end - # Check whether execute() accepts strings in addition to arrays. + # Check whether execute accepts strings in addition to arrays. def test_string_exec cmd = "/bin/echo howdy" output = nil |