@@ -257,7 +257,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
257
257
258
258
var appTokenCookie * http.Cookie
259
259
for _ , c := range resp .Cookies () {
260
- if c .Name == codersdk .DevURLSignedAppTokenCookie {
260
+ if c .Name == codersdk .SignedAppTokenCookie {
261
261
appTokenCookie = c
262
262
break
263
263
}
@@ -302,7 +302,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
302
302
303
303
var appTokenCookie * http.Cookie
304
304
for _ , c := range resp .Cookies () {
305
- if c .Name == codersdk .DevURLSignedAppTokenCookie {
305
+ if c .Name == codersdk .SignedAppTokenCookie {
306
306
appTokenCookie = c
307
307
break
308
308
}
@@ -400,30 +400,19 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
400
400
appDetails := setupProxyTest (t , nil )
401
401
402
402
cases := []struct {
403
- name string
404
- appURL * url.URL
405
- verifyCookie func ( t * testing. T , c * http. Cookie )
403
+ name string
404
+ appURL * url.URL
405
+ sessionTokenCookieName string
406
406
}{
407
407
{
408
- name : "Subdomain" ,
409
- appURL : appDetails .SubdomainAppURL (appDetails .Apps .Owner ),
410
- verifyCookie : func (t * testing.T , c * http.Cookie ) {
411
- // TODO(@dean): fix these asserts, they don't seem to
412
- // work. I wonder if Go strips the domain from the
413
- // cookie object if it's invalid or something.
414
- // domain := strings.SplitN(appDetails.Options.AppHost, ".", 2)
415
- // require.Equal(t, "."+domain[1], c.Domain, "incorrect domain on app token cookie")
416
- },
408
+ name : "Subdomain" ,
409
+ appURL : appDetails .SubdomainAppURL (appDetails .Apps .Owner ),
410
+ sessionTokenCookieName : codersdk .SubdomainAppSessionTokenCookie ,
417
411
},
418
412
{
419
- name : "Path" ,
420
- appURL : appDetails .PathAppURL (appDetails .Apps .Owner ),
421
- verifyCookie : func (t * testing.T , c * http.Cookie ) {
422
- // TODO(@dean): fix these asserts, they don't seem to
423
- // work. I wonder if Go strips the domain from the
424
- // cookie object if it's invalid or something.
425
- // require.Equal(t, "", c.Domain, "incorrect domain on app token cookie")
426
- },
413
+ name : "Path" ,
414
+ appURL : appDetails .PathAppURL (appDetails .Apps .Owner ),
415
+ sessionTokenCookieName : codersdk .PathAppSessionTokenCookie ,
427
416
},
428
417
}
429
418
@@ -508,14 +497,13 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
508
497
509
498
cookies := resp .Cookies ()
510
499
var cookie * http.Cookie
511
- for _ , c := range cookies {
512
- if c .Name == codersdk . DevURLSessionTokenCookie {
513
- cookie = c
500
+ for _ , co := range cookies {
501
+ if co .Name == c . sessionTokenCookieName {
502
+ cookie = co
514
503
break
515
504
}
516
505
}
517
506
require .NotNil (t , cookie , "no app session token cookie was set" )
518
- c .verifyCookie (t , cookie )
519
507
apiKey := cookie .Value
520
508
521
509
// Fetch the API key from the API.
@@ -715,7 +703,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
715
703
716
704
var appTokenCookie * http.Cookie
717
705
for _ , c := range resp .Cookies () {
718
- if c .Name == codersdk .DevURLSignedAppTokenCookie {
706
+ if c .Name == codersdk .SignedAppTokenCookie {
719
707
appTokenCookie = c
720
708
break
721
709
}
@@ -759,7 +747,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
759
747
760
748
var appTokenCookie * http.Cookie
761
749
for _ , c := range resp .Cookies () {
762
- if c .Name == codersdk .DevURLSignedAppTokenCookie {
750
+ if c .Name == codersdk .SignedAppTokenCookie {
763
751
appTokenCookie = c
764
752
break
765
753
}
0 commit comments