Skip to content

Commit

Permalink
test_nginx_ingress
Browse files Browse the repository at this point in the history
  • Loading branch information
niam0522 committed Aug 21, 2024
1 parent 539c1cb commit b8212c4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions test/unit/plugins/test_nginx_ingress.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from kubemarine.core import errors, flow
from kubemarine.plugins.manifest import Manifest, Identity
from kubemarine.procedures import add_node, remove_node

from distutils.version import LooseVersion

class EnrichmentValidation(unittest.TestCase):
def install(self):
Expand Down Expand Up @@ -197,11 +197,12 @@ def test_webhook_resources_difference(self):
manifest = self.enrich_yaml(cluster)
webhook_resources = 0

# Check if nginx-ingress-controller version is v1.9.5 or v1.9.6 before counting webhook resources
# Check if nginx-ingress-controller version is v1.9.5 or higher before counting webhook resources
nginx_version = self.get_obj(manifest, "DaemonSet_ingress-nginx-controller")\
['spec']['template']['spec']['containers'][0]['image']
if "v1.9.5" in nginx_version or "v1.9.6" in nginx_version or "v1.10.1" in nginx_version or "v1.11.1" in nginx_version:
expected_num_resources = 9 # Adjust expected number for v1.9.5 and v1.9.6 and v1.11.1
['spec']['template']['spec']['containers'][0]['image'].split(":")[-1]

if LooseVersion(nginx_version) >= LooseVersion("v1.9.5"):
expected_num_resources = 9 # Adjust expected number for v1.9.5 and higher

for key in self.all_obj_keys(manifest):
if 'admission' in key:
Expand Down

0 comments on commit b8212c4

Please sign in to comment.