From 78b368082d129424b02387a89f848320e4a466bf Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Tue, 31 Jan 2017 09:49:12 +0000 Subject: Adds a makefile target to run tests --- test/tc_byteback_snapshot.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/tc_byteback_snapshot.rb b/test/tc_byteback_snapshot.rb index 87b6409..6101371 100644 --- a/test/tc_byteback_snapshot.rb +++ b/test/tc_byteback_snapshot.rb @@ -58,7 +58,7 @@ class SnapshotTest < Test::Unit::TestCase if biggest_offset.nil? or offsets.max > biggest_offset biggest_offset = offsets.max else - puts "Oldest backup with space for #{limit} backups is #{offsets.max} days: #{offsets.join(", ")}" + puts "Oldest backup with space for #{limit} backups is #{offsets.max} days: #{offsets.join(", ")}" if $VERBOSE break end @@ -70,7 +70,7 @@ class SnapshotTest < Test::Unit::TestCase end # - # This run the same test as above, execpt with 3 hosts all competeing for space + # This run the same test as above, execpt with 3 hosts all competing for space # def test_sort_by_importance_with_multiple_hosts start = Time.now @@ -106,7 +106,7 @@ class SnapshotTest < Test::Unit::TestCase if biggest_offset.nil? or offsets.max > biggest_offset biggest_offset = offsets.max else - puts "Oldest backup with space for #{limit} backups and 3 hosts is #{offsets.max} days: #{offsets.join(", ")}" + puts "Oldest backup with space for #{limit} backups and 3 hosts is #{offsets.max} days: #{offsets.join(", ")}" if $VERBOSE break end @@ -154,7 +154,7 @@ class SnapshotTest < Test::Unit::TestCase day += 1 now += 86400 end - puts "Oldest backup with space for #{limit} backups is #{offsets.max} days: #{offsets.join(", ")}" + puts "Oldest backup with space for #{limit} backups is #{offsets.max} days: #{offsets.join(", ")}" if $VERBOSE end end -- cgit v1.2.1 From efb246e6cafa42c33dd20ad6b17dd8be582e8f27 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Tue, 31 Jan 2017 10:09:32 +0000 Subject: Add a test suite to actually run all the tests --- test/ts_byteback.rb | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 test/ts_byteback.rb (limited to 'test') diff --git a/test/ts_byteback.rb b/test/ts_byteback.rb new file mode 100644 index 0000000..63226a2 --- /dev/null +++ b/test/ts_byteback.rb @@ -0,0 +1,6 @@ + +$: << "." + +require 'tc_restore.rb' +require 'tc_restore_file.rb' +require 'tc_byteback_snapshot.rb' -- cgit v1.2.1 From fef18de531737c8bb819794b9db8c6630a85a5a9 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Tue, 31 Jan 2017 10:13:59 +0000 Subject: Tidy up requires in tests, fix Tempfile filename stem --- test/tc_byteback_snapshot.rb | 2 -- test/tc_restore.rb | 2 -- test/tc_restore_file.rb | 5 +---- test/ts_byteback.rb | 3 ++- 4 files changed, 3 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/tc_byteback_snapshot.rb b/test/tc_byteback_snapshot.rb index 6101371..71f8c39 100644 --- a/test/tc_byteback_snapshot.rb +++ b/test/tc_byteback_snapshot.rb @@ -1,5 +1,3 @@ -$: << File.dirname(__FILE__)+"/../lib" - require 'test/unit' require 'byteback/backup_directory' require 'time' diff --git a/test/tc_restore.rb b/test/tc_restore.rb index 426c2b1..364c7f1 100644 --- a/test/tc_restore.rb +++ b/test/tc_restore.rb @@ -1,5 +1,3 @@ -$: << File.dirname(__FILE__)+"/../lib" - require 'test/unit' require 'byteback/restore' require 'tmpdir' diff --git a/test/tc_restore_file.rb b/test/tc_restore_file.rb index e9544f9..8284275 100644 --- a/test/tc_restore_file.rb +++ b/test/tc_restore_file.rb @@ -1,5 +1,3 @@ -$: << File.dirname(__FILE__)+"/../lib" - require 'test/unit' require 'byteback/restore_file' require 'tempfile' @@ -20,8 +18,7 @@ class BytebackFileTest < Test::Unit::TestCase end def test_general - f = Tempfile.new($0, @snapshot_path) - puts f.path + f = Tempfile.new("restore-file-", @snapshot_path) system("setfattr --name user.rsync.%stat -v \"41755 12,34 56:78\" #{f.path}") b = Byteback::RestoreFile.new(f.path, @byteback_root) assert_equal(041755, b.mode) diff --git a/test/ts_byteback.rb b/test/ts_byteback.rb index 63226a2..ccee796 100644 --- a/test/ts_byteback.rb +++ b/test/ts_byteback.rb @@ -1,5 +1,6 @@ -$: << "." +$: << File.dirname(__FILE__) +$: << File.dirname(__FILE__)+"/../lib" require 'tc_restore.rb' require 'tc_restore_file.rb' -- cgit v1.2.1