Skip to content

Commit 4387a11

Browse files
author
David Noble
committed
test_touch and test_setpriority updates
Splunk 6 breaks test_touch. We will be logging a core issue to address this problem. Splunk 6 breaks test_setpriority, but we can work around it. We will be logging a core issue to address this problem.
1 parent 0395c8e commit 4387a11

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

tests/test_job.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,18 +229,20 @@ def test_setpriority(self):
229229
priority=5,
230230
latest_time="now")
231231

232-
# Note that you can only *decrease* the priority (i.e., 5 decreased to 3)
233-
# of a job unless Splunk is running as root. This is because Splunk jobs
232+
# Note: You can only *decrease* the priority (i.e., 5 decreased to 3) of
233+
# a job unless Splunk is running as root. This is because Splunk jobs
234234
# are tied up with operating system processes and their priorities.
235235

236236
if self.service._splunk_version[0] < 6:
237+
# BUG: Splunk 6 doesn't return priority until job is ready
237238
old_priority = int(self.job.content['priority'])
238239
self.assertEqual(5, old_priority)
239240

240241
new_priority = 3
241242
self.job.set_priority(new_priority)
242243

243-
if self.service._splunk_version[0] >= 6:
244+
if self.service._splunk_version[0] > 5:
245+
# BUG: Splunk 6 doesn't return priority until job is ready
244246
while not self.job.is_ready():
245247
pass
246248

@@ -325,10 +327,14 @@ def test_setttl(self):
325327
self.assertGreater(ttl, old_ttl)
326328

327329
def test_touch(self):
328-
# This cannot be tested very fast. touch will reset the ttl to the original value for the job,
329-
# so first we have to wait just long enough for the ttl to tick down. Its granularity is 1s,
330-
# so we'll wait 1.1s before we start.
330+
# This cannot be tested very fast. touch will reset the ttl to the
331+
# original value for the job, so first we have to wait just long enough
332+
# for the ttl to tick down. Its granularity is 1s, so we'll wait a
333+
# couple of seconds before we start.
334+
while not self.job.is_done():
335+
pass
331336
sleep(2)
337+
self.job.refresh()
332338
old_ttl = int(self.job['ttl'])
333339
self.job.touch()
334340
self.job.refresh()

0 commit comments

Comments
 (0)