@@ -87,7 +87,7 @@ var _ = Describe("Cookie Tests", func() {
87 opts options.Cookie
87 opts options.Cookie
88 expiration time.Duration
88 expiration time.Duration
89 now time.Time
89 now time.Time
90− expectedOutput time.Time
90+ expectedOutput int
93 validName := "_oauth2_proxy"
93 validName := "_oauth2_proxy"
@@ -95,7 +95,7 @@ var _ = Describe("Cookie Tests", func() {
95 domains := []string{"www.cookies.test"}
95 domains := []string{"www.cookies.test"}
97 now := time.Now()
97 now := time.Now()
98− var expectedExpires time.Time
98+ var expectedMaxAge int
100 DescribeTable("should return cookies with or without expiration",
100 DescribeTable("should return cookies with or without expiration",
101 func(in makeCookieFromOptionsTableInput) {
101 func(in makeCookieFromOptionsTableInput) {
@@ -106,7 +106,7 @@ var _ = Describe("Cookie Tests", func() {
107 Expect(err).ToNot(HaveOccurred())
107 Expect(err).ToNot(HaveOccurred())
109− Expect(MakeCookieFromOptions(req, in.name, in.value, &in.opts, in.expiration, in.now).Expires).To(Equal(in.expectedOutput))
109+ Expect(MakeCookieFromOptions(req, in.name, in.value, &in.opts, in.expiration).MaxAge).To(Equal(in.expectedOutput))
111 Entry("persistent cookie", makeCookieFromOptionsTableInput{
111 Entry("persistent cookie", makeCookieFromOptionsTableInput{
112 host: "www.cookies.test",
112 host: "www.cookies.test",
@@ -125,7 +125,26 @@ var _ = Describe("Cookie Tests", func() {
126 expiration: 15 * time.Minute,
126 expiration: 15 * time.Minute,
127 now: now,
127 now: now,
128− expectedOutput: now.Add(15 * time.Minute),
128+ expectedOutput: int((15 * time.Minute).Seconds()),
130+ Entry("persistent cookie to be cleared", makeCookieFromOptionsTableInput{
131+ host: "www.cookies.test",
134+ opts: options.Cookie{
136+ Secret: validSecret,
139+ Expire: time.Hour * -1,
140+ Refresh: 15 * time.Minute,
145+ expiration: time.Hour * -1,
130 Entry("session cookie", makeCookieFromOptionsTableInput{
149 Entry("session cookie", makeCookieFromOptionsTableInput{
131 host: "www.cookies.test",
150 host: "www.cookies.test",
@@ -144,7 +163,7 @@ var _ = Describe("Cookie Tests", func() {
145 expiration: 0,
164 expiration: 0,
146 now: now,
165 now: now,
147− expectedOutput: expectedExpires,
166+ expectedOutput: expectedMaxAge,