99
1010VERSION = os .getenv ("SINGLE_VERSION" )
1111if not VERSION :
12- VERSION = "3.1-ubi8 "
12+ VERSION = "3.3-ubi9 "
1313
1414class TestRailsAppWithPostgreSQLExTemplate :
1515
1616 def setup_method (self ):
17- self .oc_api = OpenShiftAPI (pod_name_prefix = "rails-example" )
18- json_raw_file = self .oc_api .get_raw_url_for_json (
19- container = "s2i-ruby-container" , dir = "imagestreams" , filename = "ruby-rhel.json"
20- )
21- self .oc_api .import_is (path = json_raw_file , name = "ruby" )
22- json_raw_file = self .oc_api .get_raw_url_for_json (
23- container = "postgresql-container" , dir = "imagestreams" , filename = "postgresql-rhel.json"
24- )
25- self .oc_api .import_is (path = json_raw_file , name = "postgresql" )
17+ self .oc_api = OpenShiftAPI (pod_name_prefix = "rails-example" , shared_cluster = True )
2618
2719 def teardown_method (self ):
2820 self .oc_api .delete_project ()
@@ -32,29 +24,14 @@ def test_template_inside_cluster(self):
3224 branch_to_test = "3.3"
3325 else :
3426 branch_to_test = "master"
35- expected_output = "Welcome to your Rails application"
36- template_json = self .oc_api .get_raw_url_for_json (
37- container = "rails-ex" , branch = branch_to_test , dir = "openshift/templates" , filename = "rails-postgresql-persistent.json"
38- )
39- assert self .oc_api .deploy_template (
40- template = template_json , name_in_template = "rails-example" , expected_output = expected_output ,
41- openshift_args = [
42- f"SOURCE_REPOSITORY_REF={ branch_to_test } " ,
43- f"RUBY_VERSION={ VERSION } " ,
44- "NAME=rails-example" ,
45- "POSTGRESQL_VERSION=12-el8"
46- ]
27+ json_raw_file = self .oc_api .get_raw_url_for_json (
28+ container = "s2i-ruby-container" , dir = "imagestreams" , filename = "ruby-rhel.json"
4729 )
48- assert self .oc_api .template_deployed ( name_in_template = "rails-example" )
49- assert self .oc_api .check_response_inside_cluster (
50- name_in_template = "rails-example " , expected_output = expected_output
30+ self .oc_api .import_is ( path = json_raw_file , name = "ruby" , skip_check = True )
31+ json_raw_file = self .oc_api .get_raw_url_for_json (
32+ container = "postgresql-container " , dir = "imagestreams" , filename = "postgresql-rhel.json"
5133 )
52-
53- def test_template_by_request (self ):
54- if VERSION .startswith ("3.3" ):
55- branch_to_test = "3.3"
56- else :
57- branch_to_test = "master"
34+ self .oc_api .import_is (path = json_raw_file , name = "postgresql" , skip_check = True )
5835 expected_output = "Welcome to your Rails application"
5936 template_json = self .oc_api .get_raw_url_for_json (
6037 container = "rails-ex" , branch = branch_to_test , dir = "openshift/templates" , filename = "rails-postgresql-persistent.json"
@@ -68,7 +45,7 @@ def test_template_by_request(self):
6845 "POSTGRESQL_VERSION=12-el8"
6946 ]
7047 )
71- assert self .oc_api .template_deployed (name_in_template = "rails-example" )
72- assert self .oc_api .check_response_outside_cluster (
48+ assert self .oc_api .is_template_deployed (name_in_template = "rails-example" , timeout = 600 )
49+ assert self .oc_api .check_response_inside_cluster (
7350 name_in_template = "rails-example" , expected_output = expected_output
7451 )
0 commit comments