-
Notifications
You must be signed in to change notification settings - Fork 203
/
Copy pathtest_mysql_imagestream.py
52 lines (42 loc) · 1.44 KB
/
test_mysql_imagestream.py
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
import os
import sys
import pytest
from container_ci_suite.openshift import OpenShiftAPI
from container_ci_suite.utils import check_variables
if not check_variables():
print("At least one variable from IMAGE_NAME, OS, VERSION is missing.")
sys.exit(1)
VERSION = os.getenv("VERSION")
IMAGE_NAME = os.getenv("IMAGE_NAME")
OS = os.getenv("TARGET")
TAGS = {
"rhel8": "-el8",
"rhel9": "-el9"
}
TAG = TAGS.get(OS, None)
class TestMySQLImagestreamTemplate:
def setup_method(self):
self.oc_api = OpenShiftAPI(pod_name_prefix="mysql", version=VERSION, shared_cluster=True)
def teardown_method(self):
self.oc_api.delete_project()
@pytest.mark.parametrize(
"template",
[
"mysql-ephemeral-template.json",
"mysql-persistent-template.json"
]
)
def test_imagestream_template(self, template):
if VERSION == "8.4":
# It is not shipped yet
pytest.skip("Skipping test for 8.4")
os_name = ''.join(i for i in OS if not i.isdigit())
assert self.oc_api.deploy_image_stream_template(
imagestream_file=f"imagestreams/mysql-{os_name}.json",
template_file=f"examples/{template}",
app_name=self.oc_api.pod_name_prefix,
openshift_args=[
f"MYSQL_VERSION={VERSION}{TAG}"
]
)
assert self.oc_api.is_pod_running(pod_name_prefix=self.oc_api.pod_name_prefix)