Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/e2e: investigating TestCtlV3AuthAndWatch failure in coverage tests #9684

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clientv3/integration/kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
10 changes: 9 additions & 1 deletion etcdctl/ctlv3/command/watch_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand All @@ -247,7 +249,13 @@ 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,
"/ osArgs:", osArgs,
"/ envKey:", envKey,
)
return nil, nil, errBadArgsNum
}

Expand Down
13 changes: 12 additions & 1 deletion tests/e2e/ctl_v3_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down Expand Up @@ -846,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", tt.args)
err = ctlV3WatchFailPerm(cx, tt.args)
fmt.Println("ctlV3WatchFailPerm 2", tt.args, "/", err)
}

if err != nil {
Expand Down
31 changes: 28 additions & 3 deletions tests/e2e/ctl_v3_watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,31 @@
package e2e

import (
"fmt"
"os"
"strings"
"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())
Expand Down Expand Up @@ -165,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
}
Expand All @@ -189,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
Expand Down Expand Up @@ -220,6 +244,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
Expand Down