Skip to content

Commit 39aa884

Browse files
committed
Fix test suite for testing PHP application.
remove obsoleted functions that does not make sense. `test_local_template_inside_cluster` and `test_remote_template_by_request` Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
1 parent 366dd76 commit 39aa884

File tree

3 files changed

+5
-104
lines changed

3 files changed

+5
-104
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
.PHONY: test-openshift-4
2-
test-openshift-4:
3-
cd tests && PYTHONPATH=$(CURDIR) python3 -m pytest --verbose --color=yes --showlocals .
1+
.PHONY: test-openshift-pytest
2+
test-openshift-pytest:
3+
cd tests && PYTHONPATH=$(CURDIR) python3 -m pytest --verbose --color=yes --showlocals .

tests/test_cakephp.py

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,6 @@ def setup_method(self):
2323
def teardown_method(self):
2424
self.oc_api.delete_project()
2525

26-
def test_local_template_inside_cluster(self):
27-
branch_to_test = "master"
28-
expected_output = "Welcome to PHP"
29-
if VERSION.startswith("7.4") or VERSION.startswith("8.0"):
30-
branch_to_test = "4.X"
31-
expected_output = "Welcome to CakePHP 4"
32-
if VERSION.startswith("8.1") or VERSION.startswith("8.2"):
33-
branch_to_test = "5.X"
34-
expected_output = "Welcome to CakePHP 5"
35-
36-
template_json = "../openshift/templates/cakephp.json"
37-
assert self.oc_api.deploy_template(
38-
template=template_json, name_in_template="cakephp-example", expected_output=expected_output,
39-
openshift_args=[
40-
f"SOURCE_REPOSITORY_REF={branch_to_test}",
41-
f"PHP_VERSION={VERSION}",
42-
"NAME=cakephp-example"
43-
]
44-
)
45-
assert self.oc_api.template_deployed(name_in_template="cakephp-example")
46-
assert self.oc_api.check_response_inside_cluster(
47-
name_in_template="cakephp-example", expected_output=expected_output
48-
)
49-
5026
def test_remote_template_inside_cluster(self):
5127
branch_to_test = "master"
5228
expected_output = "Welcome to PHP"
@@ -64,30 +40,7 @@ def test_remote_template_inside_cluster(self):
6440
template=template_json, name_in_template="cakephp-example", expected_output=expected_output,
6541
openshift_args=[f"SOURCE_REPOSITORY_REF={branch_to_test}", f"PHP_VERSION={VERSION}", "NAME=cakephp-example"]
6642
)
67-
assert self.oc_api.template_deployed(name_in_template="cakephp-example")
43+
assert self.oc_api.is_template_deployed(name_in_template="cakephp-example")
6844
assert self.oc_api.check_response_inside_cluster(
6945
name_in_template="cakephp-example", expected_output=expected_output
7046
)
71-
72-
def test_remote_template_by_request(self):
73-
branch_to_test = "master"
74-
expected_output = "Welcome to PHP"
75-
if VERSION.startswith("7.4") or VERSION.startswith("8.0"):
76-
branch_to_test = "4.X"
77-
expected_output = "Welcome to CakePHP 4"
78-
elif VERSION.startswith("8.1") or VERSION.startswith("8.2"):
79-
branch_to_test = "5.X"
80-
expected_output = "Welcome to CakePHP 5"
81-
82-
template_json = self.oc_api.get_raw_url_for_json(
83-
container="cakephp-ex", branch=branch_to_test, dir="openshift/templates", filename="cakephp.json"
84-
)
85-
assert self.oc_api.deploy_template(
86-
template=template_json, name_in_template="cakephp-example", expected_output=expected_output,
87-
openshift_args=[f"SOURCE_REPOSITORY_REF={branch_to_test}", f"PHP_VERSION={VERSION}", "NAME=cakephp-example"]
88-
)
89-
assert self.oc_api.template_deployed(name_in_template="cakephp-example")
90-
assert self.oc_api.check_response_outside_cluster(
91-
protocol="https",
92-
name_in_template="cakephp-example", expected_output=expected_output
93-
)

tests/test_cakephp_mysql.py

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,6 @@ def setup_method(self):
2727
def teardown_method(self):
2828
self.oc_api.delete_project()
2929

30-
def test_local_template_inside_cluster(self):
31-
branch_to_test = "master"
32-
expected_output = "Welcome to PHP"
33-
if VERSION.startswith("7.4") or VERSION.startswith("8.0"):
34-
branch_to_test = "4.X"
35-
expected_output = "Welcome to CakePHP 4"
36-
if VERSION.startswith("8.1") or VERSION.startswith("8.2"):
37-
branch_to_test = "5.X"
38-
expected_output = "Welcome to CakePHP 5"
39-
template_json = "../openshift/templates/cakephp-mysql-persistent.json"
40-
assert self.oc_api.deploy_template(
41-
template=template_json, name_in_template="cakephp-example", expected_output=expected_output,
42-
openshift_args=[
43-
f"SOURCE_REPOSITORY_REF={branch_to_test}",
44-
f"PHP_VERSION={VERSION}",
45-
"NAME=cakephp-example",
46-
"MYSQL_VERSION=8.0-el8"
47-
]
48-
)
49-
assert self.oc_api.template_deployed(name_in_template="cakephp-example")
50-
assert self.oc_api.check_response_inside_cluster(
51-
name_in_template="cakephp-example", expected_output=expected_output
52-
)
53-
5430
def test_remote_template_inside_cluster(self):
5531
branch_to_test = "master"
5632
expected_output = "Welcome to PHP"
@@ -73,35 +49,7 @@ def test_remote_template_inside_cluster(self):
7349
"MYSQL_VERSION=8.0-el8"
7450
]
7551
)
76-
assert self.oc_api.template_deployed(name_in_template="cakephp-example")
52+
assert self.oc_api.is_template_deployed(name_in_template="cakephp-example")
7753
assert self.oc_api.check_response_inside_cluster(
7854
name_in_template="cakephp-example", expected_output=expected_output
7955
)
80-
81-
def test_remote_template_by_request(self):
82-
branch_to_test = "master"
83-
expected_output = "Welcome to PHP"
84-
if VERSION.startswith("7.4") or VERSION.startswith("8.0"):
85-
branch_to_test = "4.X"
86-
expected_output = "Welcome to CakePHP 4"
87-
elif VERSION.startswith("8.1") or VERSION.startswith("8.2"):
88-
branch_to_test = "5.X"
89-
expected_output = "Welcome to CakePHP 5"
90-
91-
template_json = self.oc_api.get_raw_url_for_json(
92-
container="cakephp-ex", branch=branch_to_test, dir="openshift/templates", filename="cakephp-mysql-persistent.json"
93-
)
94-
assert self.oc_api.deploy_template(
95-
template=template_json, name_in_template="cakephp-example", expected_output=expected_output,
96-
openshift_args=[
97-
f"SOURCE_REPOSITORY_REF={branch_to_test}",
98-
f"PHP_VERSION={VERSION}",
99-
"NAME=cakephp-example",
100-
"MYSQL_VERSION=8.0-el8"
101-
]
102-
)
103-
assert self.oc_api.template_deployed(name_in_template="cakephp-example")
104-
assert self.oc_api.check_response_outside_cluster(
105-
protocol="https",
106-
name_in_template="cakephp-example", expected_output=expected_output
107-
)

0 commit comments

Comments
 (0)