Loading assets/auto-deploy-app/test/templates/service_test.go +19 −0 Original line number Diff line number Diff line Loading @@ -22,23 +22,42 @@ func TestServiceTemplate_ServiceType(t *testing.T) { expectedType string expectedPort coreV1.ServicePort expectedErrorRegexp *regexp.Regexp ExpectedAnnotations map[string]string }{ { name: "defaults", expectedType: "ClusterIP", expectedPort: coreV1.ServicePort{Port: 5000, TargetPort: intstr.FromInt(5000), Protocol: "TCP", Name: "web"}, ExpectedAnnotations: nil, }, { name: "with type NodePort but no nodePort value", values: map[string]string{"service.type": "NodePort"}, expectedType: "NodePort", expectedPort: coreV1.ServicePort{Port: 5000, TargetPort: intstr.FromInt(5000), NodePort: 0, Protocol: "TCP", Name: "web"}, ExpectedAnnotations: nil, }, { name: "with type NodePort and nodePort set", values: map[string]string{"service.type": "NodePort", "service.nodePort": "12345"}, expectedType: "NodePort", expectedPort: coreV1.ServicePort{Port: 5000, TargetPort: intstr.FromInt(5000), NodePort: 12345, Protocol: "TCP", Name: "web"}, ExpectedAnnotations: nil, }, { name: "with type NodePort and nodePort set", values: map[string]string{ "service.type": "NodePort", "service.nodePort": "12345", "service.annotations.key1": "value1", "service.annotations.key2": "value2", }, expectedType: "NodePort", expectedPort: coreV1.ServicePort{Port: 5000, TargetPort: intstr.FromInt(5000), NodePort: 12345, Protocol: "TCP", Name: "web"}, ExpectedAnnotations: map[string]string{ "key1": "value1", "key2": "value2", }, }, } Loading Loading
assets/auto-deploy-app/test/templates/service_test.go +19 −0 Original line number Diff line number Diff line Loading @@ -22,23 +22,42 @@ func TestServiceTemplate_ServiceType(t *testing.T) { expectedType string expectedPort coreV1.ServicePort expectedErrorRegexp *regexp.Regexp ExpectedAnnotations map[string]string }{ { name: "defaults", expectedType: "ClusterIP", expectedPort: coreV1.ServicePort{Port: 5000, TargetPort: intstr.FromInt(5000), Protocol: "TCP", Name: "web"}, ExpectedAnnotations: nil, }, { name: "with type NodePort but no nodePort value", values: map[string]string{"service.type": "NodePort"}, expectedType: "NodePort", expectedPort: coreV1.ServicePort{Port: 5000, TargetPort: intstr.FromInt(5000), NodePort: 0, Protocol: "TCP", Name: "web"}, ExpectedAnnotations: nil, }, { name: "with type NodePort and nodePort set", values: map[string]string{"service.type": "NodePort", "service.nodePort": "12345"}, expectedType: "NodePort", expectedPort: coreV1.ServicePort{Port: 5000, TargetPort: intstr.FromInt(5000), NodePort: 12345, Protocol: "TCP", Name: "web"}, ExpectedAnnotations: nil, }, { name: "with type NodePort and nodePort set", values: map[string]string{ "service.type": "NodePort", "service.nodePort": "12345", "service.annotations.key1": "value1", "service.annotations.key2": "value2", }, expectedType: "NodePort", expectedPort: coreV1.ServicePort{Port: 5000, TargetPort: intstr.FromInt(5000), NodePort: 12345, Protocol: "TCP", Name: "web"}, ExpectedAnnotations: map[string]string{ "key1": "value1", "key2": "value2", }, }, } Loading