test manydatasets

This commit is contained in:
Edwin Eefting 2021-02-06 20:44:27 +01:00
parent 7493a0bc55
commit 9fad773bfb

@ -16,12 +16,12 @@ class TestZfsScaling(unittest2.TestCase):
prepare_zpools()
self.longMessage = True
def test_manysnaps(self):
def test_manysnapshots(self):
"""count the number of commands when there are many snapshots."""
snapshot_count=100
# create bunch of snapshots
print("Creating many snapshots...")
s=""
for i in range(1970,1970+snapshot_count):
s=s+"zfs snapshot test_source1/fs1@test-{:04}1111000000;".format(i)
@ -50,8 +50,46 @@ class TestZfsScaling(unittest2.TestCase):
self.assertFalse(ZfsAutobackup("test test_target1 --verbose --keep-source=10000 --keep-target=10000 --no-holds --allow-empty".split(" ")).run())
#this triggers if you make a change with an impact of more than O(snapshot_count/2)
#this triggers if you make a change with a performance impact of more than O(snapshot_count/2)
expected_runs=47
print("ACTUAL RUNS: {}".format(run_counter))
self.assertLess(abs(run_counter-expected_runs), snapshot_count/2)
def test_manydatasets(self):
"""count the number of commands when when there are many datasets"""
dataset_count=100
print("Creating many datasets...")
s=""
for i in range(0,dataset_count):
s=s+"zfs create test_source1/fs1/{};".format(i)
shelltest(s)
global run_counter
run_counter=0
with patch.object(ExecuteNode,'run', run_count) as p:
with patch('time.strftime', return_value="20101112000000"):
self.assertFalse(ZfsAutobackup("test test_target1 --verbose --no-holds --allow-empty".split(" ")).run())
#this triggers if you make a change with an impact of more than O(snapshot_count/2)
expected_runs=743
print("ACTUAL RUNS: {}".format(run_counter))
self.assertLess(abs(run_counter-expected_runs), dataset_count/2)
run_counter=0
with patch.object(ExecuteNode,'run', run_count) as p:
with patch('time.strftime', return_value="20101112000001"):
self.assertFalse(ZfsAutobackup("test test_target1 --verbose --no-holds --allow-empty".split(" ")).run())
#this triggers if you make a change with a performance impact of more than O(snapshot_count/2)
expected_runs=947
print("ACTUAL RUNS: {}".format(run_counter))
self.assertLess(abs(run_counter-expected_runs), dataset_count/2)