Stop miniredis after each test

This commit is contained in:
Joel Speed 2019-05-16 17:32:54 +01:00 committed by Brian Van Klaveren
parent bc3d75a2ed
commit 7e7bfb5daf

View File

@ -306,15 +306,19 @@ var _ = Describe("NewSessionStore", func() {
}) })
Context("with type 'redis'", func() { Context("with type 'redis'", func() {
var mr *miniredis.Miniredis
BeforeEach(func() { BeforeEach(func() {
mr, err := miniredis.Run() var err error
if err != nil { mr, err = miniredis.Run()
panic(err) Expect(err).ToNot(HaveOccurred())
}
opts.Type = options.RedisSessionStoreType opts.Type = options.RedisSessionStoreType
opts.RedisConnectionURL = "redis://" + mr.Addr() opts.RedisConnectionURL = "redis://" + mr.Addr()
}) })
AfterEach(func() {
mr.Close()
})
It("creates a redis.SessionStore", func() { It("creates a redis.SessionStore", func() {
ss, err := sessions.NewSessionStore(opts, cookieOpts) ss, err := sessions.NewSessionStore(opts, cookieOpts)
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())