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

*: make TestEtcdScaleInAndOut stable #8067

Merged
merged 2 commits into from
Apr 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions pkg/utils/etcdutil/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,27 @@

func checkMembers(re *require.Assertions, client *clientv3.Client, etcds []*embed.Etcd) {
// Check the client can get the new member.
listResp, err := ListEtcdMembers(client.Ctx(), client)
re.NoError(err)
re.Len(listResp.Members, len(etcds))
inList := func(m *etcdserverpb.Member) bool {
for _, etcd := range etcds {
if m.ID == uint64(etcd.Server.ID()) {
return true
testutil.Eventually(re, func() bool {
listResp, err := ListEtcdMembers(client.Ctx(), client)
if err != nil {
return false

Check warning on line 128 in pkg/utils/etcdutil/testutil.go

View check run for this annotation

Codecov / codecov/patch

pkg/utils/etcdutil/testutil.go#L128

Added line #L128 was not covered by tests
}
if len(etcds) != len(listResp.Members) {
return false

Check warning on line 131 in pkg/utils/etcdutil/testutil.go

View check run for this annotation

Codecov / codecov/patch

pkg/utils/etcdutil/testutil.go#L131

Added line #L131 was not covered by tests
}
inList := func(m *etcdserverpb.Member) bool {
for _, etcd := range etcds {
if m.ID == uint64(etcd.Server.ID()) {
return true
}
}
return false

Check warning on line 139 in pkg/utils/etcdutil/testutil.go

View check run for this annotation

Codecov / codecov/patch

pkg/utils/etcdutil/testutil.go#L139

Added line #L139 was not covered by tests
}
return false
}
for _, m := range listResp.Members {
re.True(inList(m))
}
for _, m := range listResp.Members {
if !inList(m) {
return false

Check warning on line 143 in pkg/utils/etcdutil/testutil.go

View check run for this annotation

Codecov / codecov/patch

pkg/utils/etcdutil/testutil.go#L143

Added line #L143 was not covered by tests
}
}
return true
})
}
Loading