diff --git a/clientv3/integration/leasing_test.go b/clientv3/integration/leasing_test.go index b56478361d95..e5e258a54f2b 100644 --- a/clientv3/integration/leasing_test.go +++ b/clientv3/integration/leasing_test.go @@ -28,6 +28,8 @@ import ( "github.com/coreos/etcd/clientv3/leasing" "github.com/coreos/etcd/integration" "github.com/coreos/etcd/pkg/testutil" + + "github.com/coreos/pkg/capnslog" ) func TestLeasingPutGet(t *testing.T) { @@ -1359,26 +1361,46 @@ func TestLeasingPutGetDeleteConcurrent(t *testing.T) { // TestLeasingReconnectOwnerRevoke checks that revocation works if // disconnected when trying to submit revoke txn. func TestLeasingReconnectOwnerRevoke(t *testing.T) { + fmt.Println("[DEBUG] TestLeasingReconnectOwnerRevoke starts!") + capnslog.SetGlobalLogLevel(capnslog.INFO) + defer testutil.AfterTest(t) clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 3}) - defer clus.Terminate(t) + defer func() { + fmt.Println("[DEBUG] TestLeasingReconnectOwnerRevoke DONE!") + capnslog.SetGlobalLogLevel(capnslog.CRITICAL) + clus.Terminate(t) + }() + fmt.Println("clus.Members:", clus.Members[0].GRPCAddr(), clus.Members[1].GRPCAddr(), clus.Members[2].GRPCAddr()) + fmt.Println("[DEBUG] leasing.NewKV 1") lkv1, closeLKV1, err1 := leasing.NewKV(clus.Client(0), "foo/") testutil.AssertNil(t, err1) defer closeLKV1() + fmt.Println("[DEBUG] leasing.NewKV 2") + fmt.Println("[DEBUG] leasing.NewKV 3") lkv2, closeLKV2, err2 := leasing.NewKV(clus.Client(1), "foo/") testutil.AssertNil(t, err2) defer closeLKV2() + fmt.Println("[DEBUG] leasing.NewKV 4") + fmt.Println("[DEBUG] lkv1.Get 1") if _, err := lkv1.Get(context.TODO(), "k"); err != nil { t.Fatal(err) } + fmt.Println("[DEBUG] lkv1.Get 2") // force leader away from member 0 + fmt.Println("[DEBUG] clus.Members[0].Stop 1", clus.Members[0].GRPCAddr()) clus.Members[0].Stop(t) + fmt.Println("[DEBUG] clus.Members[0].Stop 2", clus.Members[0].GRPCAddr()) + fmt.Println("[DEBUG] WaitLeader 1") clus.WaitLeader(t) + fmt.Println("[DEBUG] WaitLeader 2") + fmt.Println("[DEBUG] clus.Members[0].Restart 1", clus.Members[0].GRPCAddr()) clus.Members[0].Restart(t) + fmt.Println("[DEBUG] clus.Members[0].Restart 2", clus.Members[0].GRPCAddr()) cctx, cancel := context.WithCancel(context.TODO()) sdonec, pdonec := make(chan struct{}), make(chan struct{}) @@ -1386,29 +1408,40 @@ func TestLeasingReconnectOwnerRevoke(t *testing.T) { go func() { defer close(sdonec) for i := 0; i < 10 && cctx.Err() == nil; i++ { + fmt.Println("[DEBUG] clus.Members[0].Stop 2-1", clus.Members[0].GRPCAddr()) clus.Members[0].Stop(t) + fmt.Println("[DEBUG] clus.Members[0].Stop 2-2", clus.Members[0].GRPCAddr()) time.Sleep(10 * time.Millisecond) + fmt.Println("[DEBUG] clus.Members[0].Restart 2-1", clus.Members[0].GRPCAddr()) clus.Members[0].Restart(t) + fmt.Println("[DEBUG] clus.Members[0].Restart 2-2", clus.Members[0].GRPCAddr()) } }() go func() { defer close(pdonec) + fmt.Println("[DEBUG] lkv2.Put 1") if _, err := lkv2.Put(cctx, "k", "v"); err != nil { t.Log(err) } + fmt.Println("[DEBUG] lkv2.Put 2") + fmt.Println("[DEBUG] lkv1.Get 1") resp, err := lkv1.Get(cctx, "k") if err != nil { t.Fatal(err) } + fmt.Println("[DEBUG] lkv1.Get 2") if string(resp.Kvs[0].Value) != "v" { t.Fatalf(`expected "v" value, got %+v`, resp) } }() + fmt.Println("[DEBUG] start waiting...") select { case <-pdonec: + fmt.Println("[DEBUG] pdonec") cancel() <-sdonec case <-time.After(10 * time.Second): + fmt.Println("[DEBUG] time.After") cancel() <-sdonec <-pdonec diff --git a/test b/test index 06019f27c959..f9a2695943c2 100755 --- a/test +++ b/test @@ -101,11 +101,7 @@ function integration_pass { } function integration_extra { - go test -timeout 1m -v ${RACE} -cpu 1,2,4 "$@" "${REPO_PATH}/client/integration" go test -timeout 20m -v ${RACE} -cpu 1,2,4 "$@" "${REPO_PATH}/clientv3/integration" - go test -timeout 1m -v -cpu 1,2,4 "$@" "${REPO_PATH}/contrib/raftexample" - go test -timeout 5m -v ${RACE} -tags v2v3 "$@" "${REPO_PATH}/store" - go test -timeout 1m -v ${RACE} -cpu 1,2,4 -run=Example "$@" "${TEST[@]}" } function functional_pass { @@ -228,12 +224,6 @@ function e2e_pass { function integration_e2e_pass { echo "Running integration and e2e tests..." - go test -timeout 15m -v -cpu 1,2,4 "$@" "${REPO_PATH}/e2e" & - e2epid="$!" - go test -timeout 15m -v -cpu 1,2,4 "$@" "${REPO_PATH}/integration" & - intpid="$!" - wait $e2epid - wait $intpid integration_extra "$@" }