mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
tests/framework: Add Client.LeaseRevoke
This commit is contained in:
parent
36279e0797
commit
ab3353582d
@ -327,3 +327,19 @@ func (ctl *EtcdctlV3) LeaseKeepAliveOnce(id clientv3.LeaseID) (*clientv3.LeaseKe
|
||||
err = json.Unmarshal([]byte(line), &resp)
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
func (ctl *EtcdctlV3) LeaseRevoke(id clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error) {
|
||||
args := ctl.cmdArgs()
|
||||
args = append(args, "lease", "revoke", strconv.FormatInt(int64(id), 16), "-w", "json")
|
||||
cmd, err := SpawnCmd(args, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var resp clientv3.LeaseRevokeResponse
|
||||
line, err := cmd.Expect("header")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = json.Unmarshal([]byte(line), &resp)
|
||||
return &resp, err
|
||||
}
|
||||
|
@ -244,3 +244,9 @@ func (c integrationClient) LeaseKeepAliveOnce(id clientv3.LeaseID) (*clientv3.Le
|
||||
|
||||
return c.Client.KeepAliveOnce(ctx, id)
|
||||
}
|
||||
|
||||
func (c integrationClient) LeaseRevoke(id clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error) {
|
||||
ctx := context.Background()
|
||||
|
||||
return c.Client.Revoke(ctx, id)
|
||||
}
|
||||
|
@ -45,4 +45,5 @@ type Client interface {
|
||||
TimeToLive(id clientv3.LeaseID, opts config.LeaseOption) (*clientv3.LeaseTimeToLiveResponse, error)
|
||||
LeaseList() (*clientv3.LeaseLeasesResponse, error)
|
||||
LeaseKeepAliveOnce(id clientv3.LeaseID) (*clientv3.LeaseKeepAliveResponse, error)
|
||||
LeaseRevoke(id clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user