Skip to content

Commit 2745502

Browse files
author
Frederick Ross
committed
All tests now pace with 4.3.3 and Ace.
Last index test (Index.clean()) now disables on 4.x and not on >=5, and no longer gets a restart. Modular input tests are skipped on 4.x. Added appcollection field to .splunkrc parsing in anticipation of new, single item apps for testing things not creatable with the REST API.
1 parent 9ed4065 commit 2745502

File tree

5 files changed

+50
-371
lines changed

5 files changed

+50
-371
lines changed

splunklib/client.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,28 +1548,31 @@ def attached_socket(self, *args, **kwargs):
15481548

15491549
def clean(self, timeout=60):
15501550
"""Deletes the contents of the index.
1551-
1551+
1552+
`clean` blocks until the index is empty, since it needs to restore
1553+
values at the end.
1554+
15521555
:param `timeout`: The time-out period for the operation, in seconds (the
15531556
default is 60).
15541557
"""
15551558
self.refresh()
15561559
tds = self['maxTotalDataSizeMB']
15571560
ftp = self['frozenTimePeriodInSecs']
1558-
self.update(maxTotalDataSizeMB=1, frozenTimePeriodInSecs=1)
1559-
self.roll_hot_buckets()
1560-
1561-
# Wait until the event count goes to zero
1562-
count = 0
1563-
while self.content.totalEventCount != '0' and count < timeout:
1564-
sleep(1)
1565-
count += 1
1566-
self.refresh()
1561+
try:
1562+
self.update(maxTotalDataSizeMB=1, frozenTimePeriodInSecs=1)
1563+
self.roll_hot_buckets()
15671564

1568-
# Restore original values
1569-
self.update(maxTotalDataSizeMB=tds,
1570-
frozenTimePeriodInSecs=ftp)
1571-
if self.content.totalEventCount != '0':
1572-
raise OperationError, "Operation timed out."
1565+
start = datetime.now()
1566+
diff = timedelta(seconds=timeout)
1567+
while self.content.totalEventCount != '0' and datetime.now() < start+diff:
1568+
sleep(1)
1569+
self.refresh()
1570+
finally:
1571+
# Restore original values
1572+
self.update(maxTotalDataSizeMB=tds, frozenTimePeriodInSecs=ftp)
1573+
if self.content.totalEventCount != '0':
1574+
raise OperationError, "Cleaning index %s took longer than %s seconds; timing out." % \
1575+
(self.name, timeout)
15731576
return self
15741577

15751578
def disable(self):

tests/test_examples.py

Lines changed: 0 additions & 342 deletions
This file was deleted.

0 commit comments

Comments
 (0)