@@ -190,8 +190,14 @@ func TestIstioRouter_SetRoutes(t *testing.T) {
190
190
cookieKey := "flagger-cookie"
191
191
// enable session affinity and start canary run
192
192
canary .Spec .Analysis .SessionAffinity = & v1beta1.SessionAffinity {
193
- CookieName : cookieKey ,
194
- MaxAge : 300 ,
193
+ CookieName : cookieKey ,
194
+ Domain : "flagger.app" ,
195
+ HttpOnly : true ,
196
+ MaxAge : 300 ,
197
+ Partitioned : true ,
198
+ Path : "/app" ,
199
+ SameSite : "Strict" ,
200
+ Secure : true ,
195
201
}
196
202
err := router .SetRoutes (canary , 0 , 10 , false )
197
203
@@ -231,7 +237,13 @@ func TestIstioRouter_SetRoutes(t *testing.T) {
231
237
val , ok := routeDest .Headers .Response .Add [setCookieHeader ]
232
238
assert .True (t , ok )
233
239
assert .True (t , strings .HasPrefix (val , cookieKey ))
240
+ assert .True (t , strings .Contains (val , "Domain=flagger.app" ))
241
+ assert .True (t , strings .Contains (val , "HttpOnly" ))
234
242
assert .True (t , strings .Contains (val , "Max-Age=300" ))
243
+ assert .True (t , strings .Contains (val , "Partitioned" ))
244
+ assert .True (t , strings .Contains (val , "Path=/app" ))
245
+ assert .True (t , strings .Contains (val , "SameSite=Strict" ))
246
+ assert .True (t , strings .Contains (val , "Secure" ))
235
247
}
236
248
}
237
249
assert .True (t , strings .HasPrefix (canary .Status .SessionAffinityCookie , cookieKey ))
@@ -286,7 +298,13 @@ func TestIstioRouter_SetRoutes(t *testing.T) {
286
298
val , ok := routeDest .Headers .Response .Add [setCookieHeader ]
287
299
assert .True (t , ok )
288
300
assert .True (t , strings .HasPrefix (val , cookieKey ))
301
+ assert .True (t , strings .Contains (val , "Domain=flagger.app" ))
302
+ assert .True (t , strings .Contains (val , "HttpOnly" ))
289
303
assert .True (t , strings .Contains (val , "Max-Age=300" ))
304
+ assert .True (t , strings .Contains (val , "Partitioned" ))
305
+ assert .True (t , strings .Contains (val , "Path=/app" ))
306
+ assert .True (t , strings .Contains (val , "SameSite=Strict" ))
307
+ assert .True (t , strings .Contains (val , "Secure" ))
290
308
}
291
309
}
292
310
assert .True (t , strings .HasPrefix (canary .Status .SessionAffinityCookie , cookieKey ))
0 commit comments