tests/framework: Add PutOptions

Put can take a leaseid to associate a value with a lease. This adds the
ability for tests to make use of this.
This commit is contained in:
Danielle Lancashire
2022-03-16 15:26:08 +00:00
parent b7beaf9c62
commit b50f10299b
8 changed files with 25 additions and 11 deletions

View File

@ -126,8 +126,12 @@ func (c integrationClient) Get(key string, o config.GetOptions) (*clientv3.GetRe
return c.Client.Get(context.Background(), key, clientOpts...)
}
func (c integrationClient) Put(key, value string) error {
_, err := c.Client.Put(context.Background(), key, value)
func (c integrationClient) Put(key, value string, opts config.PutOptions) error {
clientOpts := []clientv3.OpOption{}
if opts.LeaseID != 0 {
clientOpts = append(clientOpts, clientv3.WithLease(opts.LeaseID))
}
_, err := c.Client.Put(context.Background(), key, value, clientOpts...)
return err
}