Merge pull request #929 from theodesp/master

Add Client Id
This commit is contained in:
Vladimir Mihailenco 2018-12-11 13:15:35 +02:00 committed by GitHub
commit 0e62f5ec35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -231,6 +231,7 @@ type Cmdable interface {
ClientKillByFilter(keys ...string) *IntCmd
ClientList() *StringCmd
ClientPause(dur time.Duration) *BoolCmd
ClientId() *IntCmd
ConfigGet(parameter string) *SliceCmd
ConfigResetStat() *StatusCmd
ConfigSet(parameter, value string) *StatusCmd
@ -2061,6 +2062,12 @@ func (c *cmdable) ClientPause(dur time.Duration) *BoolCmd {
return cmd
}
func (c *cmdable) ClientId() *IntCmd {
cmd := NewIntCmd("client", "id")
c.process(cmd)
return cmd
}
// ClientSetName assigns a name to the connection.
func (c *statefulCmdable) ClientSetName(name string) *BoolCmd {
cmd := NewBoolCmd("client", "setname", name)

View File

@ -121,6 +121,12 @@ var _ = Describe("Commands", func() {
Expect(r.Val()).To(Equal(int64(0)))
})
It("should ClientId", func() {
err := client.ClientId().Err()
Expect(err).NotTo(HaveOccurred())
Expect(client.ClientId().Val()).To(BeNumerically(">=", 0))
})
It("should ClientPause", func() {
err := client.ClientPause(time.Second).Err()
Expect(err).NotTo(HaveOccurred())
@ -222,7 +228,7 @@ var _ = Describe("Commands", func() {
Expect(tm).To(BeTemporally("~", time.Now(), 3*time.Second))
})
It("Should Command", func() {
It("should Command", func() {
cmds, err := client.Command().Result()
Expect(err).NotTo(HaveOccurred())
Expect(len(cmds)).To(BeNumerically("~", 200, 20))