@@ -18,6 +18,9 @@ func TestExamples(t *testing.T) {
1818
1919 chart := LoadChart (t )
2020
21+ exampleIngress , err := ReadValuesFileAsMap ("../examples/ingress/ingress.values.yaml" )
22+ require .NoError (t , err , "failed to load ingress example values" )
23+
2124 exampleOpenShift , err := ReadValuesFileAsMap ("../examples/openshift/openshift.values.yaml" )
2225 require .NoError (t , err , "failed to load OpenShift example values" )
2326
@@ -29,11 +32,16 @@ func TestExamples(t *testing.T) {
2932 Values map [string ]interface {}
3033 PodSecurityContext * corev1.PodSecurityContext
3134 ContainerSecurityContext * corev1.SecurityContext
32- Postgres * PostgresValues
35+ ServiceType corev1. ServiceType
3336 }{
3437 {
35- Name : "default" ,
36- Values : nil ,
38+ Name : "default" ,
39+ Values : nil ,
40+ ServiceType : corev1 .ServiceTypeLoadBalancer ,
41+ }, {
42+ Name : "ingress" ,
43+ Values : exampleIngress ,
44+ ServiceType : corev1 .ServiceTypeClusterIP ,
3745 }, {
3846 Name : "openshift" ,
3947 Values : exampleOpenShift ,
@@ -56,6 +64,7 @@ func TestExamples(t *testing.T) {
5664 ProcMount : nil ,
5765 SeccompProfile : nil ,
5866 },
67+ ServiceType : corev1 .ServiceTypeClusterIP ,
5968 },
6069 {
6170 Name : "kind" ,
@@ -84,6 +93,7 @@ func TestExamples(t *testing.T) {
8493 LocalhostProfile : nil ,
8594 },
8695 },
96+ ServiceType : corev1 .ServiceTypeClusterIP ,
8797 },
8898 }
8999
@@ -143,6 +153,18 @@ func TestExamples(t *testing.T) {
143153 assert .Equal (t , test .ContainerSecurityContext , coderd .Spec .Template .Spec .Containers [0 ].SecurityContext ,
144154 "expected matching container securityContext" ,
145155 )
156+
157+ service := MustFindService (t , objs , "coderd" )
158+ assert .Equal (t , test .ServiceType , service .Spec .Type , "service type should match" )
159+ switch test .ServiceType {
160+ case corev1 .ServiceTypeLoadBalancer :
161+ assert .Empty (t , service .Spec .ExternalName , "external name should not be set" )
162+ case corev1 .ServiceTypeClusterIP :
163+ assert .Empty (t , service .Spec .ExternalName , "external name should not be set" )
164+ assert .Nil (t , service .Spec .LoadBalancerClass , "loadBalancerClass should not be set" )
165+ assert .Empty (t , service .Spec .LoadBalancerSourceRanges , "loadBalancerSourceRanges should not be set" )
166+ assert .Empty (t , service .Spec .ExternalTrafficPolicy , "externalTrafficPolicy should not be set" )
167+ }
146168 })
147169 }
148170}
0 commit comments