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 flake on TestWatchTenants #103625

Merged
merged 1 commit into from
May 18, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions pkg/ccl/sqlproxyccl/proxy_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ func TestPrivateEndpointsACL(t *testing.T) {
time.Second, 5*time.Millisecond,
"Expected the connection to eventually fail",
)
require.Error(t, err)
require.Regexp(t, "connection reset by peer|unexpected EOF", err.Error())
require.Equal(t, int64(1), s.metrics.ExpiredClientConnCount.Count())
},
Expand Down Expand Up @@ -1203,6 +1204,7 @@ func TestDenylistUpdate(t *testing.T) {
time.Second, 5*time.Millisecond,
"Expected the connection to eventually fail",
)
require.Error(t, err)
require.Regexp(t, "closed|bad connection", err.Error())
require.Equal(t, int64(1), s.metrics.ExpiredClientConnCount.Count())
}
Expand Down
9 changes: 5 additions & 4 deletions pkg/ccl/sqlproxyccl/tenant/directory_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,14 @@ func TestWatchTenants(t *testing.T) {
if tds.WatchTenantsListenersCount() != 0 {
return errors.New("watchers have not been removed yet")
}

// Make sure watcher has attempted to restart, and invalidates entries.
if _, err := dir.LookupTenant(ctx, tenant10); err == nil {
return errors.New("entries have not been invalidated")
}
return nil
})

// Entry was invalidated.
_, err = dir.LookupTenant(ctx, tenant10)
require.Regexp(t, "directory server has not been started", err.Error())

// Trigger events, which will be missed by the tenant watcher.
tds.DeleteTenant(tenant10)
tenant20Data.Version = "002"
Expand Down