mirror of
https://github.com/redis/go-redis.git
synced 2025-07-26 19:21:03 +03:00
Tweak transaction API.
This commit is contained in:
@ -65,16 +65,15 @@ var _ = Describe("Client", func() {
|
||||
Expect(client.Ping().Err()).NotTo(HaveOccurred())
|
||||
})
|
||||
|
||||
It("should close multi without closing the client", func() {
|
||||
tx, err := client.Watch()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(tx.Close()).NotTo(HaveOccurred())
|
||||
|
||||
_, err = tx.Exec(func() error {
|
||||
tx.Ping()
|
||||
return nil
|
||||
It("should close Tx without closing the client", func() {
|
||||
err := client.Watch(func(tx *redis.Tx) error {
|
||||
_, err := tx.MultiExec(func() error {
|
||||
tx.Ping()
|
||||
return nil
|
||||
})
|
||||
return err
|
||||
})
|
||||
Expect(err).To(MatchError("redis: client is closed"))
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(client.Ping().Err()).NotTo(HaveOccurred())
|
||||
})
|
||||
@ -96,13 +95,6 @@ var _ = Describe("Client", func() {
|
||||
Expect(pubsub.Close()).NotTo(HaveOccurred())
|
||||
})
|
||||
|
||||
It("should close multi when client is closed", func() {
|
||||
tx, err := client.Watch()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(client.Close()).NotTo(HaveOccurred())
|
||||
Expect(tx.Close()).NotTo(HaveOccurred())
|
||||
})
|
||||
|
||||
It("should close pipeline when client is closed", func() {
|
||||
pipeline := client.Pipeline()
|
||||
Expect(client.Close()).NotTo(HaveOccurred())
|
||||
|
Reference in New Issue
Block a user