提交 eac1c5f1 编写于 作者: C Cleber Rosa

sleeptenmin test: add new test scenarios

Including number of sleep cycles, sleep cycle length and finally
the sleep method, either using the python time.sleep() or running
the shell "sleep" command.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 04dd914e
......@@ -15,6 +15,7 @@
# Author: Lucas Meneghel Rodrigues <lmr@redhat.com>
import os
import time
from avocado import job
......@@ -26,15 +27,23 @@ class sleeptenmin(test.Test):
"""
Sleeps for 10 minutes
"""
default_params = {'sleep_length': 600}
default_params = {'sleep_length': 600,
'sleep_cycles': 1,
'sleep_method': 'builtin'}
def action(self):
"""
Sleep for length seconds.
"""
self.log.debug("Sleeping for %.2f seconds", self.params.sleep_length)
time.sleep(self.params.sleep_length)
cycles = int(self.params.sleep_cycles)
length = int(self.params.sleep_length)
for cycle in xrange(0, cycles):
self.log.debug("Sleeping for %.2f seconds", length)
if self.params.sleep_method == 'builtin':
time.sleep(length)
elif self.params.sleep_method == 'shell':
os.system("sleep %s" % length)
if __name__ == "__main__":
job.main()
variants:
- sleeptenmin:
variants:
- builtin:
sleep_method = builtin
- shell:
sleep_method = shell
variants:
- one_cycle:
sleep_cycles = 1
sleep_length = 600
- six_cycles:
sleep_cycles = 6
sleep_length = 100
- one_hundred_cycles:
sleep_cycles = 100
sleep_length = 6
- six_hundred_cycles:
sleep_cycles = 600
sleep_length = 1
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册