From fe5eaf8f8e6d3b80b5fe4f85990dbe76bc453056 Mon Sep 17 00:00:00 2001 From: shanth96 Date: Fri, 25 Oct 2024 15:17:54 -0400 Subject: [PATCH] add test --- go/vt/topo/zk2topo/zk_conn_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/go/vt/topo/zk2topo/zk_conn_test.go b/go/vt/topo/zk2topo/zk_conn_test.go index 06a099d1882..aa47be7db24 100644 --- a/go/vt/topo/zk2topo/zk_conn_test.go +++ b/go/vt/topo/zk2topo/zk_conn_test.go @@ -21,7 +21,6 @@ import ( "testing" "github.com/z-division/go-zookeeper/zk" - "vitess.io/vitess/go/testfiles" "vitess.io/vitess/go/vt/zkctl" ) @@ -36,7 +35,7 @@ func TestZkConnClosedOnDisconnect(t *testing.T) { t.Fatalf("Get() failed: %v", err) } - if conn.conn.State() != zk.StateConnected { + if !conn.conn.State().IsConnected() { t.Fatalf("Connection not connected: %v", conn.conn.State()) } @@ -52,7 +51,12 @@ func TestZkConnClosedOnDisconnect(t *testing.T) { t.Fatalf("Get() failed: %v", err) } - // check that the old connection is closed + // Check that old connection is closed + _, _, err = oldConn.Get("/") + if err == nil { + t.Fatalf("Get() should have failed: %v", err) + } + if oldConn.State() != zk.StateDisconnected { t.Fatalf("Connection not closed: %v", oldConn.State()) }