Merge pull request #68 from go-redis/fix/relax-pool-test-conditions

Relax pool test conditions.
This commit is contained in:
Vladimir Mihailenco 2015-01-31 10:10:46 +02:00
commit c66f542b4f
1 changed files with 18 additions and 10 deletions

View File

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