Skip to content

Commit

Permalink
tenantrate: deflake testcloser
Browse files Browse the repository at this point in the history
This patch increases the request size in `TestCloser` in order to jam
the request, to assert on timers closing. An earlier patch lowered the
RU cost below the burst threshold, making it so that this request never
waited.

The test previously flaked after 1 run.

`53538 runs so far, 0 failures, over 2m5s`

resolves: #86822

Release note: None
  • Loading branch information
kvoli committed Sep 20, 2022
1 parent 87ed064 commit e59cbad
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 0 additions & 1 deletion pkg/kv/kvserver/tenantrate/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ go_test(
"//pkg/settings/cluster",
"//pkg/testutils",
"//pkg/testutils/metrictestutils",
"//pkg/testutils/skip",
"//pkg/util/leaktest",
"//pkg/util/metric",
"//pkg/util/timeutil",
Expand Down
5 changes: 1 addition & 4 deletions pkg/kv/kvserver/tenantrate/limiter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
"github.com/cockroachdb/cockroach/pkg/testutils"
"github.com/cockroachdb/cockroach/pkg/testutils/metrictestutils"
"github.com/cockroachdb/cockroach/pkg/testutils/skip"
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
"github.com/cockroachdb/cockroach/pkg/util/metric"
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
Expand All @@ -39,8 +38,6 @@ import (

func TestCloser(t *testing.T) {
defer leaktest.AfterTest(t)()
skip.WithIssue(t, 86822, "flaky test")

st := cluster.MakeTestingClusterSettings()
start := timeutil.Now()
timeSource := timeutil.NewManualTime(start)
Expand All @@ -54,7 +51,7 @@ func TestCloser(t *testing.T) {
// First Wait call will not block.
require.NoError(t, limiter.Wait(ctx, tenantcostmodel.TestingRequestInfo(1, 1, 1)))
errCh := make(chan error, 1)
go func() { errCh <- limiter.Wait(ctx, tenantcostmodel.TestingRequestInfo(1, 1, 1<<30)) }()
go func() { errCh <- limiter.Wait(ctx, tenantcostmodel.TestingRequestInfo(1, 1, 1<<31)) }()
testutils.SucceedsSoon(t, func() error {
if timers := timeSource.Timers(); len(timers) != 1 {
return errors.Errorf("expected 1 timer, found %d", len(timers))
Expand Down

0 comments on commit e59cbad

Please sign in to comment.