Skip to content

Commit

Permalink
updated test suites to wait on delete opeartions
Browse files Browse the repository at this point in the history
  • Loading branch information
cannatag committed Jan 16, 2017
1 parent a3782c5 commit be943c6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def drop_connection(connection, dn_to_delete=None):
elif result['description'] == 'busy':
counter -= 1
if counter >= 0:
sleep(4) # wait and retry
sleep(3) # wait and retry
else:
print('unable to delete object ' + dn[0] + ': ' + str(result))
done = True
Expand Down
6 changes: 3 additions & 3 deletions test/testAbstractionWrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def test_create_new_entry_valid_and_move_after_commit(self):
n.entry_commit_changes()
self.assertEqual(n.sn, 'sn-test-7')
self.assertEqual(n.entry_status, STATUS_COMMITTED)
sleep(5)
sleep(3)
n.entry_move(test_moved)
self.assertEqual(n.entry_status, STATUS_READY_FOR_MOVING)
n.entry_commit_changes()
Expand All @@ -146,13 +146,13 @@ def test_create_new_entry_valid_and_move_after_commit(self):
counter = 20
while counter > 0:
try:
counter -= 1
sleep(3)
n.entry_commit_changes()
if n.entry_status == STATUS_DELETED:
break
except LDAPCursorError:
pass
counter -= 1
sleep(3)
self.assertEqual(n.entry_status, STATUS_DELETED)


Expand Down
2 changes: 1 addition & 1 deletion test/testModifyDNOperation.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ def test_move_dn(self):
counter = 20
result = None
while counter > 0: # tries move operation for at maximum 20 times - partition may be busy while moving (at least on eDirectory)
sleep(3)
result = self.connection.modify_dn(self.delete_at_teardown[0][0], test_name_attr + '=' + testcase_id + 'modify-dn-2', new_superior=test_moved)
if not self.connection.strategy.sync:
_, result = self.connection.get_response(result)
else:
result = self.connection.result
if result['description'] == 'success':
break
sleep(3)
counter -= 1

self.assertEqual('success', result['description'])
Expand Down
21 changes: 14 additions & 7 deletions test/testSearchAndModifyEntries.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,20 @@ def test_search_and_delete_entry(self):
result = writable_entry.entry_commit_changes()
self.assertEqual(writable_entry.entry_status, STATUS_DELETED)
self.assertTrue(result)
result = self.connection.search(search_base=test_base, search_filter='(' + test_name_attr + '=' + testcase_id + 'search-and-delete)', attributes=[test_name_attr, 'givenName'])
if not self.connection.strategy.sync:
response, result = self.connection.get_response(result)
entries = self.connection._get_entries(response)
else:
result = self.connection.result
entries = self.connection.entries
counter = 20
while counter > 0: # waits for at maximum 20 times - delete operation can take some time to complete
result = self.connection.search(search_base=test_base, search_filter='(' + test_name_attr + '=' + testcase_id + 'search-and-delete)', attributes=[test_name_attr, 'givenName'])
if not self.connection.strategy.sync:
response, result = self.connection.get_response(result)
entries = self.connection._get_entries(response)
else:
result = self.connection.result
entries = self.connection.entries
if len(entries) == 0:
break
sleep(3)
counter -= 1

self.assertEqual(result['description'], 'success')
self.assertEqual(len(entries), 0)
self.compare_entries(read_only_entry, writable_entry)
Expand Down

0 comments on commit be943c6

Please sign in to comment.