diff --git a/.golangci.yml b/.golangci.yml index 9b4140de063..0a1c8ea87ec 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -259,7 +259,6 @@ linters-settings: testifylint: enable-all: true disable: - - expected-actual - float-compare - formatter - require-error diff --git a/bridges/otellogr/convert_test.go b/bridges/otellogr/convert_test.go index bec3f4c4405..d39afb9137e 100644 --- a/bridges/otellogr/convert_test.go +++ b/bridges/otellogr/convert_test.go @@ -300,7 +300,7 @@ func TestConvertValue(t *testing.T) { }, } { t.Run(tt.name, func(t *testing.T) { - assert.Equal(t, convertValue(tt.value), tt.wantValue) + assert.Equal(t, tt.wantValue, convertValue(tt.value)) }) } } diff --git a/config/metric_test.go b/config/metric_test.go index 34ead1fddb9..677fb3704b5 100644 --- a/config/metric_test.go +++ b/config/metric_test.go @@ -806,7 +806,7 @@ func TestInstrumentType(t *testing.T) { t.Run(tt.name, func(t *testing.T) { got, err := instrumentKind(tt.instType) if tt.wantErr != nil { - require.Equal(t, err, tt.wantErr) + require.Equal(t, tt.wantErr, err) require.Zero(t, got) } else { require.NoError(t, err) diff --git a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/aws_test.go b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/aws_test.go index 46edfbd82a7..91c03aec27c 100644 --- a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/aws_test.go +++ b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/aws_test.go @@ -76,7 +76,7 @@ func Test_Span_name(t *testing.T) { operation1 := "" operation2 := "Operation" - assert.Equal(t, spanName(serviceID1, operation1), "") + assert.Equal(t, "", spanName(serviceID1, operation1)) assert.Equal(t, spanName(serviceID1, operation2), "."+operation2) assert.Equal(t, spanName(serviceID2, operation1), serviceID2) assert.Equal(t, spanName(serviceID2, operation2), serviceID2+"."+operation2) diff --git a/instrumentation/github.com/emicklei/go-restful/otelrestful/test/restful_test.go b/instrumentation/github.com/emicklei/go-restful/otelrestful/test/restful_test.go index b34c6dc7344..4c0845086e5 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/test/restful_test.go +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/test/restful_test.go @@ -188,7 +188,7 @@ func TestSpanStatus(t *testing.T) { container.ServeHTTP(httptest.NewRecorder(), httptest.NewRequest("GET", "/", nil)) require.Len(t, sr.Ended(), 1, "should emit a span") - assert.Equal(t, sr.Ended()[0].Status().Code, tc.wantSpanStatus, "should only set Error status for HTTP statuses >= 500") + assert.Equal(t, tc.wantSpanStatus, sr.Ended()[0].Status().Code, "should only set Error status for HTTP statuses >= 500") }) } } diff --git a/instrumentation/github.com/gin-gonic/gin/otelgin/test/gintrace_test.go b/instrumentation/github.com/gin-gonic/gin/otelgin/test/gintrace_test.go index 6af02d2cbd2..fb8698422dc 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/test/gintrace_test.go +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/test/gintrace_test.go @@ -148,7 +148,7 @@ func TestSpanStatus(t *testing.T) { router.ServeHTTP(httptest.NewRecorder(), httptest.NewRequest("GET", "/", nil)) require.Len(t, sr.Ended(), 1, "should emit a span") - assert.Equal(t, sr.Ended()[0].Status().Code, tc.wantSpanStatus, "should only set Error status for HTTP statuses >= 500") + assert.Equal(t, tc.wantSpanStatus, sr.Ended()[0].Status().Code, "should only set Error status for HTTP statuses >= 500") }) } } @@ -174,7 +174,7 @@ func TestSpanName(t *testing.T) { router.ServeHTTP(httptest.NewRecorder(), httptest.NewRequest("GET", tc.requestPath, nil)) require.Len(t, sr.Ended(), 1, "should emit a span") - assert.Equal(t, sr.Ended()[0].Name(), tc.wantSpanName, "span name not correct") + assert.Equal(t, tc.wantSpanName, sr.Ended()[0].Name(), "span name not correct") }) } } diff --git a/instrumentation/github.com/gorilla/mux/otelmux/test/mux_test.go b/instrumentation/github.com/gorilla/mux/otelmux/test/mux_test.go index 8f370ce59ba..b009022b1bb 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/test/mux_test.go +++ b/instrumentation/github.com/gorilla/mux/otelmux/test/mux_test.go @@ -133,7 +133,7 @@ func TestNotFoundIsNotError(t *testing.T) { attribute.String("http.method", "GET"), attribute.String("http.route", "/does/not/exist"), ) - assert.Equal(t, sr.Ended()[0].Status().Code, codes.Unset) + assert.Equal(t, codes.Unset, sr.Ended()[0].Status().Code) } func assertSpan(t *testing.T, span sdktrace.ReadOnlySpan, name string, kind trace.SpanKind, attrs ...attribute.KeyValue) { @@ -148,7 +148,7 @@ func assertSpan(t *testing.T, span sdktrace.ReadOnlySpan, name string, kind trac if !assert.Contains(t, got, want.Key) { continue } - assert.Equal(t, got[want.Key], want.Value) + assert.Equal(t, want.Value, got[want.Key]) } } diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/metadata_supplier_test.go b/instrumentation/google.golang.org/grpc/otelgrpc/metadata_supplier_test.go index 7805a4af307..539258871e8 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/metadata_supplier_test.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/metadata_supplier_test.go @@ -17,12 +17,12 @@ func TestMetadataSupplier(t *testing.T) { ms := &metadataSupplier{&md} v1 := ms.Get("k1") - assert.Equal(t, v1, "v1") + assert.Equal(t, "v1", v1) ms.Set("k2", "v2") v1 = ms.Get("k1") v2 := ms.Get("k2") - assert.Equal(t, v1, "v1") - assert.Equal(t, v2, "v2") + assert.Equal(t, "v1", v1) + assert.Equal(t, "v2", v2) } diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/macaron_test.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/macaron_test.go index 0cb317e96b2..825a9f1dc5d 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/macaron_test.go +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/test/macaron_test.go @@ -107,7 +107,7 @@ func TestSpanStatus(t *testing.T) { m.ServeHTTP(httptest.NewRecorder(), httptest.NewRequest("GET", "/", nil)) require.Len(t, sr.Ended(), 1, "should emit a span") - assert.Equal(t, sr.Ended()[0].Status().Code, tc.wantSpanStatus, "should only set Error status for HTTP statuses >= 500") + assert.Equal(t, tc.wantSpanStatus, sr.Ended()[0].Status().Code, "should only set Error status for HTTP statuses >= 500") }) } } diff --git a/instrumentation/net/http/otelhttp/test/handler_test.go b/instrumentation/net/http/otelhttp/test/handler_test.go index 726f318e2c1..31c174af8e3 100644 --- a/instrumentation/net/http/otelhttp/test/handler_test.go +++ b/instrumentation/net/http/otelhttp/test/handler_test.go @@ -495,7 +495,7 @@ func TestSpanStatus(t *testing.T) { h.ServeHTTP(httptest.NewRecorder(), httptest.NewRequest("GET", "/", nil)) require.Len(t, sr.Ended(), 1, "should emit a span") - assert.Equal(t, sr.Ended()[0].Status().Code, tc.wantSpanStatus, "should only set Error status for HTTP statuses >= 500") + assert.Equal(t, tc.wantSpanStatus, sr.Ended()[0].Status().Code, "should only set Error status for HTTP statuses >= 500") }) } } diff --git a/propagators/aws/xray/idgenerator_test.go b/propagators/aws/xray/idgenerator_test.go index bf3cd0d4c51..6b8465b2619 100644 --- a/propagators/aws/xray/idgenerator_test.go +++ b/propagators/aws/xray/idgenerator_test.go @@ -21,7 +21,7 @@ func TestTraceIDIsValidLength(t *testing.T) { traceID, _ := idg.NewIDs(context.Background()) expectedTraceIDLength := 32 - assert.Equal(t, len(traceID.String()), expectedTraceIDLength, "TraceID has incorrect length.") + assert.Len(t, traceID.String(), expectedTraceIDLength, "TraceID has incorrect length.") } func TestTraceIDIsUnique(t *testing.T) { @@ -63,8 +63,8 @@ func TestSpanIDIsValidLength(t *testing.T) { spanID2 := idg.NewSpanID(context.Background(), traceID) expectedSpanIDLength := 16 - assert.Equal(t, len(spanID1.String()), expectedSpanIDLength, "SpanID has incorrect length") - assert.Equal(t, len(spanID2.String()), expectedSpanIDLength, "SpanID has incorrect length") + assert.Len(t, spanID1.String(), expectedSpanIDLength, "SpanID has incorrect length") + assert.Len(t, spanID2.String(), expectedSpanIDLength, "SpanID has incorrect length") } func TestSpanIDIsUnique(t *testing.T) { diff --git a/samplers/aws/xray/fallback_sampler_test.go b/samplers/aws/xray/fallback_sampler_test.go index 39c4609c8be..d912449fd01 100644 --- a/samplers/aws/xray/fallback_sampler_test.go +++ b/samplers/aws/xray/fallback_sampler_test.go @@ -16,7 +16,7 @@ import ( func TestSampleUsingFallbackSampler(t *testing.T) { fs := NewFallbackSampler() assert.NotEmpty(t, fs.defaultSampler) - assert.Equal(t, fs.quotaBalance, 1.0) + assert.Equal(t, 1.0, fs.quotaBalance) sd := fs.ShouldSample(trace.SamplingParameters{}) assert.Equal(t, trace.RecordAndSample, sd.Decision) @@ -52,12 +52,12 @@ func TestBorrowWithLargeElapsedTime(t *testing.T) { // Increase the time by 9 seconds borrowed = fs.take(time.Unix(1500000009, 0), 1.0) assert.True(t, borrowed) - assert.Equal(t, fs.quotaBalance, 0.0) + assert.Equal(t, 0.0, fs.quotaBalance) } // assert fallback sampling description. func TestFallbackSamplerDescription(t *testing.T) { fs := NewFallbackSampler() s := fs.Description() - assert.Equal(t, s, "FallbackSampler{fallback sampling with sampling config of 1 req/sec and 5% of additional requests}") + assert.Equal(t, "FallbackSampler{fallback sampling with sampling config of 1 req/sec and 5% of additional requests}", s) } diff --git a/samplers/aws/xray/internal/client_test.go b/samplers/aws/xray/internal/client_test.go index 2492477de45..9acace7506d 100644 --- a/samplers/aws/xray/internal/client_test.go +++ b/samplers/aws/xray/internal/client_test.go @@ -100,26 +100,26 @@ func TestGetSamplingRules(t *testing.T) { samplingRules, err := client.getSamplingRules(ctx) require.NoError(t, err) - assert.Equal(t, samplingRules.SamplingRuleRecords[0].SamplingRule.RuleName, "Default") - assert.Equal(t, samplingRules.SamplingRuleRecords[0].SamplingRule.ServiceType, "*") - assert.Equal(t, samplingRules.SamplingRuleRecords[0].SamplingRule.Host, "*") - assert.Equal(t, samplingRules.SamplingRuleRecords[0].SamplingRule.URLPath, "*") - assert.Equal(t, samplingRules.SamplingRuleRecords[0].SamplingRule.ReservoirSize, 60.0) - assert.Equal(t, samplingRules.SamplingRuleRecords[0].SamplingRule.FixedRate, 0.5) - - assert.Equal(t, samplingRules.SamplingRuleRecords[1].SamplingRule.RuleName, "test-rule") - assert.Equal(t, samplingRules.SamplingRuleRecords[1].SamplingRule.ServiceType, "local") - assert.Equal(t, samplingRules.SamplingRuleRecords[1].SamplingRule.Host, "*") - assert.Equal(t, samplingRules.SamplingRuleRecords[1].SamplingRule.URLPath, "/aws-sdk-call") - assert.Equal(t, samplingRules.SamplingRuleRecords[1].SamplingRule.ReservoirSize, 3.0) - assert.Equal(t, samplingRules.SamplingRuleRecords[1].SamplingRule.FixedRate, 0.09) - - assert.Equal(t, samplingRules.SamplingRuleRecords[2].SamplingRule.RuleName, "test-rule-1") - assert.Equal(t, samplingRules.SamplingRuleRecords[2].SamplingRule.ServiceType, "*") - assert.Equal(t, samplingRules.SamplingRuleRecords[2].SamplingRule.Host, "*") - assert.Equal(t, samplingRules.SamplingRuleRecords[2].SamplingRule.URLPath, "*") - assert.Equal(t, samplingRules.SamplingRuleRecords[2].SamplingRule.ReservoirSize, 100.0) - assert.Equal(t, samplingRules.SamplingRuleRecords[2].SamplingRule.FixedRate, 0.09) + assert.Equal(t, "Default", samplingRules.SamplingRuleRecords[0].SamplingRule.RuleName) + assert.Equal(t, "*", samplingRules.SamplingRuleRecords[0].SamplingRule.ServiceType) + assert.Equal(t, "*", samplingRules.SamplingRuleRecords[0].SamplingRule.Host) + assert.Equal(t, "*", samplingRules.SamplingRuleRecords[0].SamplingRule.URLPath) + assert.Equal(t, 60.0, samplingRules.SamplingRuleRecords[0].SamplingRule.ReservoirSize) + assert.Equal(t, 0.5, samplingRules.SamplingRuleRecords[0].SamplingRule.FixedRate) + + assert.Equal(t, "test-rule", samplingRules.SamplingRuleRecords[1].SamplingRule.RuleName) + assert.Equal(t, "local", samplingRules.SamplingRuleRecords[1].SamplingRule.ServiceType) + assert.Equal(t, "*", samplingRules.SamplingRuleRecords[1].SamplingRule.Host) + assert.Equal(t, "/aws-sdk-call", samplingRules.SamplingRuleRecords[1].SamplingRule.URLPath) + assert.Equal(t, 3.0, samplingRules.SamplingRuleRecords[1].SamplingRule.ReservoirSize) + assert.Equal(t, 0.09, samplingRules.SamplingRuleRecords[1].SamplingRule.FixedRate) + + assert.Equal(t, "test-rule-1", samplingRules.SamplingRuleRecords[2].SamplingRule.RuleName) + assert.Equal(t, "*", samplingRules.SamplingRuleRecords[2].SamplingRule.ServiceType) + assert.Equal(t, "*", samplingRules.SamplingRuleRecords[2].SamplingRule.Host) + assert.Equal(t, "*", samplingRules.SamplingRuleRecords[2].SamplingRule.URLPath) + assert.Equal(t, 100.0, samplingRules.SamplingRuleRecords[2].SamplingRule.ReservoirSize) + assert.Equal(t, 0.09, samplingRules.SamplingRuleRecords[2].SamplingRule.FixedRate) } func TestGetSamplingRulesWithMissingValues(t *testing.T) { @@ -153,11 +153,11 @@ func TestGetSamplingRulesWithMissingValues(t *testing.T) { require.NoError(t, err) // Priority and ReservoirSize are missing in API response so they are assigned as nil - assert.Equal(t, samplingRules.SamplingRuleRecords[0].SamplingRule.Priority, int64(0)) - assert.Equal(t, samplingRules.SamplingRuleRecords[0].SamplingRule.ReservoirSize, 0.0) + assert.Equal(t, int64(0), samplingRules.SamplingRuleRecords[0].SamplingRule.Priority) + assert.Equal(t, 0.0, samplingRules.SamplingRuleRecords[0].SamplingRule.ReservoirSize) // other values are stored as expected - assert.Equal(t, samplingRules.SamplingRuleRecords[0].SamplingRule.RuleName, "Default") + assert.Equal(t, "Default", samplingRules.SamplingRuleRecords[0].SamplingRule.RuleName) } func TestGetSamplingTargets(t *testing.T) { @@ -188,15 +188,15 @@ func TestGetSamplingTargets(t *testing.T) { samplingTragets, err := client.getSamplingTargets(ctx, nil) require.NoError(t, err) - assert.Equal(t, *samplingTragets.LastRuleModification, float64(123456)) - assert.Equal(t, *samplingTragets.SamplingTargetDocuments[0].FixedRate, float64(5)) - assert.Equal(t, *samplingTragets.SamplingTargetDocuments[0].Interval, int64(5)) - assert.Equal(t, *samplingTragets.SamplingTargetDocuments[0].ReservoirQuota, 3.0) - assert.Equal(t, *samplingTragets.SamplingTargetDocuments[0].ReservoirQuotaTTL, float64(456789)) - assert.Equal(t, *samplingTragets.SamplingTargetDocuments[0].RuleName, "r1") - assert.Equal(t, *samplingTragets.UnprocessedStatistics[0].RuleName, "r1") - assert.Equal(t, *samplingTragets.UnprocessedStatistics[0].ErrorCode, "200") - assert.Equal(t, *samplingTragets.UnprocessedStatistics[0].Message, "ok") + assert.Equal(t, float64(123456), *samplingTragets.LastRuleModification) + assert.Equal(t, float64(5), *samplingTragets.SamplingTargetDocuments[0].FixedRate) + assert.Equal(t, int64(5), *samplingTragets.SamplingTargetDocuments[0].Interval) + assert.Equal(t, 3.0, *samplingTragets.SamplingTargetDocuments[0].ReservoirQuota) + assert.Equal(t, float64(456789), *samplingTragets.SamplingTargetDocuments[0].ReservoirQuotaTTL) + assert.Equal(t, "r1", *samplingTragets.SamplingTargetDocuments[0].RuleName) + assert.Equal(t, "r1", *samplingTragets.UnprocessedStatistics[0].RuleName) + assert.Equal(t, "200", *samplingTragets.UnprocessedStatistics[0].ErrorCode) + assert.Equal(t, "ok", *samplingTragets.UnprocessedStatistics[0].Message) } func TestGetSamplingTargetsMissingValues(t *testing.T) { diff --git a/samplers/aws/xray/internal/manifest_test.go b/samplers/aws/xray/internal/manifest_test.go index fd69cdf0aba..8840cdc7875 100644 --- a/samplers/aws/xray/internal/manifest_test.go +++ b/samplers/aws/xray/internal/manifest_test.go @@ -712,8 +712,8 @@ func TestRefreshManifestTargets(t *testing.T) { // assert target updates require.Len(t, m.Rules, 1) - assert.Equal(t, m.Rules[0].ruleProperties.FixedRate, 0.06) - assert.Equal(t, m.Rules[0].reservoir.quota, 23.0) + assert.Equal(t, 0.06, m.Rules[0].ruleProperties.FixedRate) + assert.Equal(t, 23.0, m.Rules[0].reservoir.quota) assert.Equal(t, m.Rules[0].reservoir.expiresAt, time.Unix(15000000, 0)) assert.Equal(t, m.Rules[0].reservoir.interval, time.Duration(25)) } @@ -1773,13 +1773,13 @@ func TestDoNotPreserveRulesWithDifferentRuleProperties(t *testing.T) { SamplingRuleRecords: []*samplingRuleRecords{&ruleRecords}, }) - require.Equal(t, m.Rules[0].reservoir.quota, 0.0) - require.Equal(t, m.Rules[0].reservoir.quotaBalance, 0.0) - require.Equal(t, *m.Rules[0].samplingStatistics, samplingStatistics{ + require.Equal(t, 0.0, m.Rules[0].reservoir.quota) + require.Equal(t, 0.0, m.Rules[0].reservoir.quotaBalance) + require.Equal(t, samplingStatistics{ matchedRequests: 0, sampledRequests: 0, borrowedRequests: 0, - }) + }, *m.Rules[0].samplingStatistics) } // validate no data race is when capturing sampling statistics in manifest while sampling. diff --git a/samplers/aws/xray/internal/reservoir_test.go b/samplers/aws/xray/internal/reservoir_test.go index cfb4eee371a..e334f5b26c2 100644 --- a/samplers/aws/xray/internal/reservoir_test.go +++ b/samplers/aws/xray/internal/reservoir_test.go @@ -121,11 +121,11 @@ func TestConsumeFromReservoir(t *testing.T) { // reservoir updates the quotaBalance for new second and allows to consume // quota balance is 0 because we are consuming from reservoir for the first time - assert.Equal(t, r.quotaBalance, 0.0) + assert.Equal(t, 0.0, r.quotaBalance) assert.True(t, r.take(clock.now(), false, 1.0)) - assert.Equal(t, r.quotaBalance, 1.0) + assert.Equal(t, 1.0, r.quotaBalance) assert.True(t, r.take(clock.now(), false, 1.0)) - assert.Equal(t, r.quotaBalance, 0.0) + assert.Equal(t, 0.0, r.quotaBalance) // once assigned quota is consumed reservoir does not allow to consume in that second assert.False(t, r.take(clock.now(), false, 1.0)) @@ -133,11 +133,11 @@ func TestConsumeFromReservoir(t *testing.T) { clock.nowTime = 1500000001 // reservoir updates the quotaBalance for new second and allows to consume - assert.Equal(t, r.quotaBalance, 0.0) + assert.Equal(t, 0.0, r.quotaBalance) assert.True(t, r.take(clock.now(), false, 1.0)) - assert.Equal(t, r.quotaBalance, 1.0) + assert.Equal(t, 1.0, r.quotaBalance) assert.True(t, r.take(clock.now(), false, 1.0)) - assert.Equal(t, r.quotaBalance, 0.0) + assert.Equal(t, 0.0, r.quotaBalance) // once assigned quota is consumed reservoir does not allow to consume in that second assert.False(t, r.take(clock.now(), false, 1.0)) @@ -145,11 +145,11 @@ func TestConsumeFromReservoir(t *testing.T) { clock.nowTime = 1500000005 // reservoir updates the quotaBalance with one second worth of quota (even though 4 seconds have passed) and allows to consume - assert.Equal(t, r.quotaBalance, 0.0) + assert.Equal(t, 0.0, r.quotaBalance) assert.True(t, r.take(clock.now(), false, 1.0)) - assert.Equal(t, r.quotaBalance, 1.0) + assert.Equal(t, 1.0, r.quotaBalance) assert.True(t, r.take(clock.now(), false, 1.0)) - assert.Equal(t, r.quotaBalance, 0.0) + assert.Equal(t, 0.0, r.quotaBalance) } func TestZeroCapacityFailBorrow(t *testing.T) { @@ -163,7 +163,7 @@ func TestZeroCapacityFailBorrow(t *testing.T) { } // start with no quota balance - assert.Equal(t, r.quotaBalance, 0.0) + assert.Equal(t, 0.0, r.quotaBalance) // attempt to borrow from reservoir, and should fail since there is no capacity assert.False(t, r.take(clock.now(), true, 1.0)) @@ -171,7 +171,7 @@ func TestZeroCapacityFailBorrow(t *testing.T) { clock.nowTime = 1500000005 // validate there is still no quota balance - assert.Equal(t, r.quotaBalance, 0.0) + assert.Equal(t, 0.0, r.quotaBalance) // again, attempt to borrow from reservoir, and should fail since there is no capacity assert.False(t, r.take(clock.now(), true, 1.0)) } @@ -219,7 +219,7 @@ func TestQuotaBalanceAfterPortionOfSecond(t *testing.T) { r.refreshQuotaBalanceLocked(clock.now(), false) // assert that after half a second, quotaBalance is now quota*0.5 = 3 - assert.Equal(t, r.quotaBalance, 3.0) + assert.Equal(t, 3.0, r.quotaBalance) } // assert quotaBalance and capacity of borrowing case. diff --git a/samplers/aws/xray/internal/rule_test.go b/samplers/aws/xray/internal/rule_test.go index 051e7370ce5..a4ce856ec66 100644 --- a/samplers/aws/xray/internal/rule_test.go +++ b/samplers/aws/xray/internal/rule_test.go @@ -209,7 +209,7 @@ func TestTraceIDRatioBasedSamplerFixedRateZero(t *testing.T) { now := time.Unix(1500000000, 0) sd := r1.Sample(trace.SamplingParameters{}, now) - assert.Equal(t, sd.Decision, trace.Drop) + assert.Equal(t, trace.Drop, sd.Decision) } func TestAppliesToMatchingWithAllAttrs(t *testing.T) { diff --git a/samplers/aws/xray/remote_sampler_config_test.go b/samplers/aws/xray/remote_sampler_config_test.go index 29e77dcebf9..c2906ca09a2 100644 --- a/samplers/aws/xray/remote_sampler_config_test.go +++ b/samplers/aws/xray/remote_sampler_config_test.go @@ -22,9 +22,9 @@ func TestNewConfig(t *testing.T) { cfg, err := newConfig(WithSamplingRulesPollingInterval(400*time.Second), WithEndpoint(*endpoint), WithLogger(logr.Logger{})) require.NoError(t, err) - assert.Equal(t, cfg.samplingRulesPollingInterval, 400*time.Second) + assert.Equal(t, 400*time.Second, cfg.samplingRulesPollingInterval) assert.Equal(t, cfg.endpoint, *endpoint) - assert.Equal(t, cfg.logger, logr.Logger{}) + assert.Equal(t, logr.Logger{}, cfg.logger) } // assert that when user did not provide values are then config would be picked up from default values. @@ -35,7 +35,7 @@ func TestDefaultConfig(t *testing.T) { cfg, err := newConfig() require.NoError(t, err) - assert.Equal(t, cfg.samplingRulesPollingInterval, 300*time.Second) + assert.Equal(t, 300*time.Second, cfg.samplingRulesPollingInterval) assert.Equal(t, cfg.endpoint, *endpoint) assert.Equal(t, cfg.logger, defaultLogger) } @@ -48,7 +48,7 @@ func TestPartialUserProvidedConfig(t *testing.T) { cfg, err := newConfig(WithSamplingRulesPollingInterval(500 * time.Second)) require.NoError(t, err) - assert.Equal(t, cfg.samplingRulesPollingInterval, 500*time.Second) + assert.Equal(t, 500*time.Second, cfg.samplingRulesPollingInterval) assert.Equal(t, cfg.endpoint, *endpoint) assert.Equal(t, cfg.logger, defaultLogger) } diff --git a/samplers/aws/xray/remote_sampler_test.go b/samplers/aws/xray/remote_sampler_test.go index a1e62a7b189..a71020abbe0 100644 --- a/samplers/aws/xray/remote_sampler_test.go +++ b/samplers/aws/xray/remote_sampler_test.go @@ -14,5 +14,5 @@ func TestRemoteSamplerDescription(t *testing.T) { rs := &remoteSampler{} s := rs.Description() - assert.Equal(t, s, "AWSXRayRemoteSampler{remote sampling with AWS X-Ray}") + assert.Equal(t, "AWSXRayRemoteSampler{remote sampling with AWS X-Ray}", s) } diff --git a/samplers/jaegerremote/sampler_remote_test.go b/samplers/jaegerremote/sampler_remote_test.go index 6bdcb013f88..79d711a5f38 100644 --- a/samplers/jaegerremote/sampler_remote_test.go +++ b/samplers/jaegerremote/sampler_remote_test.go @@ -131,7 +131,7 @@ func TestRemoteSamplerOptions(t *testing.T) { assert.Equal(t, 42*time.Second, sampler.samplingRefreshInterval) assert.Same(t, fetcher, sampler.samplingFetcher) assert.Same(t, parser, sampler.samplingParser) - assert.EqualValues(t, sampler.updaters[0], &perOperationSamplerUpdater{MaxOperations: 42, OperationNameLateBinding: true}) + assert.EqualValues(t, &perOperationSamplerUpdater{MaxOperations: 42, OperationNameLateBinding: true}, sampler.updaters[0]) assert.Equal(t, logger, sampler.logger) } diff --git a/samplers/jaegerremote/sampler_test.go b/samplers/jaegerremote/sampler_test.go index f71bdb0dc0d..243536a5a4e 100644 --- a/samplers/jaegerremote/sampler_test.go +++ b/samplers/jaegerremote/sampler_test.go @@ -117,7 +117,7 @@ func TestAdaptiveSampler(t *testing.T) { assert.Equal(t, 42, sampler.maxOperations) sampler = newPerOperationSampler(perOperationSamplerParams{Strategies: strategies}) - assert.Equal(t, sampler.maxOperations, 2000, "default MaxOperations applied") + assert.Equal(t, 2000, sampler.maxOperations, "default MaxOperations applied") sampler = newPerOperationSampler(perOperationSamplerParams{ MaxOperations: testDefaultMaxOperations, diff --git a/samplers/probability/consistent/base2_test.go b/samplers/probability/consistent/base2_test.go index 4430c7eadd5..66334df4d96 100644 --- a/samplers/probability/consistent/base2_test.go +++ b/samplers/probability/consistent/base2_test.go @@ -10,8 +10,8 @@ import ( ) func TestSplitProb(t *testing.T) { - require.Equal(t, -1, expFromFloat64(0.6)) - require.Equal(t, -2, expFromFloat64(0.4)) + require.Equal(t, -1, expFromFloat64(0.6)) //nolint:testifylint // false positive on expected-actual + require.Equal(t, -2, expFromFloat64(0.4)) //nolint:testifylint // false positive on expected-actual require.Equal(t, 0.5, expToFloat64(-1)) require.Equal(t, 0.25, expToFloat64(-2))