From: <jh...@us...> - 2011-01-07 03:32:27
|
Revision: 249 http://etch.svn.sourceforge.net/etch/?rev=249&view=rev Author: jheiss Date: 2011-01-07 03:32:19 +0000 (Fri, 07 Jan 2011) Log Message: ----------- Add :testname option to all remaining run_etch calls. Modified Paths: -------------- trunk/test/test_actions.rb trunk/test/test_auth.rb trunk/test/test_commands.rb trunk/test/test_delete.rb trunk/test/test_depend.rb trunk/test/test_file.rb trunk/test/test_history.rb trunk/test/test_link.rb trunk/test/test_local_requests.rb trunk/test/test_nodegroups.rb trunk/test/test_options.rb trunk/test/test_outputcapture.rb trunk/test/test_scripts.rb trunk/test/test_transitions.rb Modified: trunk/test/test_actions.rb =================================================================== --- trunk/test/test_actions.rb 2010-12-24 00:50:24 UTC (rev 248) +++ trunk/test/test_actions.rb 2011-01-07 03:32:19 UTC (rev 249) @@ -33,6 +33,7 @@ # Basic tests to ensure that actions are performed under normal # circumstances # + testname = 'basic action test' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -74,9 +75,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running initial action test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the actions were executed # The setup actions will get run several times as we loop @@ -100,7 +99,7 @@ # Run etch again and make sure that the exec_once command wasn't run # again - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => 'action test, exec_once') assert_equal("exec_once\n", get_file_contents("#{@repodir}/exec_once"), 'exec_once_2nd_check') end @@ -109,6 +108,7 @@ # # Test a failed setup command to ensure etch aborts # + testname = 'failed setup' # Put some text into the original file so that we can make sure it # is not touched. @@ -140,9 +140,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running initial action test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) # Verify that the file was not touched assert_equal(origcontents, get_file_contents(@targetfile), 'failed setup') @@ -152,6 +150,7 @@ # # Test a failed pre command to ensure etch aborts # + testname = 'failed pre' # Put some text into the original file so that we can make sure it # is not touched. @@ -183,9 +182,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running failed pre test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) # Verify that the file was not touched assert_equal(origcontents, get_file_contents(@targetfile), 'failed pre') @@ -196,6 +193,7 @@ # Run a test where the test action fails, ensure that the original # target file is restored and any post actions re-run afterwards # + testname = 'failed test' # Put some text into the original file so that we can make sure it # is restored. @@ -232,9 +230,7 @@ file.write("Testing a failed test\n") end - # Run etch - #puts "Running failed test test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the original was restored, and that post was run twice assert_equal(origcontents, get_file_contents(@targetfile), 'failed test target') @@ -246,6 +242,7 @@ # Run a test where the test_before_post action fails, ensure that # post is not run # + testname = 'failed test_before_post' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -268,9 +265,7 @@ EOF end - # Run etch - #puts "Running failed test_before_post test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) # Verify that post was not run assert(!File.exist?("#{@repodir}/post"), 'failed test_before_post post') @@ -279,14 +274,13 @@ # Run a test where the test action fails, and the original target file # is a symlink. Ensure that the symlink is restored. # + testname = 'failed test_before_post symlink' # Prepare the target File.delete(@targetfile) if File.exist?(@targetfile) File.symlink(@destfile, @targetfile) - # Run etch - #puts "Running failed test symlink test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) # Verify that the original symlink was restored assert_equal(@destfile, File.readlink(@targetfile), 'failed test symlink') @@ -295,15 +289,14 @@ # Run a test where the test action fails, and the original target file # is a directory. Ensure that the directory is restored. # + testname = 'failed test_before_post directory' # Prepare the target File.delete(@targetfile) if File.exist?(@targetfile) Dir.mkdir(@targetfile) File.open("#{@targetfile}/testfile", 'w') { |file| } - # Run etch - #puts "Running failed test directory test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) # Verify that the original directory was restored assert(File.directory?(@targetfile), 'failed test directory') @@ -314,6 +307,7 @@ # target file. Ensure that the end result is that there is no file left # behind. # + testname = 'failed test_before_post no original' # We can reuse the config.xml from the previous test @@ -323,9 +317,7 @@ end File.delete("#{@repodir}/post") if File.exist?("#{@repodir}/post") - # Run etch - #puts "Running failed test no original file test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) # Verify that the lack of an original file was restored assert(!File.exist?(@targetfile) && !File.symlink?(@targetfile), 'failed test no original file') @@ -344,6 +336,7 @@ # back if the test fails) is made as /etc/foo/bar.XXXXX, which requires # that /etc/foo exist first. # + testname = 'test action with nested target' nestedtargetdir = deleted_tempfile nestedtargetfile = File.join(nestedtargetdir, 'etchnestedtest') @@ -370,9 +363,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running nested target with test test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly assert_equal(sourcecontents, get_file_contents(nestedtargetfile), 'nested target with test') @@ -390,6 +381,7 @@ # So if the user wants to use something like && in an action they must # escape the & with & # + testname = 'XML escape' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -413,9 +405,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running XML escape test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the action was executed assert_equal("post\n", get_file_contents("#{@repodir}/post_with_escape"), 'post with escape') @@ -425,6 +415,7 @@ # # Test an action involving passing an environment variable # + testname = 'action with environment variable' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -456,9 +447,7 @@ end File.chmod(0755, "#{@repodir}/post_with_env") - # Run etch - #puts "Running environment variable test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the action was executed assert_equal("testvalue\n", get_file_contents("#{@repodir}/post_with_env_output"), 'post with environment variable') Modified: trunk/test/test_auth.rb =================================================================== --- trunk/test/test_auth.rb 2010-12-24 00:50:24 UTC (rev 248) +++ trunk/test/test_auth.rb 2011-01-07 03:32:19 UTC (rev 249) @@ -89,9 +89,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly assert_equal(sourcecontents, get_file_contents(@targetfile), testname) @@ -120,9 +118,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly assert_equal(sourcecontents, get_file_contents(@targetfile), testname) @@ -159,9 +155,7 @@ file.write(origcontents) end - # Run etch with the wrong key to force a bad signature - #puts "Running '#{testname}' test" - run_etch(@server, @testroot, :errors_expected => true, :key => "--key=#{File.join(File.dirname(__FILE__), 'keys', 'testkey2')}") + run_etch(@server, @testroot, :errors_expected => true, :key => "--key=#{File.join(File.dirname(__FILE__), 'keys', 'testkey2')}", :testname => testname) # Verify that the file was not touched assert_equal(origcontents, get_file_contents(@targetfile), testname) @@ -204,9 +198,7 @@ file.write(origcontents) end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) # Verify that the file was not touched assert_equal(origcontents, get_file_contents(@targetfile), testname) @@ -219,7 +211,7 @@ sleep 3 repodir2 = initialize_repository server2 = start_server(repodir2) - run_etch(server2, @testroot) + run_etch(server2, @testroot, :testname => 'adding client to database') stop_server(server2) remove_repository(repodir2) @@ -247,9 +239,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly assert_equal(sourcecontents, get_file_contents(@targetfile), testname) Modified: trunk/test/test_commands.rb =================================================================== --- trunk/test/test_commands.rb 2010-12-24 00:50:24 UTC (rev 248) +++ trunk/test/test_commands.rb 2011-01-07 03:32:19 UTC (rev 249) @@ -45,9 +45,7 @@ EOF end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly assert_equal(testname, get_file_contents(@targetfile), testname) @@ -75,9 +73,7 @@ EOF end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) end def test_commands_guard_succeeds @@ -104,9 +100,7 @@ File.open(@targetfile, 'w') { |file| file.print(testname) } - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was not touched assert_equal(testname, get_file_contents(@targetfile), testname) @@ -142,9 +136,7 @@ EOF end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that both steps ran and in the proper order assert_equal("firststep\nsecondstep\n", get_file_contents(@targetfile), testname) @@ -189,7 +181,7 @@ # Run etch #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that both commands ran, ordering doesn't matter assert_equal(['firstcmd', 'secondcmd'], get_file_contents(@targetfile).split("\n").sort, testname) @@ -233,9 +225,7 @@ EOF end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that both commands ran and in the proper order assert_equal("firstcmd\nsecondcmd\n", get_file_contents(@targetfile), testname) @@ -287,9 +277,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the command-generated file and the regular file were created # properly @@ -332,9 +320,7 @@ EOF end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that only the desired step executed assert_equal("notingroup\n", get_file_contents(@targetfile), testname) @@ -357,9 +343,7 @@ EOF end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) end def teardown Modified: trunk/test/test_delete.rb =================================================================== --- trunk/test/test_delete.rb 2010-12-24 00:50:24 UTC (rev 248) +++ trunk/test/test_delete.rb 2011-01-07 03:32:19 UTC (rev 249) @@ -45,9 +45,7 @@ EOF end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was deleted assert(!File.exist?(@targetfile) && !File.symlink?(@targetfile), testname) @@ -71,9 +69,7 @@ EOF end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the link was deleted assert(!File.exist?(@targetfile) && !File.symlink?(@targetfile), testname) @@ -99,9 +95,7 @@ EOF end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) # Verify that the directory was not deleted assert(File.directory?(@targetfile), testname) @@ -128,9 +122,7 @@ EOF end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the directory was deleted assert(!File.exist?(@targetfile) && !File.symlink?(@targetfile), testname) @@ -151,9 +143,7 @@ EOF end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that we still don't have a file. That's rather unlikely, # this is really more a test that etch doesn't throw an error if @@ -164,6 +154,7 @@ # # Test duplicate script instructions # + testname = 'duplicate script' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -185,15 +176,14 @@ file.puts("@contents << 'true'") end - # Run etch - #puts "Running duplicate script instructions test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert(!File.exist?(@targetfile), 'duplicate script instructions') # # Test contradictory script instructions # + testname = 'contradictory script' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -218,9 +208,7 @@ file.puts("@contents << 'true'") end - # Run etch - #puts "Running contradictory script instructions test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) # Verify that the file wasn't removed assert(File.exist?(@targetfile), 'contradictory script instructions') Modified: trunk/test/test_depend.rb =================================================================== --- trunk/test/test_depend.rb 2010-12-24 00:50:24 UTC (rev 248) +++ trunk/test/test_depend.rb 2011-01-07 03:32:19 UTC (rev 249) @@ -29,6 +29,7 @@ # # Run a basic dependency test # + testname = 'initial dependency test' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -74,9 +75,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running initial dependency test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the files were created properly assert_equal(sourcecontents, get_file_contents(@targetfile), 'dependency file 1') @@ -136,9 +135,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot, :extra_args => @targetfile) + run_etch(@server, @testroot, :extra_args => @targetfile, :testname => testname) # Verify that the files were created properly assert_equal(sourcecontents, get_file_contents(@targetfile), 'single request dependency file 1') @@ -200,9 +197,7 @@ end end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot, :errors_expected => true, :extra_args => @targetfile) + run_etch(@server, @testroot, :errors_expected => true, :extra_args => @targetfile, :testname => testname) # Verify that the files weren't modified assert_equal(origcontents, get_file_contents(@targetfile), 'circular dependency file 1') @@ -254,9 +249,7 @@ EOF end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the regular file and the command-generated file were created # properly Modified: trunk/test/test_file.rb =================================================================== --- trunk/test/test_file.rb 2010-12-24 00:50:24 UTC (rev 248) +++ trunk/test/test_file.rb 2011-01-07 03:32:19 UTC (rev 249) @@ -28,6 +28,7 @@ # # Run a test of basic file creation # + testname = 'initial file test' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -47,9 +48,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running initial file test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly correctcontents = '' @@ -64,6 +63,7 @@ # # Test with a template # + testname = 'file with template' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -84,9 +84,7 @@ file.write(templatecontents) end - # Run etch - #puts "Running initial file test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly correctcontents = '' @@ -101,6 +99,7 @@ # # Test using a different warning file # + testname = 'different warning file' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -125,9 +124,7 @@ file.write(warningcontents) end - # Run etch - #puts "Running different warning file test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly correctcontents = '' @@ -142,6 +139,7 @@ # # Test using no warning file # + testname = 'no warning file' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -162,9 +160,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running no warning file test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly assert_equal(sourcecontents, get_file_contents(@targetfile), 'no warning file') @@ -172,6 +168,7 @@ # # Test using a different line comment string # + testname = 'different line comment string' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -192,9 +189,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running different line comment test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly correctcontents = '' @@ -209,6 +204,7 @@ # # Test using comment open/close # + testname = 'comment open/close' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -231,9 +227,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running comment open/close test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly correctcontents = "/*\n" @@ -249,6 +243,7 @@ # # Test warning on second line # + testname = 'warning on second line' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -271,9 +266,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running warning on second line test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly correctcontents = sourcecontents_firstline @@ -289,6 +282,7 @@ # # Test no space around warning # + testname = 'no space around warning' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -309,9 +303,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running no space around warning test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly correctcontents = '' @@ -325,6 +317,7 @@ # # Test ownership and permissions # + testname = 'ownership and permissions' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -342,9 +335,7 @@ EOF end - # Run etch - #puts "Running file ownership and permissions test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file ownership got set correctly # Most systems don't support give-away chown, so this test won't work @@ -362,6 +353,7 @@ # # Test ownership w/ bogus owner/group names # + testname = 'file ownership w/ bogus owner/group names' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -378,9 +370,7 @@ EOF end - # Run etch - #puts "Running file ownership w/ bogus owner/group names" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the ownership defaulted to UID/GID 0 # Most systems don't support give-away chown, so this test won't work @@ -395,6 +385,7 @@ # # Run a test of always_manage_metadata # + testname = 'always_manage_metadata' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -414,9 +405,7 @@ file.write(testcontents) end - # Run etch - #puts "Running always_manage_metadata test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file permissions got set correctly perms = File.stat(@targetfile).mode & 07777 @@ -428,6 +417,7 @@ # # Test duplicate plain instructions # + testname = 'duplicate plain instructions' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -454,9 +444,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running duplicate plain instructions test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file contents were updated assert_equal(sourcecontents, get_file_contents(@targetfile), 'duplicate plain instructions') @@ -464,6 +452,7 @@ # # Test contradictory plain instructions # + testname = 'contradictory plain instructions' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -493,9 +482,7 @@ file.write(source2contents) end - # Run etch - #puts "Running contradictory plain instructions test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) # Verify that the file contents didn't change assert_equal(origcontents, get_file_contents(@targetfile), 'contradictory plain instructions') @@ -503,6 +490,7 @@ # # Test duplicate template instructions # + testname = 'duplicate template instructions' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -529,9 +517,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running duplicate template instructions test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file contents were updated assert_equal(sourcecontents, get_file_contents(@targetfile), 'duplicate template instructions') @@ -539,6 +525,7 @@ # # Test contradictory template instructions # + testname = 'contradictory template instructions' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -568,9 +555,7 @@ file.write(source2contents) end - # Run etch - #puts "Running contradictory template instructions test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) # Verify that the file contents didn't change assert_equal(origcontents, get_file_contents(@targetfile), 'contradictory template instructions') @@ -578,6 +563,7 @@ # # Test duplicate script instructions # + testname = 'duplicate script instructions' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -604,9 +590,7 @@ file.puts("@contents << '#{sourcecontents}'") end - # Run etch - #puts "Running duplicate script instructions test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file contents were updated assert_equal(sourcecontents, get_file_contents(@targetfile), 'duplicate script instructions') @@ -614,6 +598,7 @@ # # Test contradictory script instructions # + testname = 'contradictory script instructions' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -643,9 +628,7 @@ file.write(source2contents) end - # Run etch - #puts "Running contradictory script instructions test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) # Verify that the file contents didn't change assert_equal(origcontents, get_file_contents(@targetfile), 'contradictory script instructions') @@ -682,9 +665,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly assert_equal(sourcecontents, get_file_contents(specialtargetfile), testname) Modified: trunk/test/test_history.rb =================================================================== --- trunk/test/test_history.rb 2010-12-24 00:50:24 UTC (rev 248) +++ trunk/test/test_history.rb 2011-01-07 03:32:19 UTC (rev 249) @@ -31,6 +31,7 @@ # # Ensure original file is backed up and history log started # + testname = 'initial history test' # Put some text into the original file so that we can make sure it was # properly backed up. @@ -58,9 +59,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running initial history test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert_equal(origcontents, get_file_contents(@origfile), 'original backup of file') assert_equal(origcontents, get_file_contents(File.join(@historydir, '0000')), '0000 history file') @@ -69,15 +68,14 @@ # # Ensure history log is updated and original file does not change # + testname = 'history update' updatedsourcecontents = "This is a second test\n" File.open("#{@repodir}/source/#{@targetfile}/source", 'w') do |file| file.write(updatedsourcecontents) end - # Run etch - #puts "Running update test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert_equal(origcontents, get_file_contents(@origfile), 'original backup of file unchanged') assert_equal(origcontents, get_file_contents(File.join(@historydir, '0000')), '0000 history file') @@ -87,6 +85,7 @@ # # Test revert feature # + testname = 'revert' # Intentionally mix revert with other instructions to make sure the file # is reverted and nothing else happens. @@ -105,9 +104,7 @@ EOF end - # Run etch - #puts "Running revert test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert_equal(origcontents, get_file_contents(@targetfile), 'original contents reverted') assert(!File.exist?(@origfile), 'reverted original file') @@ -120,15 +117,14 @@ # Update the contents of a reverted file and make sure etch doesn't # overwrite them, as it should no longer be managing the file. # + testname = 'no update to reverted file' updatedorigcontents = "This is new original text\n" File.open(@targetfile, 'w') do |file| file.write(updatedorigcontents) end - # Run etch - #puts "Running revert test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert_equal(updatedorigcontents, get_file_contents(@targetfile), 'Updated original contents unchanged') assert(!File.exist?(@origfile), 'reverted original file') @@ -149,6 +145,7 @@ # tries before we achieved convergence and the client sent the correct # original contents. # + testname = 'history setup' origcontents = "This is the original text" @@ -175,9 +172,7 @@ file.puts("@contents << IO.read(@original_file)") end - # Run etch - #puts "Running history setup test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert_equal(origcontents + "\n", get_file_contents(@origfile), 'original backup of file via setup') assert_equal(sourcecontents + origcontents + "\n", get_file_contents(@targetfile), 'contents using original backup of file via setup') @@ -215,9 +210,7 @@ EOF end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => 'delayed history setup, first run') origcontents = "This is the original text for #{testname}" @@ -243,9 +236,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert_equal(origcontents + "\n", get_file_contents(@origfile), testname) end @@ -254,6 +245,7 @@ # # Ensure original file is backed up when it is a link # + testname = 'history link' # Generate another file to use as our link target @destfile = released_tempfile @@ -281,9 +273,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running history link test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert_equal(@destfile, File.readlink(@origfile), 'original backup of link') assert_match("#{@targetfile} -> #{@destfile}", get_file_contents(File.join(@historydir, '0000')), '0000 history file of link') @@ -293,6 +283,7 @@ # # Ensure original file is backed up when it is a directory # + testname = 'history directory' # Make the original target a directory File.delete(@targetfile) @@ -326,9 +317,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running history directory test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert(File.directory?(@origfile), 'original backup of directory') # Verify that etch backed up the original directory properly @@ -346,6 +335,7 @@ # being converted to something else, as the original backup is handled # differently in that case # + testname = 'history directory' origtarfile = File.join(@testroot, 'var', 'etch', 'orig', "#{@targetfile}.TAR") @@ -374,9 +364,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running history directory contents test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # In this case, because we converted a directory to something else the # original will be a tarball of the directory @@ -390,6 +378,7 @@ # # Test the conversion of old RCS history logs to the new format # + testname = 'history conversion' # Mock up an original file and RCS history log mockorigcontents = "This is the original text\n" @@ -443,9 +432,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running history conversion test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert_equal(mockorigcontents, get_file_contents(File.join(@historydir, '0000')), 'RCS conv 0000 history file') assert_equal(mocksourcecontents, get_file_contents(File.join(@historydir, '0001')), 'RCS conv 0001 history file') Modified: trunk/test/test_link.rb =================================================================== --- trunk/test/test_link.rb 2010-12-24 00:50:24 UTC (rev 248) +++ trunk/test/test_link.rb 2011-01-07 03:32:19 UTC (rev 249) @@ -37,6 +37,7 @@ # # Run a test of creating a link # + testname = 'initial link' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -49,15 +50,14 @@ EOF end - # Run etch - #puts "Running initial link test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert_equal(@destfile, File.readlink(@targetfile), 'link create') # # Run a test of updating the link to point to a different destination # + testname = 'link update' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -70,9 +70,7 @@ EOF end - # Run etch - #puts "Running link update test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert_equal(@destfile2, File.readlink(@targetfile), 'link update') @@ -83,6 +81,7 @@ # we write out the updated link, in case it has problems with links to # files that don't exist (we had such a bug once). # + testname = 'link update from non-existent file' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -99,9 +98,7 @@ # previous test) File.delete(@destfile2) - # Run etch - #puts "Running link update from non-existent file test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert_equal(@destfile, File.readlink(@targetfile), 'link update from non-existent file') end @@ -111,6 +108,7 @@ # Run a test where we ask etch to create a link to a non-existent # destination. It should fail by design. # + testname = 'link to non-existent destination' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -125,9 +123,7 @@ File.delete(@destfile) - # Run etch - #puts "Running link to non-existent destination test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the link was not created assert(!File.symlink?(@targetfile), 'link to non-existent destination') @@ -136,6 +132,7 @@ # Then run the same test (link to non-existent destination) with the # override flag turned on to make sure etch does create the link. # + testname = 'link to non-existent destination with override' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -149,9 +146,7 @@ EOF end - # Run etch - #puts "Running link to non-existent destination with override test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the link was updated properly assert_equal(@destfile, File.readlink(@targetfile), 'link to non-existent destination with override') @@ -161,6 +156,7 @@ # # Test creating a relative link # + testname = 'relative link' # We'll use @destfile as the target, but need a relative path to it. # Conveniently Pathname has a function to figure that out for us. @@ -178,9 +174,7 @@ EOF end - # Run etch - #puts "Running relative link test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the link was updated properly assert_equal(reldestfile, File.readlink(@targetfile), 'relative link') @@ -190,6 +184,7 @@ # # Test ownership and permissions # + testname = 'link ownership and permissions' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -205,9 +200,7 @@ EOF end - # Run etch - #puts "Running link ownership and permissions test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the link ownership got set correctly # Most systems don't support give-away chown, so this test won't work @@ -227,6 +220,7 @@ # # Test duplicate dest instructions # + testname = 'duplicate dest instructions' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -240,9 +234,7 @@ EOF end - # Run etch - #puts "Running duplicate dest instructions test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert_equal(@destfile, File.readlink(@targetfile), 'duplicate dest instructions') end @@ -251,6 +243,7 @@ # # Test contradictory dest instructions # + testname = 'contradictory dest instructions' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -264,9 +257,7 @@ EOF end - # Run etch - #puts "Running contradictory dest instructions test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) # Verify that the link wasn't created assert(!File.symlink?(@targetfile) && !File.exist?(@targetfile), 'contradictory dest instructions') @@ -276,6 +267,7 @@ # # Test duplicate script instructions # + testname = 'duplicate script instructions' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -293,9 +285,7 @@ file.puts("@contents << '#{@destfile}'") end - # Run etch - #puts "Running duplicate script instructions test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert_equal(@destfile, File.readlink(@targetfile), 'duplicate script instructions') end @@ -304,6 +294,7 @@ # # Test contradictory script instructions # + testname = 'contradictory script instructions' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -324,9 +315,7 @@ file.puts("@contents << '#{@destfile2}'") end - # Run etch - #puts "Running contradictory script instructions test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) # Verify that the link wasn't created assert(!File.symlink?(@targetfile) && !File.exist?(@targetfile), 'contradictory script instructions') Modified: trunk/test/test_local_requests.rb =================================================================== --- trunk/test/test_local_requests.rb 2010-12-24 00:50:24 UTC (rev 248) +++ trunk/test/test_local_requests.rb 2011-01-07 03:32:19 UTC (rev 249) @@ -66,9 +66,7 @@ EOF end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly assert_equal(sourcecontents, get_file_contents(@targetfile), testname) @@ -118,9 +116,7 @@ EOF end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly # Our whitespace in the heredoc above gets added to the generated file, so Modified: trunk/test/test_nodegroups.rb =================================================================== --- trunk/test/test_nodegroups.rb 2010-12-24 00:50:24 UTC (rev 248) +++ trunk/test/test_nodegroups.rb 2011-01-07 03:32:19 UTC (rev 249) @@ -49,9 +49,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly assert_equal(sourcecontents, get_file_contents(@targetfile), testname) @@ -90,9 +88,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly assert_equal(sourcecontents, get_file_contents(@targetfile), testname) @@ -131,9 +127,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly assert_equal(sourcecontents, get_file_contents(@targetfile), testname) @@ -175,9 +169,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) # Verify that the file wasn't modified assert_equal(oldsourcecontents, get_file_contents(@targetfile), testname) Modified: trunk/test/test_options.rb =================================================================== --- trunk/test/test_options.rb 2010-12-24 00:50:24 UTC (rev 248) +++ trunk/test/test_options.rb 2011-01-07 03:32:19 UTC (rev 249) @@ -29,6 +29,7 @@ # Test killswitch (not really a command-line option, but seems to # fit best in this file) # + testname = 'killswitch' # Put some text into the original file so that we can make sure it is # not touched. @@ -60,9 +61,7 @@ file.write('killswitch test') end - # Run etch - #puts "Running killswitch test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) assert_equal(origcontents, get_file_contents(@targetfile), 'killswitch') end @@ -71,6 +70,7 @@ # # Test --dry-run # + testname = '--dry-run' # Put some text into the original file so that we can make sure it is # not touched. @@ -98,9 +98,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running --dry-run test" - run_etch(@server, @testroot, :extra_args => '--dry-run') + run_etch(@server, @testroot, :extra_args => '--dry-run', :testname => testname) assert_equal(origcontents, get_file_contents(@targetfile), '--dry-run') end @@ -231,9 +229,7 @@ end end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot, :extra_args => "#{@targetfile} #{targetfile2} etchtest1 etchtest2") + run_etch(@server, @testroot, :extra_args => "#{@targetfile} #{targetfile2} etchtest1 etchtest2", :testname => testname) # Verify that only the requested files were created assert_equal(sourcecontents, get_file_contents(@targetfile), testname + ' file 1') @@ -318,9 +314,7 @@ end end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot, :extra_args => "#{@targetfile} #{targetfile2}") + run_etch(@server, @testroot, :extra_args => "#{@targetfile} #{targetfile2}", :testname => testname) # Verify that all were created assert_equal(sourcecontents, get_file_contents(@targetfile), testname + ' filesonly file 1') @@ -412,9 +406,7 @@ end end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot, :extra_args => "etchtest1 #{targetfile2}") + run_etch(@server, @testroot, :extra_args => "etchtest1 #{targetfile2}", :testname => testname) # Verify that all were created assert_equal(origcontents + testname, get_file_contents(cmdtargetfile1), testname + ' cmdandfile cmd 1') @@ -473,7 +465,7 @@ sleep(5) # Test that we don't follow redirects by default - run_etch(@server, @testroot, :errors_expected => true, :extra_args => '', :port => redirect_port) + run_etch(@server, @testroot, :errors_expected => true, :extra_args => '', :port => redirect_port, :testname => testname) assert_equal(origcontents, get_file_contents(@targetfile), testname) # Check that we do follow redirects with the appropriate option @@ -497,7 +489,7 @@ response.set_redirect( WEBrick::HTTPStatus::Found, "http://localhost:#{redirect_port}/") end - run_etch(@server, @testroot, :errors_expected => true, :port => redirect_port) + run_etch(@server, @testroot, :errors_expected => true, :port => redirect_port, :testname => testname) server.shutdown t.kill Modified: trunk/test/test_outputcapture.rb =================================================================== --- trunk/test/test_outputcapture.rb 2010-12-24 00:50:24 UTC (rev 248) +++ trunk/test/test_outputcapture.rb 2011-01-07 03:32:19 UTC (rev 249) @@ -64,9 +64,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running '#{testname}' test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Fetch the latest result for this client from the server and verify that # it contains the output from the post command. @@ -116,13 +114,10 @@ begin Timeout.timeout(Etch::Client::OUTPUT_CAPTURE_TIMEOUT + 15) do - # Run etch - #puts "Running '#{testname}' test" - # # NOTE: This test is not normally run because the timeout is so long. # Uncomment this run_etch line to run this test. # - #run_etch(@server, @testroot) + #run_etch(@server, @testroot, :testname => testname) end rescue Timeout::Error flunk('output capturing did not time out as expected') Modified: trunk/test/test_scripts.rb =================================================================== --- trunk/test/test_scripts.rb 2010-12-24 00:50:24 UTC (rev 248) +++ trunk/test/test_scripts.rb 2011-01-07 03:32:19 UTC (rev 249) @@ -36,6 +36,7 @@ # # Start with a test of a script with a syntax error # + testname = 'script with syntax error' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -58,9 +59,7 @@ before_size = File.stat(@targetfile).size before_ctime = File.stat(@targetfile).ctime - # Run etch - #puts "Running script with syntax error test" - run_etch(@server, @testroot, :errors_expected => true) + run_etch(@server, @testroot, :errors_expected => true, :testname => testname) # Verify that etch didn't do anything to the file assert_equal(before_size, File.stat(@targetfile).size, 'script with syntax error size comparison') @@ -69,6 +68,7 @@ # # Run a test where the script doesn't output anything # + testname = 'script with no output' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -91,9 +91,7 @@ before_size = File.stat(@targetfile).size before_ctime = File.stat(@targetfile).ctime - # Run etch - #puts "Running script with no output" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that etch didn't do anything to the file assert_equal(before_size, File.stat(@targetfile).size, 'script with no output size comparison') @@ -102,6 +100,7 @@ # # Run a test using a script to generate the contents of a file # + testname = 'script to generate the contents of a file' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -121,9 +120,7 @@ file.puts("@contents << '#{sourcecontents}'") end - # Run etch - #puts "Running file script test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly correctcontents = '' @@ -138,6 +135,7 @@ # # Run a test where the script reads the contents from another file # + testname = 'script reads the contents from another file' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -162,9 +160,7 @@ file.puts("@contents << IO.read('source')") end - # Run etch - #puts "Running file source script test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly correctcontents = '' @@ -179,6 +175,7 @@ # # Run a test where the script appends to the original file # + testname = 'script appends to the original file' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -202,9 +199,7 @@ file.puts("@contents << IO.read('source')") end - # Run etch - #puts "Running file source script test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly correctcontents = '' @@ -220,6 +215,7 @@ # # Run a test of using a script to generate a link # + testname = 'script to generate a link' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -238,9 +234,7 @@ file.puts("@contents << '#{@destfile}'") end - # Run etch - #puts "Running link script test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the link was created properly assert_equal(@destfile, File.readlink(@targetfile), 'link script') @@ -249,6 +243,7 @@ # Run a test where the script doesn't output anything in link # context # + testname = 'link script with no output' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -269,9 +264,7 @@ before_readlink = File.readlink(@targetfile) before_ctime = File.stat(@targetfile).ctime - # Run etch - #puts "Running link script with no output" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that etch didn't do anything to the file assert_equal(before_readlink, File.readlink(@targetfile), 'link script with no output readlink comparison') @@ -280,6 +273,7 @@ # # Run a test of using a script to generate a directory # + testname = 'script to generate a directory' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -296,9 +290,7 @@ file.puts("@contents << 'true'") end - # Run etch - #puts "Running directory script test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the directory was created assert(File.directory?(@targetfile), 'directory script') @@ -307,6 +299,7 @@ # Run a test where the script doesn't output anything in directory # context # + testname = 'directory script with no output' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -331,9 +324,7 @@ before_size = File.stat(@targetfile).size before_ctime = File.stat(@targetfile).ctime - # Run etch - #puts "Running directory script with no output" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that etch didn't do anything to the file assert_equal(before_size, File.stat(@targetfile).size, 'directory script with no output size comparison') @@ -342,6 +333,7 @@ # # Run a test of using a script to delete # + testname = 'script to delete' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -359,9 +351,7 @@ file.puts("@contents << 'true'") end - # Run etch - #puts "Running delete script test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was removed assert(!File.exist?(@targetfile) && !File.symlink?(@targetfile), 'delete script') @@ -370,6 +360,7 @@ # Run a test where the script doesn't output anything in delete # context # + testname = 'delete script with no output' # Recreate the target file origcontents = "This is the original text\n" @@ -396,9 +387,7 @@ before_size = File.stat(@targetfile).size before_ctime = File.stat(@targetfile).ctime - # Run etch - #puts "Running delete script with no output" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that etch didn't do anything to the file assert_equal(before_size, File.stat(@targetfile).size, 'delete script with no output size comparison') Modified: trunk/test/test_transitions.rb =================================================================== --- trunk/test/test_transitions.rb 2010-12-24 00:50:24 UTC (rev 248) +++ trunk/test/test_transitions.rb 2011-01-07 03:32:19 UTC (rev 249) @@ -44,6 +44,7 @@ # # File to link transition # + testname = 'file to link transition' FileUtils.mkdir_p("#{@repodir}/source/#{@targetfile}") File.open("#{@repodir}/source/#{@targetfile}/config.xml", 'w') do |file| @@ -56,15 +57,14 @@ EOF end - # Run etch - #puts "Running file to link test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert_equal(@destfile, File.readlink(@targetfile), 'file to link') # # File to directory transition # + testname = 'file to directory transition' # Reset target FileUtils.rm_rf(@targetfile) @@ -81,9 +81,7 @@ EOF end - # Run etch - #puts "Running file to directory test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) assert(File.directory?(@targetfile), 'file to directory') end @@ -92,6 +90,7 @@ # # Link to file transition # + testname = 'link to file transition' # Reset target FileUtils.rm_rf(@targetfile) @@ -116,9 +115,7 @@ file.write(sourcecontents) end - # Run etch - #puts "Running link to file test" - run_etch(@server, @testroot) + run_etch(@server, @testroot, :testname => testname) # Verify that the file was created properly assert_equal(sourcecontents, get_file_contents(@targetfile), 'link to file') @@ -128,6 +125,7 @@ # identical contents to the file contents we should be writing out # (to test that the comparison method doesn't follow symlinks) # + 'link w/ same contents to file transition' # Reset target FileUtils.rm_rf(@targetfile) @@ -... [truncated message content] |