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

tidb-binlog/node: migrate tests to testify #33540

Merged
merged 2 commits into from Mar 29, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 10 additions & 16 deletions tidb-binlog/node/registry_test.go
Expand Up @@ -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{
Expand All @@ -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)

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

Expand All @@ -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)
Expand Down