@@ -29,7 +29,6 @@ import io.fabric8.kubernetes.api.model.IntOrString
2929import io.fabric8.kubernetes.client.NamespacedKubernetesClient
3030import io.fabric8.kubernetes.client.internal.readiness.Readiness
3131import kotlinx.coroutines.withTimeout
32- import java.lang.IllegalStateException
3332import kotlin.test.assertEquals
3433import kotlin.test.assertNotEquals
3534import kotlin.test.assertNotNull
@@ -87,10 +86,10 @@ class ShinyProxyTestInstance(private val namespace: String,
8786 assertEquals(" sp-${sp.metadata.name} -ing-${hash} " .take(63 ), ingress.metadata.name)
8887
8988 assertEquals(mapOf (
90- LabelFactory .APP_LABEL to LabelFactory .APP_LABEL_VALUE ,
91- LabelFactory .NAME_LABEL to sp.metadata.name,
92- LabelFactory .INSTANCE_LABEL to hash,
93- LabelFactory .INGRESS_IS_LATEST to isLatest.toString()
89+ LabelFactory .APP_LABEL to LabelFactory .APP_LABEL_VALUE ,
90+ LabelFactory .NAME_LABEL to sp.metadata.name,
91+ LabelFactory .INSTANCE_LABEL to hash,
92+ LabelFactory .INGRESS_IS_LATEST to isLatest.toString()
9493 ), ingress.metadata.labels)
9594
9695 assertEquals(1 , ingress.metadata.ownerReferences.size)
@@ -104,24 +103,24 @@ class ShinyProxyTestInstance(private val namespace: String,
104103 " kubernetes.io/ingress.class" to " skipper" ,
105104 " zalando.org/skipper-predicate" to " True()" ,
106105 " zalando.org/skipper-filter" to
107- """ setRequestHeader("X-ShinyProxy-Instance", "${sp.hashOfCurrentSpec} ")""" +
108- """ -> """ +
109- """ setRequestHeader("X-ShinyProxy-Latest-Instance", "${sp.hashOfCurrentSpec} ")""" +
110- """ -> """ +
111- """ appendResponseHeader("Set-Cookie", "sp-instance=${sp.hashOfCurrentSpec} ; Secure; Path=/")""" +
112- """ -> """ +
113- """ appendResponseHeader("Set-Cookie", "sp-latest-instance=${sp.hashOfCurrentSpec} ; Secure; Path=/")"""
106+ """ setRequestHeader("X-ShinyProxy-Instance", "${sp.hashOfCurrentSpec} ")""" +
107+ """ -> """ +
108+ """ setRequestHeader("X-ShinyProxy-Latest-Instance", "${sp.hashOfCurrentSpec} ")""" +
109+ """ -> """ +
110+ """ appendResponseHeader("Set-Cookie", "sp-instance=${sp.hashOfCurrentSpec} ; Secure; Path=/")""" +
111+ """ -> """ +
112+ """ appendResponseHeader("Set-Cookie", "sp-latest-instance=${sp.hashOfCurrentSpec} ; Secure; Path=/")"""
114113 ), ingress.metadata.annotations)
115114 } else {
116115 assertEquals(mapOf (
117116 " kubernetes.io/ingress.class" to " skipper" ,
118117 " zalando.org/skipper-predicate" to """ True() && Cookie("sp-instance", "$hash ")""" ,
119118 " zalando.org/skipper-filter" to
120- """ setRequestHeader("X-ShinyProxy-Instance", "$hash ")""" +
121- """ -> """ +
122- """ setRequestHeader("X-ShinyProxy-Latest-Instance", "${sp.hashOfCurrentSpec} ")""" +
123- """ -> """ +
124- """ appendResponseHeader("Set-Cookie", "sp-latest-instance=${sp.hashOfCurrentSpec} ; Secure; Path=/")"""
119+ """ setRequestHeader("X-ShinyProxy-Instance", "$hash ")""" +
120+ """ -> """ +
121+ """ setRequestHeader("X-ShinyProxy-Latest-Instance", "${sp.hashOfCurrentSpec} ")""" +
122+ """ -> """ +
123+ """ appendResponseHeader("Set-Cookie", "sp-latest-instance=${sp.hashOfCurrentSpec} ; Secure; Path=/")"""
125124
126125 ), ingress.metadata.annotations)
127126 }
@@ -152,9 +151,9 @@ class ShinyProxyTestInstance(private val namespace: String,
152151 assertEquals(80 , service.spec.ports[0 ].port)
153152 assertEquals(IntOrString (8080 ), service.spec.ports[0 ].targetPort)
154153 assertEquals(mapOf (
155- LabelFactory .APP_LABEL to LabelFactory .APP_LABEL_VALUE ,
156- LabelFactory .NAME_LABEL to sp.metadata.name,
157- LabelFactory .INSTANCE_LABEL to hash
154+ LabelFactory .APP_LABEL to LabelFactory .APP_LABEL_VALUE ,
155+ LabelFactory .NAME_LABEL to sp.metadata.name,
156+ LabelFactory .INSTANCE_LABEL to hash
158157 ), service.spec.selector)
159158
160159 }
@@ -232,9 +231,9 @@ class ShinyProxyTestInstance(private val namespace: String,
232231
233232 fun assertLabelsAreCorrect (resource : HasMetadata , sp : ShinyProxy ) {
234233 assertEquals(mapOf (
235- LabelFactory .APP_LABEL to LabelFactory .APP_LABEL_VALUE ,
236- LabelFactory .NAME_LABEL to sp.metadata.name,
237- LabelFactory .INSTANCE_LABEL to hash
234+ LabelFactory .APP_LABEL to LabelFactory .APP_LABEL_VALUE ,
235+ LabelFactory .NAME_LABEL to sp.metadata.name,
236+ LabelFactory .INSTANCE_LABEL to hash
238237 ), resource.metadata.labels)
239238 }
240239
@@ -256,4 +255,4 @@ class ShinyProxyTestInstance(private val namespace: String,
256255 throw IllegalStateException (" Instance not found" )
257256 }
258257
259- }
258+ }
0 commit comments