tests: Use GetOptions to configure serializble get

This commit is contained in:
Marek Siarkowicz 2022-02-23 16:17:01 +01:00
parent 744dd077cd
commit def122871c
2 changed files with 4 additions and 3 deletions

View File

@ -64,5 +64,5 @@ func (c e2eClient) Get(key string, opts ...testutils.GetOption) (*clientv3.GetRe
for _, opt := range opts {
opt(&o)
}
return c.EtcdctlV3.Get(key, o.Serializable)
return c.EtcdctlV3.Get(key, o)
}

View File

@ -20,6 +20,7 @@ import (
"strings"
clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/tests/v3/framework/testutils"
)
type EtcdctlV3 struct {
@ -38,9 +39,9 @@ func (ctl *EtcdctlV3) DowngradeEnable(version string) error {
return SpawnWithExpect(ctl.cmdArgs("downgrade", "enable", version), "Downgrade enable success")
}
func (ctl *EtcdctlV3) Get(key string, serializable bool) (*clientv3.GetResponse, error) {
func (ctl *EtcdctlV3) Get(key string, o testutils.GetOptions) (*clientv3.GetResponse, error) {
args := ctl.cmdArgs()
if serializable {
if o.Serializable {
args = append(args, "--consistency", "s")
}
cmd, err := SpawnCmd(append(args, "get", key, "-w", "json"), nil)