Skip to content

Commit

Permalink
Relax pool test conditions.
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed Jan 31, 2015
1 parent b408dc2 commit 689f061
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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() {
Expand All @@ -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() {
Expand All @@ -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() {
Expand All @@ -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() {
Expand All @@ -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))
})

})

0 comments on commit 689f061

Please sign in to comment.