Skip to content

Commit

Permalink
Merge pull request redis#465 from smacker/wrap-process-broken
Browse files Browse the repository at this point in the history
 WrapProcess is broken in v5
  • Loading branch information
vmihailenco authored Dec 30, 2016
2 parents 40594f7 + 362efb0 commit 57efac6
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions example_instrumentation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import (
"sync/atomic"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

redis "gopkg.in/redis.v5"
)

Expand Down Expand Up @@ -57,3 +60,35 @@ func wrapRedisProcess(client *redis.Client) {
}
})
}

var _ = Describe("Instrumentation", func() {
var client *redis.Client

BeforeEach(func() {
client = redis.NewClient(redisOptions())
Expect(client.FlushDb().Err()).NotTo(HaveOccurred())
})

AfterEach(func() {
Expect(client.Close()).NotTo(HaveOccurred())
})

Describe("WrapProcess", func() {

It("should call for client", func() {
wrapperFnCalled := false

client.WrapProcess(func(oldProcess func(redis.Cmder) error) func(redis.Cmder) error {
return func(cmd redis.Cmder) error {
wrapperFnCalled = true
return oldProcess(cmd)
}
})

client.Ping()

Expect(wrapperFnCalled).To(Equal(true))
})

})
})

0 comments on commit 57efac6

Please sign in to comment.