From 9fad773bfb4ae3f0e4bf93e030cf3eec1b059ecf Mon Sep 17 00:00:00 2001 From: Edwin Eefting Date: Sat, 6 Feb 2021 20:44:27 +0100 Subject: [PATCH] test manydatasets --- test_scaling.py | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/test_scaling.py b/test_scaling.py index 7a33c69..8f6df37 100644 --- a/test_scaling.py +++ b/test_scaling.py @@ -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)