Skip to content

Commit

Permalink
add lint ignore directives
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Bozhenko <[email protected]>
  • Loading branch information
alexbozhenko committed Jan 11, 2025
1 parent c2a33ca commit c9acd5a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions jetstream/test/kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,7 @@ func TestKeyValueKeys(t *testing.T) {
expectOk(t, err)
}

//lint:ignore SA1019 testing deprecated api
_, err = kv.Keys(ctx)

Check failure on line 908 in jetstream/test/kv_test.go

View workflow job for this annotation

GitHub Actions / lint

SA1019: kv.Keys is deprecated: Use ListKeys instead to avoid memory issues. (staticcheck)
expectErr(t, err, jetstream.ErrNoKeysFound)

Expand All @@ -918,6 +919,7 @@ func TestKeyValueKeys(t *testing.T) {
put("age", "44")
put("country", "MT")

//lint:ignore SA1019 testing deprecated api
keys, err := kv.Keys(ctx)

Check failure on line 923 in jetstream/test/kv_test.go

View workflow job for this annotation

GitHub Actions / lint

SA1019: kv.Keys is deprecated: Use ListKeys instead to avoid memory issues. (staticcheck)
expectOk(t, err)

Expand Down Expand Up @@ -945,7 +947,9 @@ func TestKeyValueKeys(t *testing.T) {
err = kv.Purge(ctx, "country")
expectOk(t, err)

//lint:ignore SA1019 testing deprecated api
keys, err = kv.Keys(ctx)

Check failure on line 951 in jetstream/test/kv_test.go

View workflow job for this annotation

GitHub Actions / lint

SA1019: kv.Keys is deprecated: Use ListKeys instead to avoid memory issues. (staticcheck)

expectOk(t, err)

kmap = make(map[string]struct{})
Expand Down
2 changes: 1 addition & 1 deletion test/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func TestProperReconnectDelay(t *testing.T) {
ccb := func(_ *nats.Conn) {
closedCbCalled = true
}

//lint:ignore SA1019 testing deprecated api
nc, err := nats.Connect(srvs, nats.DontRandomize(), nats.DisconnectHandler(dcb), nats.ClosedHandler(ccb))
if err != nil {
t.Fatalf("Expected to connect, got err: %v\n", err)
Expand Down
11 changes: 11 additions & 0 deletions test/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ func TestCallbacksOrder(t *testing.T) {

nc, err := nats.Connect(url,
nats.ConnectHandler(connCh),
//lint:ignore SA1019 testing deprecated api
nats.DisconnectHandler(dch),
nats.ReconnectHandler(rch),
nats.ClosedHandler(cch),
Expand Down Expand Up @@ -1718,6 +1719,7 @@ func TestLastErrorNoRace(t *testing.T) {
closedCh <- struct{}{}
}
nc, err := nats.Connect(nats.DefaultURL,
//lint:ignore SA1019 testing deprecated api
nats.DisconnectHandler(dch),
nats.ClosedHandler(cch),
nats.MaxReconnects(-1),
Expand Down Expand Up @@ -1769,7 +1771,10 @@ func TestUseCustomDialer(t *testing.T) {
t.Fatalf("Unexpected error on connect: %v", err)
}
defer nc.Close()

//lint:ignore SA1019 testing deprecated api
if nc.Opts.Dialer != dialer {
//lint:ignore SA1019 testing deprecated api
t.Fatalf("Expected Dialer to be set to %v, got %v", dialer, nc.Opts.Dialer)
}

Expand All @@ -1778,11 +1783,13 @@ func TestUseCustomDialer(t *testing.T) {
Timeout: 5 * time.Second,
FallbackDelay: -1,
}
//lint:ignore SA1019 testing deprecated api
nc2, err := nats.Connect(nats.DefaultURL, nats.Dialer(dialer2))
if err != nil {
t.Fatalf("Unexpected error on connect: %v", err)
}
defer nc2.Close()
//lint:ignore SA1019 testing deprecated api
if nc2.Opts.Dialer.FallbackDelay > 0 {
t.Fatalf("Expected for dialer to be customized to disable dual stack support")
}
Expand All @@ -1793,7 +1800,9 @@ func TestUseCustomDialer(t *testing.T) {
t.Fatalf("Unexpected error on connect: %v", err)
}
defer nc3.Close()
//lint:ignore SA1019 testing deprecated api
if nc3.Opts.Dialer.Timeout != nats.DefaultTimeout {
//lint:ignore SA1019 testing deprecated api
t.Fatalf("Expected Dialer.Timeout to be set to %v, got %v", nats.DefaultTimeout, nc.Opts.Dialer.Timeout)
}

Expand Down Expand Up @@ -1826,6 +1835,7 @@ func TestUseCustomDialer(t *testing.T) {
}
// Same with variadic
foptions := [][]nats.Option{
//lint:ignore SA1019 testing deprecated api
{nats.Dialer(dialer), nats.SetCustomDialer(cdialer)},
{nats.SetCustomDialer(cdialer)},
}
Expand Down Expand Up @@ -1862,6 +1872,7 @@ func TestDefaultOptionsDialer(t *testing.T) {
}
defer nc2.Close()

//lint:ignore SA1019 testing deprecated api
if nc1.Opts.Dialer == nc2.Opts.Dialer {
t.Fatalf("Expected each connection to have its own dialer")
}
Expand Down
2 changes: 2 additions & 0 deletions test/js_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3072,6 +3072,7 @@ func TestStreamLister(t *testing.T) {
}
// test the deprecated StreamsInfo()
infos = make([]*nats.StreamInfo, 0)
//lint:ignore SA1019 testing deprecated api
for info := range js.StreamsInfo() {
infos = append(infos, info)
}
Expand Down Expand Up @@ -3196,6 +3197,7 @@ func TestConsumersLister(t *testing.T) {

// test the deprecated ConsumersInfo()
infos = make([]*nats.ConsumerInfo, 0)
//lint:ignore SA1019 testing deprecated api
for info := range js.ConsumersInfo("foo") {
infos = append(infos, info)
}
Expand Down
3 changes: 3 additions & 0 deletions test/kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ func TestKeyValueKeys(t *testing.T) {
expectOk(t, err)
}

//lint:ignore SA1019 testing deprecated api
_, err = kv.Keys()
expectErr(t, err, nats.ErrNoKeysFound)

Expand All @@ -741,6 +742,7 @@ func TestKeyValueKeys(t *testing.T) {
put("age", "44")
put("country", "MT")

//lint:ignore SA1019 testing deprecated api
keys, err := kv.Keys()
expectOk(t, err)

Expand Down Expand Up @@ -768,6 +770,7 @@ func TestKeyValueKeys(t *testing.T) {
err = kv.Purge("country")
expectOk(t, err)

//lint:ignore SA1019 testing deprecated api
keys, err = kv.Keys()
expectOk(t, err)

Expand Down

0 comments on commit c9acd5a

Please sign in to comment.