From 8c048a346d6ba077159ac2e4e1c643dad74b5fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Goinvic?= Date: Tue, 5 May 2026 19:02:31 +0000 Subject: [PATCH] Fix helm validator unit tests --- .../newsfragments/1280.misc.md | 1 + .../tests/test_helm_validation.py | 33 +++++++++++++++---- 2 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 packages/ess-migration-tool/newsfragments/1280.misc.md diff --git a/packages/ess-migration-tool/newsfragments/1280.misc.md b/packages/ess-migration-tool/newsfragments/1280.misc.md new file mode 100644 index 00000000..11354d37 --- /dev/null +++ b/packages/ess-migration-tool/newsfragments/1280.misc.md @@ -0,0 +1 @@ +Tests: Fix the tests validating the helm validator fixture. \ No newline at end of file diff --git a/packages/ess-migration-tool/tests/test_helm_validation.py b/packages/ess-migration-tool/tests/test_helm_validation.py index bb2b1240..f997ffe9 100644 --- a/packages/ess-migration-tool/tests/test_helm_validation.py +++ b/packages/ess-migration-tool/tests/test_helm_validation.py @@ -12,20 +12,40 @@ Validates that the Helm validation utilities work correctly. def test_helm_validation_success_case(helm_validator): """Test that valid values pass Helm validation.""" # Basic valid values that should pass Helm template validation + # Note: Must include required fields for helm template to succeed values = { + "serverName": "test.example.com", "synapse": { - "enabled": True, - "serverName": "test.example.com", + "ingress": { + "host": "synapse.test.example.com", + }, }, - "postgres": { - "enabled": True, + "elementWeb": { + "ingress": { + "host": "element.test.example.com", + }, + }, + "matrixAuthenticationService": { + "ingress": { + "host": "mas.test.example.com", + }, + }, + "matrixRTC": { + "ingress": { + "host": "rtc.test.example.com", + }, + }, + "elementAdmin": { + "ingress": { + "host": "admin.test.example.com", + }, }, } success, message = helm_validator(values) # Should succeed (or fail with a meaningful error if chart is missing) - assert success or "chart" in message.lower(), f"Valid values should pass validation: {message}" + assert success, f"Valid values should pass validation: {message}" def test_helm_validation_failure_case(helm_validator): @@ -38,4 +58,5 @@ def test_helm_validation_failure_case(helm_validator): success, message = helm_validator(values) # Should fail (unless chart is missing, in which case it might pass due to early error) - assert not success or "chart" in message.lower(), "Invalid values should fail validation" + assert not success + assert "don't meet the specifications" in message.lower()