Skip to content

Commit

Permalink
Merge pull request #100 from sclorg/fix_python_builds
Browse files Browse the repository at this point in the history
Fix python testing for whole supported imagestreams
  • Loading branch information
phracek authored Sep 13, 2024
2 parents 834de0e + 0ec1358 commit 487a46c
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 19 deletions.
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

0 comments on commit 487a46c

Please sign in to comment.