Skip to content

Commit abc2b62

Browse files
committed
kvserver/rangefeed: add log scope to some tests
Epic: none Release note: None
1 parent bb50229 commit abc2b62

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

pkg/kv/kvserver/rangefeed/processor_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/cockroachdb/cockroach/pkg/testutils"
2727
"github.com/cockroachdb/cockroach/pkg/util/hlc"
2828
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
29+
"github.com/cockroachdb/cockroach/pkg/util/log"
2930
"github.com/cockroachdb/cockroach/pkg/util/mon"
3031
"github.com/cockroachdb/cockroach/pkg/util/stop"
3132
"github.com/cockroachdb/cockroach/pkg/util/uuid"
@@ -36,6 +37,8 @@ import (
3637

3738
func TestProcessorBasic(t *testing.T) {
3839
defer leaktest.AfterTest(t)()
40+
defer log.Scope(t).Close(t)
41+
3942
testutils.RunValues(t, "feed type", testTypes, func(t *testing.T, rt rangefeedTestType) {
4043
p, h, stopper := newTestProcessor(t, withRangefeedTestType(rt))
4144
ctx := context.Background()
@@ -349,6 +352,8 @@ func TestProcessorBasic(t *testing.T) {
349352

350353
func TestProcessorOmitRemote(t *testing.T) {
351354
defer leaktest.AfterTest(t)()
355+
defer log.Scope(t).Close(t)
356+
352357
testutils.RunValues(t, "feed type", testTypes, func(t *testing.T, rt rangefeedTestType) {
353358
p, h, stopper := newTestProcessor(t, withRangefeedTestType(rt))
354359
ctx := context.Background()
@@ -434,6 +439,8 @@ func TestProcessorOmitRemote(t *testing.T) {
434439
// doesn't apply to unbuffered registrations.
435440
func TestProcessorSlowConsumer(t *testing.T) {
436441
defer leaktest.AfterTest(t)()
442+
defer log.Scope(t).Close(t)
443+
437444
testutils.RunValues(t, "feed type", []rangefeedTestType{scheduledProcessorWithUnbufferedSender},
438445
func(t *testing.T, rt rangefeedTestType) {
439446
p, h, stopper := newTestProcessor(t, withRangefeedTestType(rt))
@@ -540,6 +547,8 @@ func TestProcessorSlowConsumer(t *testing.T) {
540547
// result of budget exhaustion.
541548
func TestProcessorMemoryBudgetExceeded(t *testing.T) {
542549
defer leaktest.AfterTest(t)()
550+
defer log.Scope(t).Close(t)
551+
543552
testutils.RunValues(t, "feed type", testTypes, func(t *testing.T, rt rangefeedTestType) {
544553
fb := newTestBudget(40)
545554
m := NewMetrics()
@@ -597,6 +606,8 @@ func TestProcessorMemoryBudgetExceeded(t *testing.T) {
597606
// TestProcessorMemoryBudgetReleased that memory budget is correctly released.
598607
func TestProcessorMemoryBudgetReleased(t *testing.T) {
599608
defer leaktest.AfterTest(t)()
609+
defer log.Scope(t).Close(t)
610+
600611
testutils.RunValues(t, "feed type", testTypes, func(t *testing.T, rt rangefeedTestType) {
601612
fb := newTestBudget(250)
602613
p, h, stopper := newTestProcessor(t, withBudget(fb), withChanTimeout(15*time.Minute),
@@ -647,6 +658,7 @@ func TestProcessorMemoryBudgetReleased(t *testing.T) {
647658
// until it has consumed all intents in the iterator.
648659
func TestProcessorInitializeResolvedTimestamp(t *testing.T) {
649660
defer leaktest.AfterTest(t)()
661+
defer log.Scope(t).Close(t)
650662

651663
testutils.RunValues(t, "feed type", testTypes, func(t *testing.T, rt rangefeedTestType) {
652664
txn1 := makeTxn("txn1", uuid.MakeV4(), isolation.Serializable, hlc.Timestamp{})
@@ -748,6 +760,7 @@ func TestProcessorInitializeResolvedTimestamp(t *testing.T) {
748760

749761
func TestProcessorTxnPushAttempt(t *testing.T) {
750762
defer leaktest.AfterTest(t)()
763+
defer log.Scope(t).Close(t)
751764

752765
testutils.RunValues(t, "feed type", testTypes, func(t *testing.T, rt rangefeedTestType) {
753766
ts10 := hlc.Timestamp{WallTime: 10}
@@ -931,6 +944,7 @@ func TestProcessorTxnPushAttempt(t *testing.T) {
931944
// push notifications when disabled.
932945
func TestProcessorTxnPushDisabled(t *testing.T) {
933946
defer leaktest.AfterTest(t)()
947+
defer log.Scope(t).Close(t)
934948

935949
const pushInterval = 10 * time.Millisecond
936950

@@ -991,6 +1005,8 @@ func TestProcessorTxnPushDisabled(t *testing.T) {
9911005
// not then it would be possible for them to deadlock.
9921006
func TestProcessorConcurrentStop(t *testing.T) {
9931007
defer leaktest.AfterTest(t)()
1008+
defer log.Scope(t).Close(t)
1009+
9941010
testutils.RunValues(t, "feed type", testTypes, func(t *testing.T, rt rangefeedTestType) {
9951011

9961012
ctx := context.Background()
@@ -1044,6 +1060,8 @@ func TestProcessorConcurrentStop(t *testing.T) {
10441060
// observes only operations that are consumed after it has registered.
10451061
func TestProcessorRegistrationObservesOnlyNewEvents(t *testing.T) {
10461062
defer leaktest.AfterTest(t)()
1063+
defer log.Scope(t).Close(t)
1064+
10471065
testutils.RunValues(t, "feed type", testTypes, func(t *testing.T, rt rangefeedTestType) {
10481066

10491067
p, h, stopper := newTestProcessor(t, withRangefeedTestType(rt))
@@ -1104,6 +1122,8 @@ func TestProcessorRegistrationObservesOnlyNewEvents(t *testing.T) {
11041122

11051123
func TestBudgetReleaseOnProcessorStop(t *testing.T) {
11061124
defer leaktest.AfterTest(t)()
1125+
defer log.Scope(t).Close(t)
1126+
11071127
const totalEvents = 100
11081128

11091129
// Channel capacity is used in two places, processor channel and registration
@@ -1196,6 +1216,7 @@ func TestBudgetReleaseOnProcessorStop(t *testing.T) {
11961216
// budget for discarded pending events is returned.
11971217
func TestBudgetReleaseOnLastStreamError(t *testing.T) {
11981218
defer leaktest.AfterTest(t)()
1219+
defer log.Scope(t).Close(t)
11991220

12001221
const totalEvents = 100
12011222

@@ -1264,6 +1285,7 @@ func newTestBudget(limit int64) *FeedBudget {
12641285
// events.
12651286
func TestBudgetReleaseOnOneStreamError(t *testing.T) {
12661287
defer leaktest.AfterTest(t)()
1288+
defer log.Scope(t).Close(t)
12671289

12681290
const totalEvents = 100
12691291

@@ -1460,6 +1482,7 @@ func TestSizeOfEvent(t *testing.T) {
14601482
// 0 will backpressure senders when a consumer isn't keeping up.
14611483
func TestProcessorBackpressure(t *testing.T) {
14621484
defer leaktest.AfterTest(t)()
1485+
defer log.Scope(t).Close(t)
14631486

14641487
testutils.RunValues(t, "feed type", testTypes, func(t *testing.T, rt rangefeedTestType) {
14651488
ctx, cancel := context.WithCancel(context.Background())
@@ -1534,6 +1557,7 @@ func TestProcessorBackpressure(t *testing.T) {
15341557
// handled by the scheduler.
15351558
func TestProcessorContextCancellation(t *testing.T) {
15361559
defer leaktest.AfterTest(t)()
1560+
defer log.Scope(t).Close(t)
15371561

15381562
// Try stopping both via the stopper and via Processor.Stop().
15391563
testutils.RunTrueAndFalse(t, "stopper", func(t *testing.T, useStopper bool) {
@@ -1590,6 +1614,7 @@ func TestProcessorContextCancellation(t *testing.T) {
15901614
// to start gracefully.
15911615
func TestIntentScannerOnError(t *testing.T) {
15921616
defer leaktest.AfterTest(t)()
1617+
defer log.Scope(t).Close(t)
15931618

15941619
ctx := context.Background()
15951620
stopper := stop.NewStopper()
@@ -1628,6 +1653,7 @@ func TestIntentScannerOnError(t *testing.T) {
16281653
// that disconnects our registration could have been used.
16291654
func TestProcessorMemoryAccountingOnError(t *testing.T) {
16301655
defer leaktest.AfterTest(t)()
1656+
defer log.Scope(t).Close(t)
16311657

16321658
ctx := context.Background()
16331659
stopper := stop.NewStopper()

0 commit comments

Comments
 (0)