e2e: ctl tests with multi expects
parent
324afd7fde
commit
a6c6bbd81c
|
@ -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…
Reference in New Issue