Skip to content

Commit 890a79f

Browse files
authored
Merge pull request #63 from karellen/issue_62
Enable testing on K8S 1.30.x, Istio 1.22
2 parents c7239fe + c9609f7 commit 890a79f

File tree

7 files changed

+54
-8
lines changed

7 files changed

+54
-8
lines changed

build.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def set_properties(project):
5555
project.depends_on("openapi-spec-validator", "~=0.3")
5656
project.depends_on("json-log-formatter", "~=0.3")
5757
project.depends_on("platformdirs", "~=4.2")
58-
project.depends_on("requests", "~=2.25")
58+
project.depends_on("requests", "~=2.31.0")
5959
project.depends_on("jsonpatch", "~=1.32")
6060
project.depends_on("jsonpath-ng", "~=1.6.1")
6161
project.depends_on("jinja2", "~=3.1")

src/integrationtest/python/full_smoke_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_full_smoke(self):
2929
test_dir = Path(__file__).parent / "full_smoke"
3030

3131
for k8s_version, istio_version in ((self.K8S_TEST_VERSIONS[0], "1.10.6"),
32-
(self.K8S_TEST_VERSIONS[-1], "1.20.0")):
32+
(self.K8S_TEST_VERSIONS[-1], "1.22.0")):
3333
with self.subTest(k8s_version=k8s_version, istio_version=istio_version):
3434
os.environ["K8S_VERSION"] = k8s_version
3535
os.environ["ISTIO_VERSION"] = istio_version

src/integrationtest/python/issue_23_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_issue_23(self):
2929
test_dir = Path(__file__).parent / "issue_23"
3030

3131
for k8s_version, istio_version in ((self.K8S_TEST_VERSIONS[0], "1.10.6"),
32-
(self.K8S_TEST_VERSIONS[-1], "1.20.0")):
32+
(self.K8S_TEST_VERSIONS[-1], "1.22.0")):
3333
with self.subTest(k8s_version=k8s_version, istio_version=istio_version):
3434
os.environ["K8S_VERSION"] = k8s_version
3535
os.environ["ISTIO_VERSION"] = istio_version

src/integrationtest/python/issue_52_tests.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class Issue52Test(IntegrationTestSupport):
2828
def test_issue_52(self):
2929
test_dir = Path(__file__).parent / "issue_23"
3030

31-
for k8s_version, istio_version in ((self.K8S_TEST_VERSIONS[-2], "1.20.4"),
32-
(self.K8S_TEST_VERSIONS[-1], "1.21.0")):
31+
for k8s_version, istio_version in ((self.K8S_TEST_VERSIONS[-3], "1.20.4"),
32+
(self.K8S_TEST_VERSIONS[-1], "1.22.0")):
3333
with self.subTest(k8s_version=k8s_version, istio_version=istio_version):
3434
os.environ["K8S_VERSION"] = k8s_version
3535
os.environ["ISTIO_VERSION"] = istio_version

src/integrationtest/python/test_support.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
class IntegrationTestSupport(unittest.TestCase):
3535
K8S_TEST_VERSIONS = ["1.20.15", "1.21.14", "1.22.17",
3636
"1.23.17", "1.24.17", "1.25.16",
37-
"1.26.15", "1.27.13", "1.28.9",
38-
"1.29.4"]
37+
"1.26.15", "1.27.14", "1.28.10",
38+
"1.29.5", "1.30.1"]
3939

4040
def load_json_logs(self, log_file):
4141
decoder = json.JSONDecoder()

src/main/python/kubernator/plugins/k8s.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,19 @@ def final_resource_validator(resources: Sequence[K8SResource],
6868
resource, resource.source)
6969

7070

71+
def normalize_pkg_version(v: str):
72+
v_split = v.split(".")
73+
rev = v_split[-1]
74+
if not rev.isdigit():
75+
new_rev = ""
76+
for c in rev:
77+
if not c.isdigit():
78+
break
79+
new_rev += c
80+
v_split[-1] = new_rev
81+
return tuple(map(int, v_split))
82+
83+
7184
class KubernetesPlugin(KubernatorPlugin, K8SResourcePluginMixin):
7285
logger = logger
7386

@@ -193,7 +206,8 @@ def _setup_client(self):
193206
k8s.server_git_version = git_version
194207

195208
logger.info("Found Kubernetes %s on %s", k8s.server_git_version, k8s.client.configuration.host)
196-
K8SResource._k8s_client_version = tuple(map(int, pkg_version("kubernetes").split(".")))
209+
210+
K8SResource._k8s_client_version = normalize_pkg_version(pkg_version("kubernetes"))
197211
K8SResource._k8s_field_validation = k8s.field_validation
198212
K8SResource._k8s_field_validation_patched = not k8s.disable_client_patches
199213
K8SResource._logger = self.logger

src/unittest/python/issue64_tests.py

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Copyright 2020 Express Systems USA, Inc
4+
# Copyright 2024 Karellen, Inc.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
20+
from gevent.monkey import patch_all, is_anything_patched
21+
22+
if not is_anything_patched():
23+
patch_all()
24+
25+
import unittest
26+
from kubernator.plugins.k8s import normalize_pkg_version
27+
28+
29+
class Issue64Testcase(unittest.TestCase):
30+
def test_issue64(self):
31+
self.assertEqual((1, 2, 3), normalize_pkg_version("1.2.3"))
32+
self.assertEqual((1, 2, 3), normalize_pkg_version("1.2.3a1"))

0 commit comments

Comments
 (0)