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:
Edwin Eefting committed 2021-04-15 13:56:24 +02:00
1 parent db6523f3c0
commit a920744b1e
5 files changed
+6 -6

No files matched your search

+1
View File
@@ -11,3 +11,4 @@ __pycache__
python2.env
venv
.idea
password.sh
+1 -1
View File
@@ -1,6 +1,6 @@
colorama
argparse
coverage==4.5.4
coverage
python-coveralls
unittest2
mock
+2 -1
View File
@@ -58,7 +58,8 @@ def redirect_stderr(target):
def shelltest(cmd):
"""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(ret)
print("#########")
+2 -3
View File
@@ -2,7 +2,6 @@ from basetest import *
import time
class TestZfsAutobackup(unittest2.TestCase):
def setUp(self):
@@ -696,8 +695,8 @@ test_target1
#test incremental
with patch('time.strftime', return_value="20101111000000"):
self.assertFalse(ZfsAutobackup("test test_target1 --no-progress --verbose --test".split(" ")).run())
with patch('time.strftime', return_value="20101111000002"):
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)
self.assertMultiLineEqual(r,"""
-1
View File
@@ -42,7 +42,6 @@ class ThinnerRule:
if '' in matches:
raise (Exception("Invalid schedule string: '{}'".format(rule_str)))
print(matches)
period_amount = int(matches[0])
period_unit = matches[1]
ttl_amount = int(matches[2])