Relax pool test conditions.

This commit is contained in:
Vladimir Mihailenco 2015-01-31 09:53:08 +02:00
parent b408dc24aa
commit 689f061943
1 changed files with 18 additions and 10 deletions

View File

@ -39,6 +39,7 @@ var _ = Describe("Pool", func() {
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
Expect(val).To(Equal("PONG")) Expect(val).To(Equal("PONG"))
}) })
pool := client.Pool() pool := client.Pool()
Expect(pool.Size()).To(BeNumerically("<=", 10)) Expect(pool.Size()).To(BeNumerically("<=", 10))
Expect(pool.Len()).To(BeNumerically("<=", 10)) Expect(pool.Len()).To(BeNumerically("<=", 10))
@ -61,8 +62,10 @@ var _ = Describe("Pool", func() {
Expect(multi.Close()).NotTo(HaveOccurred()) Expect(multi.Close()).NotTo(HaveOccurred())
}) })
Expect(client.Pool().Size()).To(Equal(10)) pool := client.Pool()
Expect(client.Pool().Len()).To(Equal(10)) Expect(pool.Size()).To(BeNumerically("<=", 10))
Expect(pool.Len()).To(BeNumerically("<=", 10))
Expect(pool.Size()).To(Equal(pool.Len()))
}) })
It("should respect max on pipelines", func() { It("should respect max on pipelines", func() {
@ -77,8 +80,10 @@ var _ = Describe("Pool", func() {
Expect(pipe.Close()).NotTo(HaveOccurred()) Expect(pipe.Close()).NotTo(HaveOccurred())
}) })
Expect(client.Pool().Size()).To(Equal(10)) pool := client.Pool()
Expect(client.Pool().Len()).To(Equal(10)) Expect(pool.Size()).To(BeNumerically("<=", 10))
Expect(pool.Len()).To(BeNumerically("<=", 10))
Expect(pool.Size()).To(Equal(pool.Len()))
}) })
It("should respect max on pubsub", func() { It("should respect max on pubsub", func() {
@ -88,8 +93,9 @@ var _ = Describe("Pool", func() {
Expect(pubsub.Close()).NotTo(HaveOccurred()) Expect(pubsub.Close()).NotTo(HaveOccurred())
}) })
Expect(client.Pool().Size()).To(Equal(0)) pool := client.Pool()
Expect(client.Pool().Len()).To(Equal(0)) Expect(pool.Size()).To(Equal(0))
Expect(pool.Len()).To(Equal(0))
}) })
It("should remove broken connections", func() { It("should remove broken connections", func() {
@ -106,8 +112,9 @@ var _ = Describe("Pool", func() {
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
Expect(val).To(Equal("PONG")) Expect(val).To(Equal("PONG"))
Expect(client.Pool().Size()).To(Equal(1)) pool := client.Pool()
Expect(client.Pool().Len()).To(Equal(1)) Expect(pool.Size()).To(Equal(1))
Expect(pool.Len()).To(Equal(1))
}) })
It("should reuse connections", func() { It("should reuse connections", func() {
@ -117,8 +124,9 @@ var _ = Describe("Pool", func() {
Expect(val).To(Equal("PONG")) Expect(val).To(Equal("PONG"))
} }
Expect(client.Pool().Size()).To(Equal(1)) pool := client.Pool()
Expect(client.Pool().Len()).To(Equal(1)) Expect(pool.Size()).To(Equal(1))
Expect(pool.Len()).To(Equal(1))
}) })
}) })