mirror of
https://github.com/psy0rz/zfs_autobackup.git
synced 2025-06-05 01:33:00 +03:00
regression tests for all compressors
This commit is contained in:
parent
664ea32c96
commit
b70c9986c7
6
.github/workflows/regression.yml
vendored
6
.github/workflows/regression.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
|||||||
|
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: sudo apt update && sudo apt install zfsutils-linux && sudo -H pip3 install coverage unittest2 mock==3.0.5 coveralls
|
run: sudo apt update && sudo apt install zfsutils-linux lzop pigz zstd gzip xz-utils && sudo -H pip3 install coverage unittest2 mock==3.0.5 coveralls
|
||||||
|
|
||||||
|
|
||||||
- name: Regression test
|
- name: Regression test
|
||||||
@ -39,7 +39,7 @@ jobs:
|
|||||||
|
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: sudo apt update && sudo apt install zfsutils-linux python3-setuptools && sudo -H pip3 install coverage unittest2 mock==3.0.5 coveralls
|
run: sudo apt update && sudo apt install zfsutils-linux python3-setuptools lzop pigz zstd gzip xz-utils && sudo -H pip3 install coverage unittest2 mock==3.0.5 coveralls
|
||||||
|
|
||||||
|
|
||||||
- name: Regression test
|
- name: Regression test
|
||||||
@ -64,7 +64,7 @@ jobs:
|
|||||||
python-version: '2.x'
|
python-version: '2.x'
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: sudo apt update && sudo apt install zfsutils-linux python-setuptools && sudo -H pip install coverage unittest2 mock==3.0.5 coveralls colorama
|
run: sudo apt update && sudo apt install zfsutils-linux python-setuptools lzop pigz zstd gzip xz-utils && sudo -H pip install coverage unittest2 mock==3.0.5 coveralls colorama
|
||||||
|
|
||||||
- name: Regression test
|
- name: Regression test
|
||||||
run: sudo -E ./tests/run_tests
|
run: sudo -E ./tests/run_tests
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import zfs_autobackup.compressors
|
||||||
from basetest import *
|
from basetest import *
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@ -13,14 +14,36 @@ class TestSendRecvPipes(unittest2.TestCase):
|
|||||||
def test_send_basics(self):
|
def test_send_basics(self):
|
||||||
"""send basics (remote/local send pipe)"""
|
"""send basics (remote/local send pipe)"""
|
||||||
|
|
||||||
|
|
||||||
|
with self.subTest("local local pipe"):
|
||||||
with patch('time.strftime', return_value="20101111000000"):
|
with patch('time.strftime', return_value="20101111000000"):
|
||||||
self.assertFalse(ZfsAutobackup(["test", "test_target1", "--no-progress", "--send-pipe=dd bs=1M", "--recv-pipe=dd bs=2M"]).run())
|
self.assertFalse(ZfsAutobackup(["test", "test_target1", "--exclude-received", "--no-holds", "--no-progress", "--send-pipe=dd bs=1M", "--recv-pipe=dd bs=2M"]).run())
|
||||||
|
|
||||||
with patch('time.strftime', return_value="20101111000001"):
|
shelltest("zfs destroy -r test_target1/test_source1/fs1/sub")
|
||||||
self.assertFalse(ZfsAutobackup(["test", "test_target1", "--no-progress", "--ssh-source=localhost", "--send-pipe=dd bs=1M", "--recv-pipe=dd bs=2M"]).run())
|
|
||||||
|
|
||||||
with patch('time.strftime', return_value="20101111000001"):
|
with self.subTest("remote local pipe"):
|
||||||
self.assertFalse(ZfsAutobackup(["test", "test_target1", "--no-progress", "--ssh-target=localhost", "--send-pipe=dd bs=1M", "--recv-pipe=dd bs=2M"]).run())
|
with patch('time.strftime', return_value="20101111000000"):
|
||||||
|
self.assertFalse(ZfsAutobackup(["test", "test_target1", "--exclude-received", "--no-holds", "--no-progress", "--ssh-source=localhost", "--send-pipe=dd bs=1M", "--recv-pipe=dd bs=2M"]).run())
|
||||||
|
|
||||||
with patch('time.strftime', return_value="20101111000001"):
|
shelltest("zfs destroy -r test_target1/test_source1/fs1/sub")
|
||||||
self.assertFalse(ZfsAutobackup(["test", "test_target1", "--no-progress", "--ssh-source=localhost", "--ssh-target=localhost", "--send-pipe=dd bs=1M", "--recv-pipe=dd bs=2M"]).run())
|
|
||||||
|
with self.subTest("local remote pipe"):
|
||||||
|
with patch('time.strftime', return_value="20101111000000"):
|
||||||
|
self.assertFalse(ZfsAutobackup(["test", "test_target1", "--exclude-received", "--no-holds", "--no-progress", "--ssh-target=localhost", "--send-pipe=dd bs=1M", "--recv-pipe=dd bs=2M"]).run())
|
||||||
|
|
||||||
|
shelltest("zfs destroy -r test_target1/test_source1/fs1/sub")
|
||||||
|
|
||||||
|
with self.subTest("remote remote pipe"):
|
||||||
|
with patch('time.strftime', return_value="20101111000000"):
|
||||||
|
self.assertFalse(ZfsAutobackup(["test", "test_target1", "--exclude-received", "--no-holds", "--no-progress", "--ssh-source=localhost", "--ssh-target=localhost", "--send-pipe=dd bs=1M", "--recv-pipe=dd bs=2M"]).run())
|
||||||
|
|
||||||
|
def test_compress(self):
|
||||||
|
"""send basics (remote/local send pipe)"""
|
||||||
|
|
||||||
|
for compress in zfs_autobackup.compressors.COMPRESS_CMDS.keys():
|
||||||
|
|
||||||
|
with self.subTest("compress "+compress):
|
||||||
|
with patch('time.strftime', return_value="20101111000000"):
|
||||||
|
self.assertFalse(ZfsAutobackup(["test", "test_target1", "--exclude-received", "--no-holds", "--no-progress", "--compress="+compress]).run())
|
||||||
|
|
||||||
|
shelltest("zfs destroy -r test_target1/test_source1/fs1/sub")
|
||||||
|
@ -123,7 +123,7 @@ class ZfsAutobackup:
|
|||||||
parser.add_argument('--exclude-received', action='store_true',
|
parser.add_argument('--exclude-received', action='store_true',
|
||||||
help=argparse.SUPPRESS) # probably never needed anymore
|
help=argparse.SUPPRESS) # probably never needed anymore
|
||||||
|
|
||||||
parser.add_argument('--compress', metavar='TYPE', default=None, choices=compressors.choices(), help='Use compression during transfer ({})'.format(", ".join(compressors.choices())))
|
parser.add_argument('--compress', metavar='TYPE', default=None, choices=compressors.choices(), help='Use compression during transfer, zstd-fast recommended ({})'.format(", ".join(compressors.choices())))
|
||||||
|
|
||||||
|
|
||||||
# note args is the only global variable we use, since its a global readonly setting anyway
|
# note args is the only global variable we use, since its a global readonly setting anyway
|
||||||
|
Loading…
x
Reference in New Issue
Block a user