Skip to content

Commit

Permalink
Merge pull request #93 from sclorg/add_local_test
Browse files Browse the repository at this point in the history
Add local test for template
  • Loading branch information
phracek authored Mar 26, 2024
2 parents 5950b75 + caf02fa commit 6e3d178
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
17 changes: 17 additions & 0 deletions tests/test_dancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@ def setup_method(self):
def teardown_method(self):
self.oc_api.delete_project()


def test_local_template_inside_cluster(self):
expected_output = "Welcome to your Dancer application"
template_json = "../openshift/templates/dancer.json"
assert self.oc_api.deploy_template(
template=template_json, name_in_template="dancer-example", expected_output=expected_output,
openshift_args=[
"SOURCE_REPOSITORY_REF=master",
f"PERL_VERSION={VERSION}",
"NAME=dancer-example"
]
)
assert self.oc_api.template_deployed(name_in_template="dancer-example")
assert self.oc_api.check_response_inside_cluster(
name_in_template="dancer-example", expected_output=expected_output
)

def test_template_inside_cluster(self):
expected_output = "Welcome to your Dancer application"
template_json = self.oc_api.get_raw_url_for_json(
Expand Down
19 changes: 18 additions & 1 deletion tests/test_dancer_mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
if not VERSION:
VERSION="5.32-ubi8"

class TestDancerAppExTemplate:
class TestDancerAppMySQLExTemplate:

def setup_method(self):
self.oc_api = OpenShiftAPI(pod_name_prefix="dancer-example")
Expand All @@ -27,6 +27,23 @@ def setup_method(self):
def teardown_method(self):
self.oc_api.delete_project()

def test_local_template_inside_cluster(self):
expected_output = "Welcome to your Dancer application"
template_json = "../openshift/templates/dancer-mysql-persistent.json"
assert self.oc_api.deploy_template(
template=template_json, name_in_template="dancer-example", expected_output=expected_output,
openshift_args=[
"SOURCE_REPOSITORY_REF=master",
f"PERL_VERSION={VERSION}",
"NAME=dancer-example",
"MYSQL_VERSION=8.0-el8"
]
)
assert self.oc_api.template_deployed(name_in_template="dancer-example")
assert self.oc_api.check_response_inside_cluster(
name_in_template="dancer-example", expected_output=expected_output
)

def test_template_inside_cluster(self):
expected_output = "Welcome to your Dancer application"
template_json = self.oc_api.get_raw_url_for_json(
Expand Down

0 comments on commit 6e3d178

Please sign in to comment.