summaryrefslogtreecommitdiffstats
path: root/tests/sinkloadtest.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sinkloadtest.py')
-rwxr-xr-xtests/sinkloadtest.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/sinkloadtest.py b/tests/sinkloadtest.py
index 3eff270..d5de1a8 100755
--- a/tests/sinkloadtest.py
+++ b/tests/sinkloadtest.py
@@ -6,6 +6,8 @@ import os
6import sys 6import sys
7import signal 7import signal
8import datetime 8import datetime
9from threading import Timer
10import time
9 11
10def execute(cmd): 12def execute(cmd):
11 print (str(datetime.datetime.now()) + " Running command: ", cmd) 13 print (str(datetime.datetime.now()) + " Running command: ", cmd)
@@ -40,9 +42,29 @@ def loadtest():
40 else: 42 else:
41 raise Exception("Something went wrong during the query: ", proc.returncode) 43 raise Exception("Something went wrong during the query: ", proc.returncode)
42 44
45def timeout():
46 # This is not an error
47 print("Exceeded runtime. Test successfully completed.")
48 sys.stdout.flush()
49 os._exit(0)
50
51def executionTimeout():
52 print("Closed because execution timed out")
53 sys.stdout.flush()
54 os._exit(1)
55
43try: 56try:
57 runtime = 30 * 60
58 executionTimeoutTime = 120
59 t = Timer(runtime, timeout)
60 t.start()
61 start = time.time()
44 while True: 62 while True:
63 executionTimer = Timer(executionTimeoutTime, executionTimeout)
64 executionTimer.start()
45 loadtest(); 65 loadtest();
66 executionTimer.cancel()
67 print("Running for ", time.time() - start)
46except (KeyboardInterrupt, SystemExit): 68except (KeyboardInterrupt, SystemExit):
47 print("Aborted with Ctrl-c") 69 print("Aborted with Ctrl-c")
48 sys.exit(0) 70 sys.exit(0)