mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #4919 from gyuho/expects
*: ctl v3 tests with multi expects
This commit is contained in:
commit
f328c75ba7
@ -422,11 +422,20 @@ func spawnCmd(args []string) (*expect.ExpectProcess, error) {
|
||||
}
|
||||
|
||||
func spawnWithExpect(args []string, expected string) error {
|
||||
return spawnWithExpects(args, []string{expected}...)
|
||||
}
|
||||
|
||||
func spawnWithExpects(args []string, xs ...string) error {
|
||||
proc, err := spawnCmd(args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = proc.Expect(expected)
|
||||
for _, txt := range xs {
|
||||
_, err = proc.Expect(txt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
perr := proc.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -130,8 +130,7 @@ func ctlV3Get(clus *etcdProcessCluster, key, value string, dialTimeout time.Dura
|
||||
if !quorum {
|
||||
cmdArgs = append(cmdArgs, "--consistency", "s")
|
||||
}
|
||||
// TODO: match by value. Currently it prints out both key and value in multi-lines.
|
||||
return spawnWithExpect(cmdArgs, key)
|
||||
return spawnWithExpects(cmdArgs, key, value)
|
||||
}
|
||||
|
||||
func setupCtlV3Test(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) *etcdProcessCluster {
|
||||
|
Loading…
x
Reference in New Issue
Block a user