Skip to content

Commit ea9b8e5

Browse files
committed
Moving PSQL information to VARS
Signed-off-by: Petr "Stone" Hracek <[email protected]>
1 parent 50ffd7b commit ea9b8e5

File tree

4 files changed

+30
-21
lines changed

4 files changed

+30
-21
lines changed

test/conftest.py

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,44 @@
1010
if not check_variables():
1111
sys.exit(1)
1212

13-
Vars = namedtuple("Vars", [
14-
"OS", "VERSION", "IMAGE_NAME", "IS_MINIMAL", "VERSION_NO_MINIMAL", "SHORT_VERSION", "TEST_DIR"
15-
])
13+
OS = os.getenv("TARGET").lower()
1614
VERSION = os.getenv("VERSION")
17-
VARS = Vars(
18-
OS=os.getenv("TARGET").lower(),
19-
VERSION=VERSION,
20-
IMAGE_NAME=os.getenv("IMAGE_NAME"),
21-
IS_MINIMAL="minimal" in VERSION,
22-
VERSION_NO_MINIMAL=VERSION.replace("-minimal", ""),
23-
SHORT_VERSION=VERSION.replace("-minimal", "").replace(".", ""),
24-
TEST_DIR=Path(__file__).parent.absolute()
25-
)
26-
15+
IMAGE_TAG = "15-c9s"
16+
PGSQL_IMAGE_TAG = f"postgresql:{IMAGE_TAG}"
17+
DEPLOYED_PGSQL_IMAGE = f"quay.io/sclorg/{PGSQL_IMAGE_TAG}"
2718
TAGS = {
2819
"rhel8": "-ubi8",
2920
"rhel9": "-ubi9",
3021
"rhel10": "-ubi10",
3122
}
32-
3323
MYSQL_TAGS = {
3424
"rhel8": "-el8",
3525
"rhel9": "-el9",
3626
"rhel10": "-el10",
3727
}
3828

39-
DEPLOYED_PGSQL_IMAGE = "quay.io/sclorg/postgresql-15-c9s"
29+
Vars = namedtuple("Vars", [
30+
"OS", "VERSION", "TAG", "MYSQL_TAG", "PGSQL_IMAGE_TAG",
31+
"DEPLOYED_PGSQL_IMAGE", "IMAGE_NAME", "IS_MINIMAL",
32+
"VERSION_NO_MINIMAL", "SHORT_VERSION", "TEST_DIR"
33+
])
34+
35+
36+
VARS = Vars(
37+
OS=OS,
38+
VERSION=VERSION,
39+
TAG=TAGS.get(OS),
40+
MYSQL_TAG=MYSQL_TAGS.get(OS),
41+
PGSQL_IMAGE_TAG=PGSQL_IMAGE_TAG,
42+
DEPLOYED_PGSQL_IMAGE=DEPLOYED_PGSQL_IMAGE,
43+
IMAGE_NAME=os.getenv("IMAGE_NAME"),
44+
IS_MINIMAL="minimal" in VERSION,
45+
VERSION_NO_MINIMAL=VERSION.replace("-minimal", ""),
46+
SHORT_VERSION=VERSION.replace("-minimal", "").replace(".", ""),
47+
TEST_DIR=Path(__file__).parent.absolute()
48+
)
4049

41-
PGSQL_IMAGE_TAG = "postgresql:15-c9s"
42-
IMAGE_TAG = "15-c9s"
4350

4451
def skip_for_minimal():
4552
if "minimal" in VARS.VERSION:
4653
skip("This test is not available for NodeJS minimal container")
47-

test/test_container_apps.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from conftest import VARS, skip_for_minimal
1010

11+
1112
test_app = VARS.TEST_DIR / "test-app"
1213
test_binary = VARS.TEST_DIR / "test-binary"
1314
test_express_webapp = VARS.TEST_DIR / "test-express-webapp"
@@ -247,6 +248,7 @@ def test_node_cmd_development(self, node_env, init_wrapper, node_cmd):
247248
assert re.search(f"INIT_WRAPPER={init_wrapper}", logs)
248249
assert re.search(f"NODE_CMD={node_cmd}", logs)
249250

251+
250252
class TestNodeJSAppsWithNodeEnvDevelopmentContainer:
251253

252254
def setup_method(self):

test/test_container_basics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from conftest import VARS, skip_for_minimal
99

10+
1011
test_fips = VARS.TEST_DIR / "test-fips"
1112

1213

test/test_ocp_imagestreams_quickstart.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from container_ci_suite.openshift import OpenShiftAPI
44

5-
from conftest import VARS, DEPLOYED_PGSQL_IMAGE, PGSQL_IMAGE_TAG, IMAGE_TAG
5+
from conftest import VARS
66

77

88
# Replacement with 'test_python_s2i_templates'
@@ -26,7 +26,7 @@ def teardown_method(self):
2626
]
2727
)
2828
def test_nodejs_template_inside_cluster(self, template):
29-
assert self.oc_api.upload_image(DEPLOYED_PGSQL_IMAGE, PGSQL_IMAGE_TAG)
29+
assert self.oc_api.upload_image(VARS.DEPLOYED_PGSQL_IMAGE, VARS.PGSQL_IMAGE_TAG)
3030
service_name = f"nodejs-{VARS.VERSION}-example"
3131
template_url = self.oc_api.get_raw_url_for_json(
3232
container="nodejs-ex", dir="openshift/templates", filename=template, branch="master"
@@ -41,7 +41,7 @@ def test_nodejs_template_inside_cluster(self, template):
4141
openshift_args = [
4242
"SOURCE_REPOSITORY_URL=https://github.com/sclorg/nodejs-ex.git",
4343
"SOURCE_REPOSITORY_REF=master",
44-
f"POSTGRESQL_VERSION={IMAGE_TAG}",
44+
f"POSTGRESQL_VERSION={VARS.IMAGE_TAG}",
4545
f"NODEJS_VERSION={VARS.VERSION_NO_MINIMAL}",
4646
f"NAME={service_name}",
4747
"DATABASE_USER=testu",

0 commit comments

Comments
 (0)