Sfoglia il codice sorgente

Merge pull request #4919 from gyuho/expects

*: ctl v3 tests with multi expects
Gyu-Ho Lee 9 anni fa
parent
commit
f328c75ba7
2 ha cambiato i file con 11 aggiunte e 3 eliminazioni
  1. 10 1
      e2e/etcd_test.go
  2. 1 2
      e2e/etcdctlv3_test.go

+ 10 - 1
e2e/etcd_test.go

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

+ 1 - 2
e2e/etcdctlv3_test.go

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