e2e: ctl tests with multi expects

release-3.0
Gyu-Ho Lee 2016-03-30 22:09:23 -07:00
parent 324afd7fde
commit a6c6bbd81c
2 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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 {