@@ -18,6 +18,8 @@ import (
1818 . "github.com/onsi/gomega"
1919)
2020
21+const redisPassword = "0123456789abcdefghijklmnopqrstuv"
22+
2123func TestSessionStore(t *testing.T) {
2224 logger.SetOutput(GinkgoWriter)
2325
@@ -127,4 +129,87 @@ var _ = Describe("Redis SessionStore Tests", func() {
127129 },
128130 )
129131 })
132+
133+ Context("with a redis password", func() {
134+ BeforeEach(func() {
135+ mr.RequireAuth(redisPassword)
136+ })
137+
138+ AfterEach(func() {
139+ mr.RequireAuth("")
140+ })
141+
142+ tests.RunSessionStoreTests(
143+ func(opts *options.SessionOptions, cookieOpts *options.Cookie) (sessionsapi.SessionStore, error) {
144+ // Set the connection URL
145+ opts.Type = options.RedisSessionStoreType
146+ opts.Redis.ConnectionURL = "redis://" + mr.Addr()
147+ opts.Redis.Password = redisPassword
148+
149+ // Capture the session store so that we can close the client
150+ var err error
151+ ss, err = NewRedisSessionStore(opts, cookieOpts)
152+ return ss, err
153+ },
154+ func(d time.Duration) error {
155+ mr.FastForward(d)
156+ return nil
157+ },
158+ )
159+
160+ Context("with sentinel", func() {
161+ var ms *minisentinel.Sentinel
162+
163+ BeforeEach(func() {
164+ ms = minisentinel.NewSentinel(mr)
165+ Expect(ms.Start()).To(Succeed())
166+ })
167+
168+ AfterEach(func() {
169+ ms.Close()
170+ })
171+
172+ tests.RunSessionStoreTests(
173+ func(opts *options.SessionOptions, cookieOpts *options.Cookie) (sessionsapi.SessionStore, error) {
174+ // Set the sentinel connection URL
175+ sentinelAddr := "redis://" + ms.Addr()
176+ opts.Type = options.RedisSessionStoreType
177+ opts.Redis.SentinelConnectionURLs = []string{sentinelAddr}
178+ opts.Redis.UseSentinel = true
179+ opts.Redis.SentinelMasterName = ms.MasterInfo().Name
180+ opts.Redis.Password = redisPassword
181+
182+ // Capture the session store so that we can close the client
183+ var err error
184+ ss, err = NewRedisSessionStore(opts, cookieOpts)
185+ return ss, err
186+ },
187+ func(d time.Duration) error {
188+ mr.FastForward(d)
189+ return nil
190+ },
191+ )
192+ })
193+
194+ Context("with cluster", func() {
195+ tests.RunSessionStoreTests(
196+ func(opts *options.SessionOptions, cookieOpts *options.Cookie) (sessionsapi.SessionStore, error) {
197+ clusterAddr := "redis://" + mr.Addr()
198+ opts.Type = options.RedisSessionStoreType
199+ opts.Redis.ClusterConnectionURLs = []string{clusterAddr}
200+ opts.Redis.UseCluster = true
201+ opts.Redis.Password = redisPassword
202+
203+ // Capture the session store so that we can close the client
204+ var err error
205+ ss, err = NewRedisSessionStore(opts, cookieOpts)
206+ return ss, err
207+ },
208+ func(d time.Duration) error {
209+ mr.FastForward(d)
210+ return nil
211+ },
212+ )
213+ })
214+ })
130215})