Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix python testing for whole supported imagestreams #100

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"python_version": {
"type": "string",
"description": "Specify Python imagestream tag",
"enum": [ "latest", "2.7-ubi8", "3.6-ubi8", "3.8-ubi8", "3.8-ubi7", "3.9-ubi8", "3.9-ubi9", "3.11-ubi8", "3.11-ubi9" ]
"enum": [ "latest", "3.6-ubi8", "3.9-ubi8", "3.11-ubi8", "3.12-ubi8", "3.9-ubi9", "3.11-ubi9", "3.12-ubi9" ]
},
"application_domain": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ spec:
output:
to:
kind: ImageStreamTag
name: {{ .Values.name }}:latest
name: "{{ .Values.name }}:latest"
postCommit:
script: ./manage.py test
source:
contextDir: {{ .Values.context_dir }}
git:
ref: {{ .Values.source_repository_ref }}
uri: {{ .Values.source_repository_url }}
ref: "{{ .Values.source_repository_ref }}"
uri: "{{ .Values.source_repository_url }}"
type: Git
strategy:
sourceStrategy:
env:
- name: PIP_INDEX_URL
value: {{ .Values.pip_index_url }}
value: "{{ .Values.pip_index_url }}"
from:
kind: ImageStreamTag
name: python:{{ .Values.python_version }}
name: "python:{{ .Values.python_version }}"
namespace: {{ .Values.namespace }}
type: Source
triggers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"python_version": {
"type": "string",
"description": "Specify Python imagestream tag",
"enum": [ "latest", "2.7-ubi8", "3.6-ubi8", "3.8-ubi8", "3.8-ubi7", "3.9-ubi8", "3.9-ubi9", "3.11-ubi8", "3.11-ubi9" ]
"enum": [ "latest", "3.6-ubi8", "3.9-ubi8", "3.11-ubi8", "3.12-ubi8", "3.9-ubi9", "3.11-ubi9", "3.12-ubi9" ]
},
"application_domain": {
"type": "string",
Expand Down
38 changes: 32 additions & 6 deletions tests/test_python_django_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,19 @@ def setup_method(self):
def teardown_method(self):
self.hc_api.delete_project()

def test_django_application_curl_output(self):
@pytest.mark.parametrize(
"version,branch",
[
("3.12-ubi9", "4.2.x"),
("3.12-ubi8", "4.2.x"),
("3.11-ubi9", "4.2.x"),
("3.11-ubi8", "4.2.x"),
("3.9-ubi9", "master"),
("3.9-ubi8", "master"),
("3.6-ubi8", "master"),
],
)
def test_django_application_curl_output(self, version, branch):
if self.hc_api.oc_api.shared_cluster:
pytest.skip("Do NOT test on shared cluster")
self.hc_api.package_name = "python-imagestreams"
Expand All @@ -28,8 +40,9 @@ def test_django_application_curl_output(self):
self.hc_api.helm_package()
assert self.hc_api.helm_installation(
values={
"python_version": "3.11-ubi8",
"namespace": self.hc_api.namespace
"python_version": version,
"namespace": self.hc_api.namespace,
"source_repository_ref": branch,
}
)
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="django-example")
Expand All @@ -38,16 +51,29 @@ def test_django_application_curl_output(self):
expected_str="Welcome to your Django application"
)

def test_django_application_helm_test(self):
@pytest.mark.parametrize(
"version,branch",
[
("3.12-ubi9", "4.2.x"),
("3.12-ubi8", "4.2.x"),
("3.11-ubi9", "4.2.x"),
("3.11-ubi8", "4.2.x"),
("3.9-ubi9", "master"),
("3.9-ubi8", "master"),
("3.6-ubi8", "master"),
],
)
def test_django_application_helm_test(self, version, branch):
self.hc_api.package_name = "python-imagestreams"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
self.hc_api.package_name = "python-django-application"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation(
values={
"python_version": "3.11-ubi8",
"namespace": self.hc_api.namespace
"python_version": version,
"namespace": self.hc_api.namespace,
"source_repository_ref": branch,
}
)
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="django-example")
Expand Down
38 changes: 32 additions & 6 deletions tests/test_python_django_psql_persistent.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,19 @@ def setup_method(self):
def teardown_method(self):
self.hc_api.delete_project()

def test_django_psql_curl_output(self):
@pytest.mark.parametrize(
"version,branch",
[
("3.12-ubi9", "4.2.x"),
("3.12-ubi8", "4.2.x"),
("3.11-ubi9", "4.2.x"),
("3.11-ubi8", "4.2.x"),
("3.9-ubi9", "master"),
("3.9-ubi8", "master"),
("3.6-ubi8", "master"),
],
)
def test_django_psql_curl_output(self, version, branch):
if self.hc_api.oc_api.shared_cluster:
pytest.skip("Do NOT test on shared cluster")
self.hc_api.package_name = "postgresql-imagestreams"
Expand All @@ -31,8 +43,9 @@ def test_django_psql_curl_output(self):
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation(
values={
"python_version": "3.11-ubi8",
"namespace": self.hc_api.namespace
"python_version": version,
"namespace": self.hc_api.namespace,
"source_repository_ref": branch,
}
)
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="django-psql")
Expand All @@ -41,7 +54,19 @@ def test_django_psql_curl_output(self):
expected_str="Welcome to your Django application"
)

def test_django_psql_helm_test(self):
@pytest.mark.parametrize(
"version,branch",
[
("3.12-ubi9", "4.2.x"),
("3.12-ubi8", "4.2.x"),
("3.11-ubi9", "4.2.x"),
("3.11-ubi8", "4.2.x"),
("3.9-ubi9", "master"),
("3.9-ubi8", "master"),
("3.6-ubi8", "master"),
],
)
def test_django_psql_helm_test(self, version, branch):
self.hc_api.package_name = "postgresql-imagestreams"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
Expand All @@ -52,8 +77,9 @@ def test_django_psql_helm_test(self):
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation(
values={
"python_version": "3.11-ubi8",
"namespace": self.hc_api.namespace
"python_version": version,
"namespace": self.hc_api.namespace,
"source_repository_ref": branch,
}
)
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="django-psql")
Expand Down