forked from third-party-mirrors/zfs_autobackup
allow regression to run from pycharm by using sudo with passwd file. you also need to suid root zfs and zpool
This commit is contained in:
parent
db6523f3c0
commit
a920744b1e
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@ __pycache__
|
|||||||
python2.env
|
python2.env
|
||||||
venv
|
venv
|
||||||
.idea
|
.idea
|
||||||
|
password.sh
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
colorama
|
colorama
|
||||||
argparse
|
argparse
|
||||||
coverage==4.5.4
|
coverage
|
||||||
python-coveralls
|
python-coveralls
|
||||||
unittest2
|
unittest2
|
||||||
mock
|
mock
|
||||||
|
@ -58,7 +58,8 @@ def redirect_stderr(target):
|
|||||||
|
|
||||||
def shelltest(cmd):
|
def shelltest(cmd):
|
||||||
"""execute and print result as nice copypastable string for unit tests (adds extra newlines on top/bottom)"""
|
"""execute and print result as nice copypastable string for unit tests (adds extra newlines on top/bottom)"""
|
||||||
ret=(subprocess.check_output(cmd , shell=True).decode('utf-8'))
|
|
||||||
|
ret=(subprocess.check_output("SUDO_ASKPASS=./password.sh sudo -A "+cmd , shell=True).decode('utf-8'))
|
||||||
print("######### result of: {}".format(cmd))
|
print("######### result of: {}".format(cmd))
|
||||||
print(ret)
|
print(ret)
|
||||||
print("#########")
|
print("#########")
|
||||||
|
@ -2,7 +2,6 @@ from basetest import *
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TestZfsAutobackup(unittest2.TestCase):
|
class TestZfsAutobackup(unittest2.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -696,8 +695,8 @@ test_target1
|
|||||||
|
|
||||||
|
|
||||||
#test incremental
|
#test incremental
|
||||||
with patch('time.strftime', return_value="20101111000000"):
|
with patch('time.strftime', return_value="20101111000002"):
|
||||||
self.assertFalse(ZfsAutobackup("test test_target1 --no-progress --verbose --test".split(" ")).run())
|
self.assertFalse(ZfsAutobackup("test test_target1 --no-progress --allow-empty --verbose --test".split(" ")).run())
|
||||||
|
|
||||||
r=shelltest("zfs list -H -o name -r -t all "+TEST_POOLS)
|
r=shelltest("zfs list -H -o name -r -t all "+TEST_POOLS)
|
||||||
self.assertMultiLineEqual(r,"""
|
self.assertMultiLineEqual(r,"""
|
||||||
|
@ -42,7 +42,6 @@ class ThinnerRule:
|
|||||||
if '' in matches:
|
if '' in matches:
|
||||||
raise (Exception("Invalid schedule string: '{}'".format(rule_str)))
|
raise (Exception("Invalid schedule string: '{}'".format(rule_str)))
|
||||||
|
|
||||||
print(matches)
|
|
||||||
period_amount = int(matches[0])
|
period_amount = int(matches[0])
|
||||||
period_unit = matches[1]
|
period_unit = matches[1]
|
||||||
ttl_amount = int(matches[2])
|
ttl_amount = int(matches[2])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user