From 5b0683cd0839fd8fc79b5a398ad6c5a803ac71ad Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Wed, 2 May 2018 14:42:55 -0700 Subject: [PATCH 1/7] tests/e2e: investigating TestCtlV3AuthAndWatch failure in coverage tests Signed-off-by: Gyuho Lee --- tests/e2e/ctl_v3_auth_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/e2e/ctl_v3_auth_test.go b/tests/e2e/ctl_v3_auth_test.go index db38d5fc615..7fda8ac517a 100644 --- a/tests/e2e/ctl_v3_auth_test.go +++ b/tests/e2e/ctl_v3_auth_test.go @@ -40,7 +40,14 @@ func TestCtlV3AuthCertCN(t *testing.T) { testCtl(t, authTestCertCN, wi func TestCtlV3AuthRevokeWithDelete(t *testing.T) { testCtl(t, authTestRevokeWithDelete) } func TestCtlV3AuthInvalidMgmt(t *testing.T) { testCtl(t, authTestInvalidMgmt) } func TestCtlV3AuthFromKeyPerm(t *testing.T) { testCtl(t, authTestFromKeyPerm) } -func TestCtlV3AuthAndWatch(t *testing.T) { testCtl(t, authTestWatch) } + +func TestCtlV3AuthAndWatch(t *testing.T) { + oldenv := os.Getenv("EXPECT_DEBUG") + defer os.Setenv("EXPECT_DEBUG", oldenv) + os.Setenv("EXPECT_DEBUG", "1") + + testCtl(t, authTestWatch) +} func TestCtlV3AuthLeaseTestKeepAlive(t *testing.T) { testCtl(t, authLeaseTestKeepAlive) } func TestCtlV3AuthLeaseTestTimeToLiveExpired(t *testing.T) { testCtl(t, authLeaseTestTimeToLiveExpired) } From 1447b7e0b301f102129b5b7001d43e2bbba99f1b Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Wed, 2 May 2018 18:13:27 -0700 Subject: [PATCH 2/7] *: log Signed-off-by: Gyuho Lee --- etcdctl/ctlv3/command/watch_command.go | 3 +++ tests/e2e/ctl_v3_auth_test.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/etcdctl/ctlv3/command/watch_command.go b/etcdctl/ctlv3/command/watch_command.go index 33447f649ee..690d05df0f4 100644 --- a/etcdctl/ctlv3/command/watch_command.go +++ b/etcdctl/ctlv3/command/watch_command.go @@ -127,6 +127,7 @@ func watchInteractiveFunc(cmd *cobra.Command, osArgs []string, envKey, envRange func getWatchChan(c *clientv3.Client, args []string) (clientv3.WatchChan, error) { if len(args) < 1 { + fmt.Println("1 args before errBadArgsNum:", args) return nil, errBadArgsNum } @@ -236,6 +237,7 @@ func parseWatchArgs(osArgs, commandArgs []string, envKey, envRange string, inter return nil, nil, errBadArgsInteractiveWatch } if len(watchArgs) < 1 && envKey == "" { + fmt.Println("1 watchArgs before errBadArgsNum:", watchArgs, "/", envKey) return nil, nil, errBadArgsNum } @@ -248,6 +250,7 @@ func parseWatchArgs(osArgs, commandArgs []string, envKey, envRange string, inter if idx < len(osArgs)-1 { osArgs = osArgs[idx+1:] } else if envKey == "" { + fmt.Println("2 watchArgs before errBadArgsNum:", watchArgs, "/", osArgs, "/", envKey) return nil, nil, errBadArgsNum } diff --git a/tests/e2e/ctl_v3_auth_test.go b/tests/e2e/ctl_v3_auth_test.go index 7fda8ac517a..efae14a01ec 100644 --- a/tests/e2e/ctl_v3_auth_test.go +++ b/tests/e2e/ctl_v3_auth_test.go @@ -853,9 +853,13 @@ func authTestWatch(cx ctlCtx) { var err error if tt.want { + fmt.Println("ctlV3Watch 1") err = ctlV3Watch(cx, tt.args, tt.wkv...) + fmt.Println("ctlV3Watch 2", err) } else { + fmt.Println("ctlV3WatchFailPerm 1") err = ctlV3WatchFailPerm(cx, tt.args) + fmt.Println("ctlV3WatchFailPerm 2", err) } if err != nil { From 30b8fbfd46778f409721a3819379283bd502136e Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Wed, 2 May 2018 18:52:17 -0700 Subject: [PATCH 3/7] clientv3: skip Signed-off-by: Gyuho Lee --- clientv3/integration/kv_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clientv3/integration/kv_test.go b/clientv3/integration/kv_test.go index 66de753cdad..cce889ddf79 100644 --- a/clientv3/integration/kv_test.go +++ b/clientv3/integration/kv_test.go @@ -187,6 +187,8 @@ func TestKVPutWithIgnoreLease(t *testing.T) { } func TestKVPutWithRequireLeader(t *testing.T) { + t.Skip() + defer testutil.AfterTest(t) clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 3}) From e970df23b569bb1e4fdfdfc91984f17a75e38e15 Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Wed, 2 May 2018 19:36:49 -0700 Subject: [PATCH 4/7] tests: log more Signed-off-by: Gyuho Lee --- etcdctl/ctlv3/command/watch_command.go | 7 ++++++- tests/e2e/ctl_v3_auth_test.go | 4 ++-- tests/e2e/ctl_v3_watch_test.go | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/etcdctl/ctlv3/command/watch_command.go b/etcdctl/ctlv3/command/watch_command.go index 690d05df0f4..312291f1666 100644 --- a/etcdctl/ctlv3/command/watch_command.go +++ b/etcdctl/ctlv3/command/watch_command.go @@ -250,7 +250,12 @@ func parseWatchArgs(osArgs, commandArgs []string, envKey, envRange string, inter if idx < len(osArgs)-1 { osArgs = osArgs[idx+1:] } else if envKey == "" { - fmt.Println("2 watchArgs before errBadArgsNum:", watchArgs, "/", osArgs, "/", envKey) + fmt.Println( + "idx:", idx, + "/ watchArgs before errBadArgsNum:", watchArgs, + "/ osArgs:", osArgs, + "/ envKey:", envKey, + ) return nil, nil, errBadArgsNum } diff --git a/tests/e2e/ctl_v3_auth_test.go b/tests/e2e/ctl_v3_auth_test.go index efae14a01ec..a70020debd2 100644 --- a/tests/e2e/ctl_v3_auth_test.go +++ b/tests/e2e/ctl_v3_auth_test.go @@ -857,9 +857,9 @@ func authTestWatch(cx ctlCtx) { err = ctlV3Watch(cx, tt.args, tt.wkv...) fmt.Println("ctlV3Watch 2", err) } else { - fmt.Println("ctlV3WatchFailPerm 1") + fmt.Println("ctlV3WatchFailPerm 1", tt.args) err = ctlV3WatchFailPerm(cx, tt.args) - fmt.Println("ctlV3WatchFailPerm 2", err) + fmt.Println("ctlV3WatchFailPerm 2", tt.args, "/", err) } if err != nil { diff --git a/tests/e2e/ctl_v3_watch_test.go b/tests/e2e/ctl_v3_watch_test.go index dbc2f081c7d..5d2aa6c8505 100644 --- a/tests/e2e/ctl_v3_watch_test.go +++ b/tests/e2e/ctl_v3_watch_test.go @@ -15,6 +15,7 @@ package e2e import ( + "fmt" "os" "strings" "testing" @@ -220,6 +221,7 @@ func ctlV3Watch(cx ctlCtx, args []string, kvs ...kvExec) error { func ctlV3WatchFailPerm(cx ctlCtx, args []string) error { cmdArgs := setupWatchArgs(cx, args) + fmt.Println("ctlV3WatchFailPerm cmdArgs:", cmdArgs) proc, err := spawnCmd(cmdArgs) if err != nil { return err From 39ce10cd0440d51590446c4f86c98aa9d3c51ede Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Wed, 2 May 2018 20:19:00 -0700 Subject: [PATCH 5/7] watch: add Signed-off-by: Gyuho Lee --- etcdctl/ctlv3/command/watch_command.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etcdctl/ctlv3/command/watch_command.go b/etcdctl/ctlv3/command/watch_command.go index 312291f1666..8fdb580bd6b 100644 --- a/etcdctl/ctlv3/command/watch_command.go +++ b/etcdctl/ctlv3/command/watch_command.go @@ -249,7 +249,7 @@ func parseWatchArgs(osArgs, commandArgs []string, envKey, envRange string, inter } if idx < len(osArgs)-1 { osArgs = osArgs[idx+1:] - } else if envKey == "" { + } else if len(watchArgs) < 1 && envKey == "" { fmt.Println( "idx:", idx, "/ watchArgs before errBadArgsNum:", watchArgs, From 858b46705034963ae70766f4525f6b50e71bd16f Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Wed, 2 May 2018 21:18:37 -0700 Subject: [PATCH 6/7] watch: a Signed-off-by: Gyuho Lee --- tests/e2e/ctl_v3_watch_test.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/e2e/ctl_v3_watch_test.go b/tests/e2e/ctl_v3_watch_test.go index 5d2aa6c8505..14fd758525e 100644 --- a/tests/e2e/ctl_v3_watch_test.go +++ b/tests/e2e/ctl_v3_watch_test.go @@ -21,11 +21,25 @@ import ( "testing" ) -func TestCtlV3Watch(t *testing.T) { testCtl(t, watchTest) } -func TestCtlV3WatchNoTLS(t *testing.T) { testCtl(t, watchTest, withCfg(configNoTLS)) } +func TestCtlV3Watch(t *testing.T) { testCtl(t, watchTest) } + +func TestCtlV3WatchNoTLS(t *testing.T) { + oldenv := os.Getenv("EXPECT_DEBUG") + defer os.Setenv("EXPECT_DEBUG", oldenv) + os.Setenv("EXPECT_DEBUG", "1") + + testCtl(t, watchTest, withCfg(configNoTLS)) +} + func TestCtlV3WatchClientTLS(t *testing.T) { testCtl(t, watchTest, withCfg(configClientTLS)) } func TestCtlV3WatchPeerTLS(t *testing.T) { testCtl(t, watchTest, withCfg(configPeerTLS)) } -func TestCtlV3WatchTimeout(t *testing.T) { testCtl(t, watchTest, withDialTimeout(0)) } +func TestCtlV3WatchTimeout(t *testing.T) { + oldenv := os.Getenv("EXPECT_DEBUG") + defer os.Setenv("EXPECT_DEBUG", oldenv) + os.Setenv("EXPECT_DEBUG", "1") + + testCtl(t, watchTest, withDialTimeout(0)) +} func TestCtlV3WatchInteractive(t *testing.T) { testCtl(t, watchTest, withInteractive()) From c1be6c48d20a6b19dd8d14cecd1f452d6f108428 Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Wed, 2 May 2018 22:38:40 -0700 Subject: [PATCH 7/7] tests: log Signed-off-by: Gyuho Lee --- tests/e2e/ctl_v3_watch_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/e2e/ctl_v3_watch_test.go b/tests/e2e/ctl_v3_watch_test.go index 14fd758525e..8faaa1d520b 100644 --- a/tests/e2e/ctl_v3_watch_test.go +++ b/tests/e2e/ctl_v3_watch_test.go @@ -180,11 +180,14 @@ func watchTest(cx ctlCtx) { } } } + fmt.Printf("#%d-1 ctlV3Watch: %+v\n", i, tt) if err := ctlV3Watch(cx, tt.args, tt.wkv...); err != nil { + fmt.Printf("#%d-2 ctlV3Watch: %+v (error %v)\n", i, tt, err) if cx.dialTimeout > 0 && !isGRPCTimedout(err) { cx.t.Errorf("watchTest #%d: ctlV3Watch error (%v)", i, err) } } + fmt.Printf("#%d-3 ctlV3Watch: %+v\n", i, tt) unsetEnv() <-donec } @@ -204,6 +207,12 @@ func setupWatchArgs(cx ctlCtx, args []string) []string { func ctlV3Watch(cx ctlCtx, args []string, kvs ...kvExec) error { cmdArgs := setupWatchArgs(cx, args) + println() + fmt.Println("ctlV3Watch os.Args:", os.Args) + fmt.Println("ctlV3Watch kvs:", kvs) + fmt.Println("ctlV3Watch args:", args) + fmt.Println("ctlV3Watch cmdArgs:", cmdArgs) + println() proc, err := spawnCmd(cmdArgs) if err != nil { return err