Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
samsondav committed Dec 18, 2024
1 parent 9120cd9 commit 95a8a7e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 6 additions & 3 deletions core/services/llo/data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"math"
"math/big"
"sync"
"testing"
Expand Down Expand Up @@ -229,6 +230,10 @@ func BenchmarkObserve(b *testing.B) {
db := pgtest.NewSqlxDB(b)
bridgesORM := bridges.NewORM(db)

if b.N > math.MaxInt32 {
b.Fatalf("N is too large: %d", b.N)
}

n := uint32(b.N)

createBridge(b, "foo-bridge", `123.456`, bridgesORM, 0)
Expand All @@ -249,9 +254,7 @@ func BenchmarkObserve(b *testing.B) {
)

r := streams.NewRegistry(lggr, runner)
for i := uint32(0); i < n; i++ {
jobStreamID := streams.StreamID(i)

for jobStreamID := uint32(0); i < n; i++ {

Check failure on line 257 in core/services/llo/data_source_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

undefined: i

Check failure on line 257 in core/services/llo/data_source_test.go

View workflow job for this annotation

GitHub Actions / lint

undefined: i

Check failure on line 257 in core/services/llo/data_source_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

undefined: i
jb := job.Job{
ID: int32(i),

Check failure on line 259 in core/services/llo/data_source_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

undefined: i

Check failure on line 259 in core/services/llo/data_source_test.go

View workflow job for this annotation

GitHub Actions / lint

undefined: i

Check failure on line 259 in core/services/llo/data_source_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

undefined: i
Name: null.StringFrom(fmt.Sprintf("job-%d", i)),

Check failure on line 260 in core/services/llo/data_source_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

undefined: i

Check failure on line 260 in core/services/llo/data_source_test.go

View workflow job for this annotation

GitHub Actions / lint

undefined: i

Check failure on line 260 in core/services/llo/data_source_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

undefined: i
Expand Down
10 changes: 6 additions & 4 deletions core/services/llo/observation_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"io"
"math"
"math/rand/v2"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -280,6 +281,9 @@ func BenchmarkObservationContext_Observe_integrationRealPipeline_concurrencyStre
db := pgtest.NewSqlxDB(t)
bridgesORM := bridges.NewORM(db)

if b.N > math.MaxInt32 {

Check failure on line 284 in core/services/llo/observation_context_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

undefined: b

Check failure on line 284 in core/services/llo/observation_context_test.go

View workflow job for this annotation

GitHub Actions / lint

undefined: b

Check failure on line 284 in core/services/llo/observation_context_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

undefined: b
b.Fatalf("N is too large: %d", b.N)

Check failure on line 285 in core/services/llo/observation_context_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

undefined: b

Check failure on line 285 in core/services/llo/observation_context_test.go

View workflow job for this annotation

GitHub Actions / lint

undefined: b

Check failure on line 285 in core/services/llo/observation_context_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

undefined: b
}
n := uint32(t.N)

createBridge(t, "foo-bridge", `123.456`, bridgesORM, 0)
Expand All @@ -301,9 +305,7 @@ func BenchmarkObservationContext_Observe_integrationRealPipeline_concurrencyStre

r := streams.NewRegistry(lggr, runner)

for i := uint32(0); i < n; i++ {
jobStreamID := streams.StreamID(i)

for jobStreamID := uint32(0); i < n; i++ {

Check failure on line 308 in core/services/llo/observation_context_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

undefined: i

Check failure on line 308 in core/services/llo/observation_context_test.go

View workflow job for this annotation

GitHub Actions / lint

undefined: i

Check failure on line 308 in core/services/llo/observation_context_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

undefined: i
jb := job.Job{
ID: int32(i),

Check failure on line 310 in core/services/llo/observation_context_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

undefined: i

Check failure on line 310 in core/services/llo/observation_context_test.go

View workflow job for this annotation

GitHub Actions / lint

undefined: i

Check failure on line 310 in core/services/llo/observation_context_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

undefined: i
Name: null.StringFrom(fmt.Sprintf("job-%d", i)),

Check failure on line 311 in core/services/llo/observation_context_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

undefined: i

Check failure on line 311 in core/services/llo/observation_context_test.go

View workflow job for this annotation

GitHub Actions / lint

undefined: i

Check failure on line 311 in core/services/llo/observation_context_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

undefined: i
Expand Down Expand Up @@ -344,7 +346,7 @@ result3 -> result3_parse -> multiply3;
for _, strmID := range []uint32{i, i + n, i + 2*n, i + 3*n} {
g.Go(func() error {
// ignore errors, only care about races
oc.Observe(ctx, strmID, opts)
_ := oc.Observe(ctx, strmID, opts)
return nil
})
}
Expand Down

0 comments on commit 95a8a7e

Please sign in to comment.