@@ -257,7 +257,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
257257
258258 var appTokenCookie * http.Cookie
259259 for _ , c := range resp .Cookies () {
260- if c .Name == codersdk .DevURLSignedAppTokenCookie {
260+ if c .Name == codersdk .SignedAppTokenCookie {
261261 appTokenCookie = c
262262 break
263263 }
@@ -302,7 +302,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
302302
303303 var appTokenCookie * http.Cookie
304304 for _ , c := range resp .Cookies () {
305- if c .Name == codersdk .DevURLSignedAppTokenCookie {
305+ if c .Name == codersdk .SignedAppTokenCookie {
306306 appTokenCookie = c
307307 break
308308 }
@@ -400,30 +400,19 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
400400 appDetails := setupProxyTest (t , nil )
401401
402402 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
406406 }{
407407 {
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 ,
417411 },
418412 {
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 ,
427416 },
428417 }
429418
@@ -508,14 +497,13 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
508497
509498 cookies := resp .Cookies ()
510499 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
514503 break
515504 }
516505 }
517506 require .NotNil (t , cookie , "no app session token cookie was set" )
518- c .verifyCookie (t , cookie )
519507 apiKey := cookie .Value
520508
521509 // Fetch the API key from the API.
@@ -715,7 +703,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
715703
716704 var appTokenCookie * http.Cookie
717705 for _ , c := range resp .Cookies () {
718- if c .Name == codersdk .DevURLSignedAppTokenCookie {
706+ if c .Name == codersdk .SignedAppTokenCookie {
719707 appTokenCookie = c
720708 break
721709 }
@@ -759,7 +747,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
759747
760748 var appTokenCookie * http.Cookie
761749 for _ , c := range resp .Cookies () {
762- if c .Name == codersdk .DevURLSignedAppTokenCookie {
750+ if c .Name == codersdk .SignedAppTokenCookie {
763751 appTokenCookie = c
764752 break
765753 }
0 commit comments