@@ -27,27 +27,26 @@ def teardown_method(self):
2727 self .oc_api .delete_project ()
2828
2929 @pytest .mark .parametrize (
30- "template_type" ,
30+ "template_type, template_name " ,
3131 [
32- "local" ,
33- "ex" ,
32+ ("local" , "rails.json" ),
33+ ("local" , "rails-postgresql-persistent.json" ),
34+ ("ex" , "rails.json" ),
35+ ("ex" , "rails-postgresql.json" ),
3436 ],
3537 )
36- def test_rails_template_inside_cluster (self , template_type ):
38+ def test_rails_template_cluster (self , template_type , template_name ):
3739 """
3840 Test if Ruby s2i local templates work properly
3941 """
40- assert self .oc_api .upload_image (
41- VARS .DEPLOYED_PSQL_IMAGE , VARS .PSQL_IMAGE_SHORT
42- )
42+ assert self .oc_api .upload_image (VARS .DEPLOYED_PSQL_IMAGE , VARS .PSQL_IMAGE_SHORT )
4343 service_name = f"ruby-{ VARS .SHORT_VERSION } -testing"
44- if template_type == "local" :
45- template_url = "examples/rails.json"
46- else :
44+ template_url = f"examples/{ template_name } "
45+ if template_type == "ex" :
4746 template_url = self .oc_api .get_raw_url_for_json (
48- container = "rails-ex " ,
47+ container = "phracek " ,
4948 dir = "openshift/templates" ,
50- filename = "rails.json" ,
49+ filename = template_name ,
5150 branch = VARS .TEST_APP_BRANCH ,
5251 )
5352 openshift_args = [
@@ -56,17 +55,14 @@ def test_rails_template_inside_cluster(self, template_type):
5655 f"RUBY_VERSION={ VARS .VERSION } " ,
5756 f"NAME={ service_name } " ,
5857 ]
59- # TODO: Add postgresql persistent template
60- # if template != "rails.json":
61- # openshift_args = [
62- # "SOURCE_REPOSITORY_URL=https://github.com/sclorg/rails-ex.git",
63- # f"SOURCE_REPOSITORY_REF={VARS.TEST_APP_BRANCH}",
64- # f"POSTGRESQL_VERSION={VARS.PSQL_IMAGE_TAG}",
65- # f"RUBY_VERSION={VARS.VERSION}",
66- # f"NAME={service_name}",
67- # "DATABASE_USER=testu",
68- # "DATABASE_PASSWORD=testp",
69- # ]
58+ if template_name != "rails.json" :
59+ openshift_args .extend (
60+ [
61+ f"POSTGRESQL_VERSION={ VARS .PSQL_IMAGE_TAG } " ,
62+ "DATABASE_USER=testu" ,
63+ "DATABASE_PASSWORD=testp" ,
64+ ]
65+ )
7066 assert self .oc_api .deploy_template_with_image (
7167 image_name = VARS .IMAGE_NAME ,
7268 template = template_url ,
0 commit comments