-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathci_tests.py
More file actions
executable file
·77 lines (54 loc) · 1.83 KB
/
ci_tests.py
File metadata and controls
executable file
·77 lines (54 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python3
"""
Available tests
Adapted from https://github.com/stackrox/stackrox/blob/master/.openshift-ci/ci_tests.py
"""
import subprocess
from common import popen_graceful_kill
class BaseTest:
def __init__(self):
self.test_output_dirs = []
def run_with_graceful_kill(self, args, timeout):
with subprocess.Popen(args) as cmd:
try:
exitstatus = cmd.wait(timeout)
if exitstatus != 0:
raise RuntimeError(f"Test failed: exit {exitstatus}")
except subprocess.TimeoutExpired as err:
# Kill child processes as we cannot rely on bash scripts to
# handle signals and stop tests
subprocess.run(
["/usr/bin/pkill", "-P", str(cmd.pid)], check=True, timeout=5
)
# Then kill the test command
popen_graceful_kill(cmd)
raise err
class NullTest(BaseTest):
def run(self):
pass
class E2ETest(BaseTest):
TEST_TIMEOUT = 90 * 60
def run(self):
print("Executing E2E tests")
self.run_with_graceful_kill(
["scripts/ci/jobs/e2etests/e2e-tests.sh"],
self.TEST_TIMEOUT,
)
class ScaleTest(BaseTest):
TEST_TIMEOUT = 120 * 60
OUTPUT_DIR = "/tmp/pprof-out"
def run(self):
print("Executing Scale tests")
self.run_with_graceful_kill(
["scripts/ci/jobs/e2etests/scale-tests.sh"],
self.TEST_TIMEOUT,
)
self.test_output_dirs.append(self.OUTPUT_DIR)
class SlimE2ETest(BaseTest):
TEST_TIMEOUT = 90 * 60
def run(self):
print("Executing Slim E2E tests")
self.run_with_graceful_kill(
["scripts/ci/jobs/e2etests/slim-e2e-tests.sh"],
self.TEST_TIMEOUT,
)