mirror of
https://github.com/psy0rz/zfs_autobackup.git
synced 2025-06-09 01:52:07 +03:00
coverage
This commit is contained in:
parent
e47d461999
commit
f52b8bbf58
@ -36,6 +36,9 @@ class TestThinner(unittest2.TestCase):
|
|||||||
with self.assertRaisesRegexp(Exception, "^Invalid schedule"):
|
with self.assertRaisesRegexp(Exception, "^Invalid schedule"):
|
||||||
ThinnerRule("XXX")
|
ThinnerRule("XXX")
|
||||||
|
|
||||||
|
with self.assertRaisesRegexp(Exception, "^Number of"):
|
||||||
|
Thinner("-1")
|
||||||
|
|
||||||
|
|
||||||
def test_incremental(self):
|
def test_incremental(self):
|
||||||
ok=['2023-01-03 10:53:16',
|
ok=['2023-01-03 10:53:16',
|
||||||
|
@ -19,7 +19,7 @@ class Thinner:
|
|||||||
|
|
||||||
rule_strs = schedule_str.split(",")
|
rule_strs = schedule_str.split(",")
|
||||||
for rule_str in rule_strs:
|
for rule_str in rule_strs:
|
||||||
if rule_str.isdigit():
|
if rule_str.lstrip('-').isdigit():
|
||||||
self.always_keep = int(rule_str)
|
self.always_keep = int(rule_str)
|
||||||
if self.always_keep < 0:
|
if self.always_keep < 0:
|
||||||
raise (Exception("Number of snapshots to keep cant be negative: {}".format(self.always_keep)))
|
raise (Exception("Number of snapshots to keep cant be negative: {}".format(self.always_keep)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user