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 {
|
func spawnWithExpect(args []string, expected string) error {
|
||||||
|
return spawnWithExpects(args, []string{expected}...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func spawnWithExpects(args []string, xs ...string) error {
|
||||||
proc, err := spawnCmd(args)
|
proc, err := spawnCmd(args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
_, err = proc.Expect(expected)
|
for _, txt := range xs {
|
||||||
|
_, err = proc.Expect(txt)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
perr := proc.Close()
|
perr := proc.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -130,8 +130,7 @@ func ctlV3Get(clus *etcdProcessCluster, key, value string, dialTimeout time.Dura
|
|||||||
if !quorum {
|
if !quorum {
|
||||||
cmdArgs = append(cmdArgs, "--consistency", "s")
|
cmdArgs = append(cmdArgs, "--consistency", "s")
|
||||||
}
|
}
|
||||||
// TODO: match by value. Currently it prints out both key and value in multi-lines.
|
return spawnWithExpects(cmdArgs, key, value)
|
||||||
return spawnWithExpect(cmdArgs, key)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupCtlV3Test(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) *etcdProcessCluster {
|
func setupCtlV3Test(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) *etcdProcessCluster {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user