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 --- Makefile | 5 ++++- test/tc_byteback_snapshot.rb | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6a0cb38..5ea5645 100644 --- a/Makefile +++ b/Makefile @@ -10,8 +10,11 @@ docs: man/byteback-prune.man man/byteback-restore.man man/byteback-backup.man # To be written # man/byteback-snapshot.man man/byteback-setup-client.man man/byteback-setup-client-receive.man man/byteback-receive.man +test: + ruby test/tc_*.rb + clean: $(RM) man/*.man -.PHONY: clean docs all +.PHONY: clean docs all 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 ad133fbe3c9e5398224616f522afff0eb5152332 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Tue, 31 Jan 2017 09:50:56 +0000 Subject: Added gitlab-ci --- .gitlab-ci.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..12fbd96 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,32 @@ +stages: + - test + - package + - publish + +test: &test + stage: test + image: $CI_REGISTRY/docker-images/layers:jessie-ruby + script: + - make test + +package: &package + image: $CI_REGISTRY/docker-images/layers:$DISTRO-deb + variables: + DISTRO: jessie + stage: package + script: + - package + artifacts: + paths: + - pkg/ + +publish: + stage: publish + variables: + RSYNC_HOSTNAME: repo.bytemark.co.uk + tags: + - shell + script: + - publish + + -- cgit v1.2.1 From 7f996b6d9c11910520cadc0e8f1c43a89c7c1425 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Tue, 31 Jan 2017 09:53:42 +0000 Subject: Added ruby, ruby-ffi as build-dep --- debian/control | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 8623f60..594b385 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: ruby Priority: optional Maintainer: Patrick J Cherry Uploaders: Steve Kemp -Build-Depends: debhelper (>= 7.0.50~), txt2man +Build-Depends: debhelper (>= 7.0.50~), txt2man, ruby | ruby-interpreter, ruby-ffi Standards-Version: 3.9.6 # Vcs-Git: Vcs-Browser: https://github.com/BytemarkHosting/byteback.git @@ -12,6 +12,7 @@ Homepage: https://github.com/BytemarkHosting/byteback Package: byteback Architecture: all Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter, rsync, openssh-client, ruby-ffi | libffi-ruby +Recommends: btrfs-progs Description: Maintenance-free client & server backup scripts for Linux byteback encapsulates Bytemark's "best practice" for maintenance-free backups with easy client and server setup. -- 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 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 e840018421c47545526e13adb4c7eee3e503c417 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Tue, 31 Jan 2017 10:10:05 +0000 Subject: Run the test *suite* from the makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5ea5645..4fe136d 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ docs: man/byteback-prune.man man/byteback-restore.man man/byteback-backup.man # man/byteback-snapshot.man man/byteback-setup-client.man man/byteback-setup-client-receive.man man/byteback-receive.man test: - ruby test/tc_*.rb + ruby test/ts_byteback.rb clean: $(RM) man/*.man -- 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(-) 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 From 53f78a01f2fb514d61fdb076f5b749e03ffddb74 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Tue, 31 Jan 2017 10:18:46 +0000 Subject: Add in test-deps of ruby-ffi,attr, and build dep of attr --- .gitlab-ci.yml | 1 + debian/control | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 12fbd96..b152e89 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,7 @@ test: &test stage: test image: $CI_REGISTRY/docker-images/layers:jessie-ruby script: + - apt-get install attr ruby-ffi - make test package: &package diff --git a/debian/control b/debian/control index 594b385..238203c 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: ruby Priority: optional Maintainer: Patrick J Cherry Uploaders: Steve Kemp -Build-Depends: debhelper (>= 7.0.50~), txt2man, ruby | ruby-interpreter, ruby-ffi +Build-Depends: debhelper (>= 7.0.50~), txt2man, ruby | ruby-interpreter, ruby-ffi, attr Standards-Version: 3.9.6 # Vcs-Git: Vcs-Browser: https://github.com/BytemarkHosting/byteback.git -- cgit v1.2.1