@@ -96,8 +96,14 @@ func TestGatewayAPIV1Beta1Router_Routes(t *testing.T) {
96
96
cookieKey := "flagger-cookie"
97
97
// enable session affinity and start canary run
98
98
canary .Spec .Analysis .SessionAffinity = & flaggerv1.SessionAffinity {
99
- CookieName : cookieKey ,
100
- MaxAge : 300 ,
99
+ CookieName : cookieKey ,
100
+ Domain : "flagger.app" ,
101
+ HttpOnly : true ,
102
+ MaxAge : 300 ,
103
+ Partitioned : true ,
104
+ Path : "/app" ,
105
+ SameSite : "Strict" ,
106
+ Secure : true ,
101
107
}
102
108
_ , pSvcName , cSvcName := canary .GetServiceNames ()
103
109
@@ -133,10 +139,18 @@ func TestGatewayAPIV1Beta1Router_Routes(t *testing.T) {
133
139
if string (backendRef .Name ) == cSvcName {
134
140
found = true
135
141
filter := backendRef .Filters [0 ]
142
+ val := filter .ResponseHeaderModifier .Add [0 ].Value
136
143
assert .Equal (t , filter .Type , v1beta1 .HTTPRouteFilterResponseHeaderModifier )
137
144
assert .NotNil (t , filter .ResponseHeaderModifier )
138
145
assert .Equal (t , string (filter .ResponseHeaderModifier .Add [0 ].Name ), setCookieHeader )
139
- assert .Equal (t , filter .ResponseHeaderModifier .Add [0 ].Value , fmt .Sprintf ("%s; %s=%d" , canary .Status .SessionAffinityCookie , maxAgeAttr , 300 ))
146
+ assert .True (t , strings .HasPrefix (val , cookieKey ))
147
+ assert .True (t , strings .Contains (val , "Domain=flagger.app" ))
148
+ assert .True (t , strings .Contains (val , "HttpOnly" ))
149
+ assert .True (t , strings .Contains (val , "Max-Age=300" ))
150
+ assert .True (t , strings .Contains (val , "Partitioned" ))
151
+ assert .True (t , strings .Contains (val , "Path=/app" ))
152
+ assert .True (t , strings .Contains (val , "SameSite=Strict" ))
153
+ assert .True (t , strings .Contains (val , "Secure" ))
140
154
assert .Equal (t , * backendRef .Weight , int32 (10 ))
141
155
}
142
156
if string (backendRef .Name ) == pSvcName {
@@ -189,10 +203,18 @@ func TestGatewayAPIV1Beta1Router_Routes(t *testing.T) {
189
203
if string (backendRef .Name ) == cSvcName {
190
204
found = true
191
205
filter := backendRef .Filters [0 ]
206
+ val := filter .ResponseHeaderModifier .Add [0 ].Value
192
207
assert .Equal (t , filter .Type , v1beta1 .HTTPRouteFilterResponseHeaderModifier )
193
208
assert .NotNil (t , filter .ResponseHeaderModifier )
194
209
assert .Equal (t , string (filter .ResponseHeaderModifier .Add [0 ].Name ), setCookieHeader )
195
- assert .Equal (t , filter .ResponseHeaderModifier .Add [0 ].Value , fmt .Sprintf ("%s; %s=%d" , canary .Status .SessionAffinityCookie , maxAgeAttr , 300 ))
210
+ assert .True (t , strings .HasPrefix (val , cookieKey ))
211
+ assert .True (t , strings .Contains (val , "Domain=flagger.app" ))
212
+ assert .True (t , strings .Contains (val , "HttpOnly" ))
213
+ assert .True (t , strings .Contains (val , "Max-Age=300" ))
214
+ assert .True (t , strings .Contains (val , "Partitioned" ))
215
+ assert .True (t , strings .Contains (val , "Path=/app" ))
216
+ assert .True (t , strings .Contains (val , "SameSite=Strict" ))
217
+ assert .True (t , strings .Contains (val , "Secure" ))
196
218
197
219
assert .Equal (t , * backendRef .Weight , int32 (50 ))
198
220
}
0 commit comments