probetests: make negative assertion more meaningful
In test_replication_servers_working, we delete a bunch of directories without deleting hashes.pkl, then verify that nothing at that level is a directory. This would be trivially true except that throughout the test, we have the replicators running constantly. However, we never verified that the replicators actually *have* run and had a chance to re-create the missing directories. Now, stop the replicators before doing the deletes, run them synchronously between doing the deletes and verifying that there are no directories, and start them again before the final set of assertions. Change-Id: I841f8250eb7abfb0fcdfca5c106f65e6e94dce0c
This commit is contained in:
parent
0c316a134f
commit
61c9aa4bf3
@ -150,9 +150,10 @@ class TestReplicatorFunctions(ReplProbeTest):
|
||||
raise
|
||||
time.sleep(1)
|
||||
|
||||
self.replicators.stop()
|
||||
|
||||
# Delete directories and files in objects storage without
|
||||
# deleting file "hashes.pkl".
|
||||
# Check, that files not replicated.
|
||||
for directory in os.listdir(os.path.join(test_node, data_dir)):
|
||||
for input_dir in os.listdir(os.path.join(
|
||||
test_node, data_dir, directory)):
|
||||
@ -161,23 +162,17 @@ class TestReplicatorFunctions(ReplProbeTest):
|
||||
shutil.rmtree(os.path.join(
|
||||
test_node, data_dir, directory, input_dir))
|
||||
|
||||
# We will keep trying these tests until they pass for up to 60s
|
||||
begin = time.time()
|
||||
while True:
|
||||
try:
|
||||
for directory in os.listdir(os.path.join(
|
||||
test_node, data_dir)):
|
||||
for input_dir in os.listdir(os.path.join(
|
||||
test_node, data_dir, directory)):
|
||||
self.assertFalse(os.path.isdir(
|
||||
os.path.join(test_node, data_dir,
|
||||
directory, input_dir)))
|
||||
break
|
||||
except Exception:
|
||||
if time.time() - begin > 60:
|
||||
raise
|
||||
time.sleep(1)
|
||||
self.replicators.once()
|
||||
# Check, that files not replicated.
|
||||
for directory in os.listdir(os.path.join(
|
||||
test_node, data_dir)):
|
||||
for input_dir in os.listdir(os.path.join(
|
||||
test_node, data_dir, directory)):
|
||||
self.assertFalse(os.path.isdir(
|
||||
os.path.join(test_node, data_dir,
|
||||
directory, input_dir)))
|
||||
|
||||
self.replicators.start()
|
||||
# Now, delete file "hashes.pkl".
|
||||
# Check, that all files were replicated.
|
||||
for directory in os.listdir(os.path.join(test_node, data_dir)):
|
||||
|
Loading…
x
Reference in New Issue
Block a user