tests/framework: Add Client.LeaseKeepAliveOnce
This commit is contained in:
@ -311,3 +311,19 @@ func (ctl *EtcdctlV3) LeaseList() (*clientv3.LeaseLeasesResponse, error) {
|
|||||||
err = json.Unmarshal([]byte(line), &resp)
|
err = json.Unmarshal([]byte(line), &resp)
|
||||||
return &resp, err
|
return &resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ctl *EtcdctlV3) LeaseKeepAliveOnce(id clientv3.LeaseID) (*clientv3.LeaseKeepAliveResponse, error) {
|
||||||
|
args := ctl.cmdArgs()
|
||||||
|
args = append(args, "lease", "keep-alive", strconv.FormatInt(int64(id), 16), "--once", "-w", "json")
|
||||||
|
cmd, err := SpawnCmd(args, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var resp clientv3.LeaseKeepAliveResponse
|
||||||
|
line, err := cmd.Expect("ID")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = json.Unmarshal([]byte(line), &resp)
|
||||||
|
return &resp, err
|
||||||
|
}
|
||||||
|
@ -238,3 +238,9 @@ func (c integrationClient) LeaseList() (*clientv3.LeaseLeasesResponse, error) {
|
|||||||
|
|
||||||
return c.Client.Leases(ctx)
|
return c.Client.Leases(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c integrationClient) LeaseKeepAliveOnce(id clientv3.LeaseID) (*clientv3.LeaseKeepAliveResponse, error) {
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
|
return c.Client.KeepAliveOnce(ctx, id)
|
||||||
|
}
|
||||||
|
@ -44,4 +44,5 @@ type Client interface {
|
|||||||
Grant(ttl int64) (*clientv3.LeaseGrantResponse, error)
|
Grant(ttl int64) (*clientv3.LeaseGrantResponse, error)
|
||||||
TimeToLive(id clientv3.LeaseID, opts config.LeaseOption) (*clientv3.LeaseTimeToLiveResponse, error)
|
TimeToLive(id clientv3.LeaseID, opts config.LeaseOption) (*clientv3.LeaseTimeToLiveResponse, error)
|
||||||
LeaseList() (*clientv3.LeaseLeasesResponse, error)
|
LeaseList() (*clientv3.LeaseLeasesResponse, error)
|
||||||
|
LeaseKeepAliveOnce(id clientv3.LeaseID) (*clientv3.LeaseKeepAliveResponse, error)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user