Fix timeout for scenario runners

Timeout for scenario runners doesn't work correctly.
To reproduce it just put in Dummy scenario args sleep bigger
then timeout and it won't fail, that will verify this bug.

Tasks are running in threads, so we need a way to kill threads.
New function `terminate_thread` added for this purpose.

Also added function that is run in separate thread and check
execution time of the threads. If they run longer then timeout
they would be terminated by terminate_thread.

Thread can not be killed during system call, so this mechanism
isn't 100% effective. Due to this interruptable_sleep method
was added in order to be used by Dummy scenarios.

Added timeout argument to constant and rps runners. Also added
two Dummy scenarios to test this.

New exception ThreadTimeoutException was added.

Closes-Bug: #1385365

Co-Authored-By: Roman Vasilets <rvasilets@mirantis.com>
Co-Authored-By: Sergey Scripnick <sskripnick@mirantis.com>

Change-Id: I2096ba6adaf81a18c80b2ae6a759ccc9e247c45a
This commit is contained in:
Roman Vasilets
2015-11-19 14:30:57 +02:00
committed by Sergey Skripnick
parent b16d8472c4
commit 8bb52e33d0

View File

@@ -658,6 +658,30 @@
type: "constant"
times: 20
concurrency: 5
-
args:
sleep: 30
message: "This scenario should be terminated by runner timeout."
runner:
type: "constant"
times: 2
concurrency: 2
timeout: 1
sla:
failure_rate:
min: 100
-
args:
sleep: 30
message: "This scenario should be terminated by runner timeout."
runner:
type: "rps"
times: 1
rps: 1
timeout: 1
sla:
failure_rate:
min: 100
Dummy.dummy_exception_probability:
-