1- import os
2- import sys
3-
41import pytest
52
63from container_ci_suite .openshift import OpenShiftAPI
7- from container_ci_suite .utils import check_variables
8-
9- from constants import TAGS
10-
11- if not check_variables ():
12- print ("At least one variable from IMAGE_NAME, OS, VERSION is missing." )
13- sys .exit (1 )
14-
15-
16- VERSION = os .getenv ("VERSION" )
17- IMAGE_NAME = os .getenv ("IMAGE_NAME" )
18- OS = os .getenv ("TARGET" )
19-
204
21- TAG = TAGS . get ( OS )
5+ from conftest import VARS
226
237
248class TestMySQLDeployTemplate :
259 def setup_method (self ):
2610 self .oc_api = OpenShiftAPI (
27- pod_name_prefix = "mysql-testing" , version = VERSION , shared_cluster = True
11+ pod_name_prefix = "mysql-testing" , version = VARS . VERSION , shared_cluster = True
2812 )
2913 self .oc_api .import_is ("imagestreams/mysql-rhel.json" , "" , skip_check = True )
3014
@@ -35,13 +19,13 @@ def teardown_method(self):
3519 "template" , ["mysql-ephemeral-template.json" , "mysql-persistent-template.json" ]
3620 )
3721 def test_template_inside_cluster (self , template ):
38- short_version = VERSION .replace ("." , "" )
22+ short_version = VARS . VERSION .replace ("." , "" )
3923 assert self .oc_api .deploy_template_with_image (
40- image_name = IMAGE_NAME ,
24+ image_name = VARS . IMAGE_NAME ,
4125 template = template ,
4226 name_in_template = "mysql" ,
4327 openshift_args = [
44- f"MYSQL_VERSION={ VERSION } { TAG } " ,
28+ f"MYSQL_VERSION={ VARS . VERSION } { VARS . TAG } " ,
4529 f"DATABASE_SERVICE_NAME={ self .oc_api .pod_name_prefix } " ,
4630 "MYSQL_USER=testu" ,
4731 "MYSQL_PASSWORD=testp" ,
@@ -51,7 +35,7 @@ def test_template_inside_cluster(self, template):
5135
5236 assert self .oc_api .is_pod_running (pod_name_prefix = self .oc_api .pod_name_prefix )
5337 assert self .oc_api .check_command_internal (
54- image_name = f"registry.redhat.io/{ OS } /mysql-{ short_version } " ,
38+ image_name = f"registry.redhat.io/{ VARS . OS } /mysql-{ short_version } " ,
5539 service_name = self .oc_api .pod_name_prefix ,
5640 cmd = "echo 'SELECT 42 as testval\\ g' | mysql --connect-timeout=15 -h <IP> testdb -utestu -ptestp" ,
5741 expected_output = "42" ,
0 commit comments