central timehandling and better mocking during test
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
from basetest import *
|
||||
import time
|
||||
|
||||
class TestZfsAutobackup32(unittest2.TestCase):
|
||||
"""various new 3.2 features"""
|
||||
@ -137,18 +136,39 @@ test_target1/test_source2/fs2/sub@test-20101111000001
|
||||
""")
|
||||
|
||||
|
||||
# def test_stuff(self):
|
||||
#
|
||||
#
|
||||
# shelltest("zfs set autobackup:test=true test_source2")
|
||||
# # shelltest("zfs set readonly=on test_target1")
|
||||
#
|
||||
# with patch('time.strftime', return_value="test-20101111000000"):
|
||||
# self.assertFalse(ZfsAutobackup("test test_target1 --no-progress --verbose --allow-empty --clear-mountpoint".split(" ")).run())
|
||||
#
|
||||
# # shelltest("zfs mount test_target1/test_source2/fs2/sub" )
|
||||
#
|
||||
# with patch('time.strftime', return_value="test-20101111000001"):
|
||||
# self.assertFalse(ZfsAutobackup("test test_target1 --no-progress --verbose --allow-empty --rollback".split(" ")).run())
|
||||
|
||||
|
||||
#XXX: VERBERTERING VAN ADD VIRTUALSNAPSHOTS IN GIT STASH!
|
||||
def test_thinning(self):
|
||||
|
||||
# time_str = "20111112000000" # month in the "future"
|
||||
# future_timestamp = time_secs = time.mktime(time.strptime(time_str, "%Y%m%d%H%M%S"))
|
||||
# with patch('time.time', return_value=future_timestamp):
|
||||
|
||||
with mocktime("20001001000000"):
|
||||
print(datetime_now(False))
|
||||
self.assertFalse(ZfsAutobackup("test --allow-empty --clear-mountpoint --verbose".split(" ")).run())
|
||||
|
||||
# with patch('time.strftime', return_value="test-20001101000000"):
|
||||
# self.assertFalse(ZfsAutobackup("test --allow-empty --clear-mountpoint test_target1 --no-progress --allow-empty --clear-mountpoint".split(" ")).run())
|
||||
#
|
||||
# with patch('time.strftime', return_value="test-20001201000000"):
|
||||
# self.assertFalse(ZfsAutobackup("test --allow-empty --clear-mountpoint".split(" ")).run())
|
||||
#
|
||||
# with patch('time.strftime', return_value="test-20001202000000"):
|
||||
# self.assertFalse(ZfsAutobackup("test --allow-empty --clear-mountpoint".split(" ")).run())
|
||||
#
|
||||
# time_str="test-20001203000000"
|
||||
# with patch('time.time', return_value=time.mktime(time.strptime(time_str, "test-%Y%m%d%H%M%S"))):
|
||||
# with patch('time.strftime', return_value=time_str):
|
||||
# self.assertFalse(ZfsAutobackup("test test_target1 --no-progress --allow-empty --clear-mountpoint --keep-source=1d2d".split(" ")).run())
|
||||
#
|
||||
#
|
||||
#
|
||||
# r=shelltest("zfs list -H -o name -r -t snapshot test_source1 test_target1")
|
||||
# self.assertMultiLineEqual(r,"""
|
||||
# /test_target1
|
||||
# /test_target1/test_source1/fs1
|
||||
# /test_target1/test_source1/fs1/sub
|
||||
# /test_target1/test_source2/fs2/sub
|
||||
# """)
|
||||
|
||||
Reference in New Issue
Block a user