@@ -417,6 +417,19 @@ var _ = Describe("NewSessionStore", func() {
417417 Context("the cookie.SessionStore", func() {
418418 RunSessionTests(false)
419419 })
420+
421+ Context("with an invalid cookie secret", func() {
422+ BeforeEach(func() {
423+ cookieOpts.Secret = "invalid"
424+ })
425+
426+ It("returns an error", func() {
427+ ss, err := sessions.NewSessionStore(opts, cookieOpts)
428+ Expect(err).To(HaveOccurred())
429+ Expect(err.Error()).To(Equal("error initialising cipher: crypto/aes: invalid key size 7"))
430+ Expect(ss).To(BeNil())
431+ })
432+ })
420433 })
421434
422435 Context("with type 'redis'", func() {
@@ -441,30 +454,30 @@ var _ = Describe("NewSessionStore", func() {
441454 Context("the redis.SessionStore", func() {
442455 RunSessionTests(true)
443456 })
444− })
445457
446− Context("with an invalid type", func() {
447− BeforeEach(func() {
448− opts.Type = "invalid-type"
449− })
458+ Context("with an invalid cookie secret", func() {
459+ BeforeEach(func() {
460+ cookieOpts.Secret = "invalid"
461+ })
450462
451− It("returns an error", func() {
452− ss, err := sessions.NewSessionStore(opts, cookieOpts)
453− Expect(err).To(HaveOccurred())
454− Expect(err.Error()).To(Equal("unknown session store type 'invalid-type'"))
455− Expect(ss).To(BeNil())
463+ It("returns an error", func() {
464+ ss, err := sessions.NewSessionStore(opts, cookieOpts)
465+ Expect(err).To(HaveOccurred())
466+ Expect(err.Error()).To(Equal("error initialising cipher: crypto/aes: invalid key size 7"))
467+ Expect(ss).To(BeNil())
468+ })
456469 })
457470 })
458471
459− Context("with an invalid cookie secret", func() {
472+ Context("with an invalid type", func() {
460473 BeforeEach(func() {
461− cookieOpts.Secret = "invalid"
474+ opts.Type = "invalid-type"
462475 })
463476
464477 It("returns an error", func() {
465478 ss, err := sessions.NewSessionStore(opts, cookieOpts)
466479 Expect(err).To(HaveOccurred())
467− Expect(err.Error()).To(Equal("error initialising cipher: crypto/aes: invalid key size 7"))
480+ Expect(err.Error()).To(Equal("unknown session store type 'invalid-type'"))
468481 Expect(ss).To(BeNil())
469482 })
470483 })