Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Aug 30, 2023
1 parent 4ccfaf6 commit 4af12f3
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions pkg/utils/etcdutil/etcdutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,24 @@ func TestMain(m *testing.M) {

func TestMemberHelpers(t *testing.T) {
re := require.New(t)
servers, client1, clean := NewTestEtcdCluster(t, 2)
servers, client1, clean := NewTestEtcdCluster(t, 1)
defer clean()
etcd1, cfg1 := servers[0], servers[0].Config()

// Test ListEtcdMembers
listResp1, err := ListEtcdMembers(client1)
re.NoError(err)
re.Len(listResp1.Members, 1)
// types.ID is an alias of uint64.
re.Equal(uint64(etcd1.Server.ID()), listResp1.Members[0].ID)

etcd1, etcd2 := servers[0], servers[1]
_, cfg2 := servers[0].Config(), servers[1].Config()
// Test AddEtcdMember
etcd2 := MustAddEtcdMember(t, &cfg1, client1)
defer etcd2.Close()
checkMembers(re, client1, []*embed.Etcd{etcd1, etcd2})

// Test CheckClusterID
urlsMap, err := types.NewURLsMap(cfg2.InitialCluster)
urlsMap, err := types.NewURLsMap(etcd2.Config().InitialCluster)
re.NoError(err)
err = CheckClusterID(etcd1.Server.Cluster().ID(), urlsMap, &tls.Config{MinVersion: tls.VersionTLS12})
re.NoError(err)
Expand Down

0 comments on commit 4af12f3

Please sign in to comment.