From 5dbd394a42c1fd53b1d3ab6ceb98a3fc14971197 Mon Sep 17 00:00:00 2001 From: disksing Date: Tue, 29 Mar 2022 14:56:28 +0800 Subject: [PATCH] tidb-binlog/node: migrate tests to testify (#33540) close pingcap/tidb#33462 --- tidb-binlog/node/registry_test.go | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/tidb-binlog/node/registry_test.go b/tidb-binlog/node/registry_test.go index 264e2a1620d12..121f545809f69 100644 --- a/tidb-binlog/node/registry_test.go +++ b/tidb-binlog/node/registry_test.go @@ -19,34 +19,23 @@ import ( "testing" "time" - . "github.com/pingcap/check" "github.com/pingcap/tidb/util/etcd" "github.com/stretchr/testify/require" "go.etcd.io/etcd/tests/v3/integration" "golang.org/x/net/context" ) -// nolint:unused var nodePrefix = path.Join(DefaultRootPath, NodePrefix[PumpNode]) type RegisrerTestClient interface { Node(context.Context, string, string) (*Status, int64, error) } -var testEtcdCluster *integration.ClusterV3 - -func TestNode(t *testing.T) { - t.Skip("need to update the jenkins job") +func TestUpdateNodeInfo(t *testing.T) { integration.BeforeTest(t) - - testEtcdCluster = integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1}) + testEtcdCluster := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1}) defer testEtcdCluster.Terminate(t) - TestingT(t) -} - -func TestUpdateNodeInfo(t *testing.T) { - t.Skip("need to update the jenkins job") etcdclient := etcd.NewClient(testEtcdCluster.RandClient(), DefaultRootPath) r := NewEtcdRegistry(etcdclient, time.Duration(5)*time.Second) ns := &Status{ @@ -71,7 +60,10 @@ func TestUpdateNodeInfo(t *testing.T) { } func TestRegisterNode(t *testing.T) { - t.Skip("need to update the jenkins job") + integration.BeforeTest(t) + testEtcdCluster := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1}) + defer testEtcdCluster.Terminate(t) + etcdclient := etcd.NewClient(testEtcdCluster.RandClient(), DefaultRootPath) r := NewEtcdRegistry(etcdclient, time.Duration(5)*time.Second) @@ -99,7 +91,10 @@ func TestRegisterNode(t *testing.T) { } func TestRefreshNode(t *testing.T) { - t.Skip("need to update the jenkins job") + integration.BeforeTest(t) + testEtcdCluster := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1}) + defer testEtcdCluster.Terminate(t) + etcdclient := etcd.NewClient(testEtcdCluster.RandClient(), DefaultRootPath) r := NewEtcdRegistry(etcdclient, time.Duration(5)*time.Second) @@ -121,7 +116,6 @@ func TestRefreshNode(t *testing.T) { //mustEqualStatus(t, r, ns.NodeID, ns) } -// nolint:unused,deadcode func mustEqualStatus(t *testing.T, r RegisrerTestClient, nodeID string, status *Status) { ns, _, err := r.Node(context.Background(), nodePrefix, nodeID) require.NoError(t, err)