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

ccl/sqlproxyccl: fix TestWatchPods under stressrace #73946

Merged
merged 1 commit into from
Dec 17, 2021
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
17 changes: 10 additions & 7 deletions pkg/ccl/sqlproxyccl/tenant/directory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ func TestWatchPods(t *testing.T) {

// Ensure that all addresses have been cleared from the directory, since
// it should only return RUNNING addresses.
addrs, err := dir.LookupTenantAddrs(ctx, tenantID)
require.NoError(t, err)
require.Empty(t, addrs)
require.Eventually(t, func() bool {
addrs, _ := dir.LookupTenantAddrs(ctx, tenantID)
return len(addrs) == 0
}, 10*time.Second, 100*time.Millisecond)

// Now shut the tenant directory down.
processes := tds.Get(tenantID)
Expand All @@ -120,10 +121,12 @@ func TestWatchPods(t *testing.T) {
require.Equal(t, addr, pod.Addr)
require.Equal(t, tenant.DELETING, pod.State)

require.Eventually(t, func() bool {
addrs, _ := dir.LookupTenantAddrs(ctx, tenantID)
return len(addrs) == 0
}, 10*time.Second, 100*time.Millisecond)
// We know that the directory should have been emptied earlier since we
// don't add DRAINING pods to the directory, so putting the pod into the
// DELETING state should not make a difference.
addrs, err := dir.LookupTenantAddrs(ctx, tenantID)
require.NoError(t, err)
require.Empty(t, addrs)

// Resume tenant again by a direct call to the directory server
_, err = tds.EnsurePod(ctx, &tenant.EnsurePodRequest{tenantID.ToUint64()})
Expand Down