From acb4b6238a7be56205c5edf2c9761afbd56f0da1 Mon Sep 17 00:00:00 2001 From: Eugene Maslovich Date: Thu, 4 Dec 2025 18:15:21 +0300 Subject: [PATCH] test: add tests for service template Add more tests for service template Signed-off-by: Eugene Maslovich --- valkey/tests/service_test.yaml | 57 ++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/valkey/tests/service_test.yaml b/valkey/tests/service_test.yaml index b0acd00..7e4e919 100644 --- a/valkey/tests/service_test.yaml +++ b/valkey/tests/service_test.yaml @@ -2,6 +2,55 @@ suite: service configuration templates: - templates/service.yaml tests: + - it: should have correct default service type + template: templates/service.yaml + asserts: + - isKind: + of: Service + - equal: + path: spec.type + value: ClusterIP + - it: should be able to set custom clusterIP + set: + service.clusterIP: "10.0.0.1" + template: templates/service.yaml + asserts: + - isKind: + of: Service + - equal: + path: spec.clusterIP + value: "10.0.0.1" + - it: should have correct default ports + template: templates/service.yaml + asserts: + - contains: + path: spec.ports + content: + port: 6379 + targetPort: tcp + protocol: TCP + name: tcp + - it: should be able to set custom nodePort + set: + service.type: "NodePort" + service.nodePort: 30080 + template: templates/service.yaml + asserts: + - isKind: + of: Service + - equal: + path: spec.ports[0].nodePort + value: 30080 + - it: should be able to set custom appProtocol + set: + service.appProtocol: "my-protocol" + template: templates/service.yaml + asserts: + - isKind: + of: Service + - equal: + path: spec.ports[0].appProtocol + value: "my-protocol" - it: should be able to set custom loadBalancerClass set: service.loadBalancerClass: "custom-lb-class" @@ -19,3 +68,11 @@ tests: of: Service - notExists: path: spec.loadBalancerClass + - it: should have correct selector labels + template: templates/service.yaml + asserts: + - isSubset: + path: spec.selector + content: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/name: valkey