From 33a54575731944cba22229d14098c45bb5b6c285 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 13:29:33 -0700 Subject: [PATCH] fix(deps): update module github.com/antonboom/testifylint to v1.5.0 (#35797) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/Antonboom/testifylint](https://redirect.github.com/Antonboom/testifylint) | `v1.4.3` -> `v1.5.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fAntonboom%2ftestifylint/v1.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fAntonboom%2ftestifylint/v1.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fAntonboom%2ftestifylint/v1.4.3/v1.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fAntonboom%2ftestifylint/v1.4.3/v1.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes
Antonboom/testifylint (github.com/Antonboom/testifylint) ### [`v1.5.0`](https://redirect.github.com/Antonboom/testifylint/releases/tag/v1.5.0): New `contains`, `regexp`, `encoded-compare'`! [Compare Source](https://redirect.github.com/Antonboom/testifylint/compare/v1.4.3...v1.5.0) #### What's Changed - ci: checkout before setup-go by [@​mmorel-35](https://redirect.github.com/mmorel-35) in [https://github.com/Antonboom/testifylint/pull/137](https://redirect.github.com/Antonboom/testifylint/pull/137) - new checker 'regexp' by [@​Antonboom](https://redirect.github.com/Antonboom) in [https://github.com/Antonboom/testifylint/pull/136](https://redirect.github.com/Antonboom/testifylint/pull/136) - new checker `contains` by [@​mmorel-35](https://redirect.github.com/mmorel-35) in [https://github.com/Antonboom/testifylint/pull/152](https://redirect.github.com/Antonboom/testifylint/pull/152) - build(deps): bump golang.org/x/tools from 0.21.0 to 0.22.0 by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/Antonboom/testifylint/pull/163](https://redirect.github.com/Antonboom/testifylint/pull/163) - build(deps): bump golang.org/x/tools from 0.22.0 to 0.23.0 by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/Antonboom/testifylint/pull/168](https://redirect.github.com/Antonboom/testifylint/pull/168) - enable several rules from revive by [@​mmorel-35](https://redirect.github.com/mmorel-35) in [https://github.com/Antonboom/testifylint/pull/164](https://redirect.github.com/Antonboom/testifylint/pull/164) - build(deps): bump golang.org/x/tools from 0.23.0 to 0.24.0 by [@​dependabot](https://redirect.github.com/dependabot) in [https://github.com/Antonboom/testifylint/pull/173](https://redirect.github.com/Antonboom/testifylint/pull/173) - useless-assert: more cases by [@​Antonboom](https://redirect.github.com/Antonboom) in [https://github.com/Antonboom/testifylint/pull/182](https://redirect.github.com/Antonboom/testifylint/pull/182) - formatter: support require only and suite only packages by [@​Antonboom](https://redirect.github.com/Antonboom) in [https://github.com/Antonboom/testifylint/pull/188](https://redirect.github.com/Antonboom/testifylint/pull/188) - new checker 'encoded-compare' by [@​Antonboom](https://redirect.github.com/Antonboom) in [https://github.com/Antonboom/testifylint/pull/179](https://redirect.github.com/Antonboom/testifylint/pull/179) - empty: adjust report for NotEmpty+len cases by [@​Antonboom](https://redirect.github.com/Antonboom) in [https://github.com/Antonboom/testifylint/pull/189](https://redirect.github.com/Antonboom/testifylint/pull/189) - error-nil: support Empty and Zero error by [@​mmorel-35](https://redirect.github.com/mmorel-35) in [https://github.com/Antonboom/testifylint/pull/153](https://redirect.github.com/Antonboom/testifylint/pull/153) - Go 1.23 by [@​Antonboom](https://redirect.github.com/Antonboom) in [https://github.com/Antonboom/testifylint/pull/191](https://redirect.github.com/Antonboom/testifylint/pull/191) **Full Changelog**: https://github.com/Antonboom/testifylint/compare/v1.4.3...v1.5.0
--- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). --------- Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com> Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com> --- .../awsemfexporter/grouped_metric_test.go | 2 +- .../internal/translator/cause_test.go | 4 +- .../internal/translator/http_test.go | 31 ++++---- .../internal/translator/segment_test.go | 67 +++++++++-------- .../internal/translator/service_test.go | 5 +- .../internal/translator/span_links_test.go | 71 +++++++++---------- .../internal/translator/sql_test.go | 3 +- .../elasticsearchexporter/exporter_test.go | 20 +++--- .../logs_exporter_test.go | 3 +- exporter/mezmoexporter/exporter_test.go | 2 +- .../pulsarexporter/jaeger_marshaler_test.go | 2 +- exporter/pulsarexporter/marshaler_test.go | 4 +- .../metricdata_to_splunk_test.go | 2 +- .../syslogexporter/rfc5424_formatter_test.go | 9 ++- .../extension_test.go | 2 +- .../jsonlogencodingextension/json_test.go | 4 +- .../healthcheckextension/integration_test.go | 2 +- .../healthcheckv2extension/extension_test.go | 2 +- .../internal/http/server_test.go | 2 +- .../httpforwarderextension/extension_test.go | 2 +- .../httpforwarderextension/factory_test.go | 3 +- .../internal/http_test.go | 2 +- internal/tools/go.mod | 6 +- internal/tools/go.sum | 4 +- pkg/stanza/operator/operatortest/confmap.go | 3 +- processor/remotetapprocessor/server_test.go | 6 +- .../internal/cache/lru_cache_test.go | 4 +- ..._exponential_hist_to_explicit_hist_test.go | 3 +- .../handlecount/handles_windows_test.go | 3 +- receiver/splunkhecreceiver/receiver_test.go | 16 ++--- 30 files changed, 140 insertions(+), 149 deletions(-) diff --git a/exporter/awsemfexporter/grouped_metric_test.go b/exporter/awsemfexporter/grouped_metric_test.go index e7c176f82b01..d2b1a86610f0 100644 --- a/exporter/awsemfexporter/grouped_metric_test.go +++ b/exporter/awsemfexporter/grouped_metric_test.go @@ -435,7 +435,7 @@ func TestAddKubernetesWrapper(t *testing.T) { jsonBytes, _ := json.Marshal(expectedCreatedObj) addKubernetesWrapper(inputs) - assert.Equal(t, string(jsonBytes), inputs["kubernetes"], "The created and expected objects should be the same") + assert.JSONEq(t, string(jsonBytes), inputs["kubernetes"], "The created and expected objects should be the same") }) } diff --git a/exporter/awsxrayexporter/internal/translator/cause_test.go b/exporter/awsxrayexporter/internal/translator/cause_test.go index 0369d7066d73..6f4dbfcd9eb0 100644 --- a/exporter/awsxrayexporter/internal/translator/cause_test.go +++ b/exporter/awsxrayexporter/internal/translator/cause_test.go @@ -193,7 +193,7 @@ func TestCauseWithStatusMessage(t *testing.T) { require.NoError(t, w.Encode(cause)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, errorMsg)) + assert.Contains(t, jsonStr, errorMsg) } func TestCauseWithHttpStatusMessage(t *testing.T) { @@ -218,7 +218,7 @@ func TestCauseWithHttpStatusMessage(t *testing.T) { require.NoError(t, w.Encode(cause)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, errorMsg)) + assert.Contains(t, jsonStr, errorMsg) } func TestCauseWithZeroStatusMessageAndFaultHttpCode(t *testing.T) { diff --git a/exporter/awsxrayexporter/internal/translator/http_test.go b/exporter/awsxrayexporter/internal/translator/http_test.go index f34c4e82af59..d0f8b375c72f 100644 --- a/exporter/awsxrayexporter/internal/translator/http_test.go +++ b/exporter/awsxrayexporter/internal/translator/http_test.go @@ -4,7 +4,6 @@ package translator import ( - "strings" "testing" "time" @@ -31,7 +30,7 @@ func TestClientSpanWithURLAttribute(t *testing.T) { require.NoError(t, w.Encode(httpData)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "https://api.example.com/users/junit")) + assert.Contains(t, jsonStr, "https://api.example.com/users/junit") } func TestClientSpanWithURLAttributeStable(t *testing.T) { @@ -49,7 +48,7 @@ func TestClientSpanWithURLAttributeStable(t *testing.T) { require.NoError(t, w.Encode(httpData)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "https://api.example.com/users/junit")) + assert.Contains(t, jsonStr, "https://api.example.com/users/junit") } func TestClientSpanWithSchemeHostTargetAttributes(t *testing.T) { @@ -70,7 +69,7 @@ func TestClientSpanWithSchemeHostTargetAttributes(t *testing.T) { require.NoError(t, w.Encode(httpData)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "https://api.example.com/users/junit")) + assert.Contains(t, jsonStr, "https://api.example.com/users/junit") } func TestClientSpanWithPeerAttributes(t *testing.T) { @@ -95,7 +94,7 @@ func TestClientSpanWithPeerAttributes(t *testing.T) { require.NoError(t, w.Encode(httpData)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "http://kb234.example.com:8080/users/junit")) + assert.Contains(t, jsonStr, "http://kb234.example.com:8080/users/junit") } func TestClientSpanWithPeerAttributesStable(t *testing.T) { @@ -120,7 +119,7 @@ func TestClientSpanWithPeerAttributesStable(t *testing.T) { require.NoError(t, w.Encode(httpData)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "http://kb234.example.com:8080/users/junit")) + assert.Contains(t, jsonStr, "http://kb234.example.com:8080/users/junit") } func TestClientSpanWithHttpPeerAttributes(t *testing.T) { @@ -168,7 +167,7 @@ func TestClientSpanWithPeerIp4Attributes(t *testing.T) { require.NoError(t, w.Encode(httpData)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "http://10.8.17.36:8080/users/junit")) + assert.Contains(t, jsonStr, "http://10.8.17.36:8080/users/junit") } func TestClientSpanWithPeerIp6Attributes(t *testing.T) { @@ -187,7 +186,7 @@ func TestClientSpanWithPeerIp6Attributes(t *testing.T) { require.NoError(t, w.Encode(httpData)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "https://2001:db8:85a3::8a2e:370:7334/users/junit")) + assert.Contains(t, jsonStr, "https://2001:db8:85a3::8a2e:370:7334/users/junit") } func TestServerSpanWithURLAttribute(t *testing.T) { @@ -207,7 +206,7 @@ func TestServerSpanWithURLAttribute(t *testing.T) { require.NoError(t, w.Encode(httpData)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "https://api.example.com/users/junit")) + assert.Contains(t, jsonStr, "https://api.example.com/users/junit") } func TestServerSpanWithURLAttributeStable(t *testing.T) { @@ -227,7 +226,7 @@ func TestServerSpanWithURLAttributeStable(t *testing.T) { require.NoError(t, w.Encode(httpData)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "https://api.example.com/users/junit")) + assert.Contains(t, jsonStr, "https://api.example.com/users/junit") } func TestServerSpanWithSchemeHostTargetAttributes(t *testing.T) { @@ -248,7 +247,7 @@ func TestServerSpanWithSchemeHostTargetAttributes(t *testing.T) { require.NoError(t, w.Encode(httpData)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "https://api.example.com/users/junit")) + assert.Contains(t, jsonStr, "https://api.example.com/users/junit") } func TestServerSpanWithSchemeHostTargetAttributesStable(t *testing.T) { @@ -269,7 +268,7 @@ func TestServerSpanWithSchemeHostTargetAttributesStable(t *testing.T) { require.NoError(t, w.Encode(httpData)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "https://api.example.com/users/junit")) + assert.Contains(t, jsonStr, "https://api.example.com/users/junit") } func TestServerSpanWithSchemeServernamePortTargetAttributes(t *testing.T) { @@ -291,7 +290,7 @@ func TestServerSpanWithSchemeServernamePortTargetAttributes(t *testing.T) { require.NoError(t, w.Encode(httpData)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "https://api.example.com/users/junit")) + assert.Contains(t, jsonStr, "https://api.example.com/users/junit") } func TestServerSpanWithSchemeServernamePortTargetAttributesStable(t *testing.T) { @@ -313,7 +312,7 @@ func TestServerSpanWithSchemeServernamePortTargetAttributesStable(t *testing.T) require.NoError(t, w.Encode(httpData)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "https://api.example.com/users/junit")) + assert.Contains(t, jsonStr, "https://api.example.com/users/junit") } func TestServerSpanWithSchemeNamePortTargetAttributes(t *testing.T) { @@ -337,7 +336,7 @@ func TestServerSpanWithSchemeNamePortTargetAttributes(t *testing.T) { require.NoError(t, w.Encode(httpData)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "http://kb234.example.com:8080/users/junit")) + assert.Contains(t, jsonStr, "http://kb234.example.com:8080/users/junit") } func TestServerSpanWithSchemeNamePortTargetAttributesStable(t *testing.T) { @@ -361,7 +360,7 @@ func TestServerSpanWithSchemeNamePortTargetAttributesStable(t *testing.T) { require.NoError(t, w.Encode(httpData)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "http://kb234.example.com:8080/users/junit")) + assert.Contains(t, jsonStr, "http://kb234.example.com:8080/users/junit") } func TestSpanWithNotEnoughHTTPRequestURLAttributes(t *testing.T) { diff --git a/exporter/awsxrayexporter/internal/translator/segment_test.go b/exporter/awsxrayexporter/internal/translator/segment_test.go index 57ab63ecc726..6351ad99922c 100644 --- a/exporter/awsxrayexporter/internal/translator/segment_test.go +++ b/exporter/awsxrayexporter/internal/translator/segment_test.go @@ -7,7 +7,6 @@ import ( "crypto/rand" "encoding/binary" "fmt" - "strings" "testing" "time" @@ -61,10 +60,10 @@ func TestClientSpanWithRpcAwsSdkClientAttributes(t *testing.T) { assert.NotNil(t, jsonStr) assert.NoError(t, err) - assert.True(t, strings.Contains(jsonStr, "DynamoDB")) - assert.True(t, strings.Contains(jsonStr, "GetItem")) - assert.False(t, strings.Contains(jsonStr, user)) - assert.False(t, strings.Contains(jsonStr, "user")) + assert.Contains(t, jsonStr, "DynamoDB") + assert.Contains(t, jsonStr, "GetItem") + assert.NotContains(t, jsonStr, user) + assert.NotContains(t, jsonStr, "user") } func TestClientSpanWithLegacyAwsSdkClientAttributes(t *testing.T) { @@ -94,10 +93,10 @@ func TestClientSpanWithLegacyAwsSdkClientAttributes(t *testing.T) { assert.NotNil(t, jsonStr) assert.NoError(t, err) - assert.True(t, strings.Contains(jsonStr, "DynamoDB")) - assert.True(t, strings.Contains(jsonStr, "GetItem")) - assert.False(t, strings.Contains(jsonStr, user)) - assert.False(t, strings.Contains(jsonStr, "user")) + assert.Contains(t, jsonStr, "DynamoDB") + assert.Contains(t, jsonStr, "GetItem") + assert.NotContains(t, jsonStr, user) + assert.NotContains(t, jsonStr, "user") } func TestClientSpanWithPeerService(t *testing.T) { @@ -253,8 +252,8 @@ func TestClientSpanWithDbComponent(t *testing.T) { require.NoError(t, w.Encode(segment)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, spanName)) - assert.True(t, strings.Contains(jsonStr, enterpriseAppID)) + assert.Contains(t, jsonStr, spanName) + assert.Contains(t, jsonStr, enterpriseAppID) } func TestClientSpanWithHttpHost(t *testing.T) { @@ -376,9 +375,9 @@ func TestSpanWithInvalidTraceIdWithoutTimestampValidation(t *testing.T) { require.NoError(t, err) assert.NotNil(t, jsonStr) - assert.True(t, strings.Contains(jsonStr, "ProducerService")) - assert.False(t, strings.Contains(jsonStr, user)) - assert.False(t, strings.Contains(jsonStr, "user")) + assert.Contains(t, jsonStr, "ProducerService") + assert.NotContains(t, jsonStr, user) + assert.NotContains(t, jsonStr, "user") } func TestSpanWithExpiredTraceIdWithoutTimestampValidation(t *testing.T) { @@ -1088,9 +1087,9 @@ func TestClientSpanWithAwsRemoteServiceName(t *testing.T) { assert.NotNil(t, jsonStr) assert.NoError(t, err) - assert.True(t, strings.Contains(jsonStr, "PaymentService")) - assert.False(t, strings.Contains(jsonStr, user)) - assert.False(t, strings.Contains(jsonStr, "user")) + assert.Contains(t, jsonStr, "PaymentService") + assert.NotContains(t, jsonStr, user) + assert.NotContains(t, jsonStr, "user") } func TestAwsSdkSpanWithDeprecatedAwsRemoteServiceName(t *testing.T) { @@ -1115,10 +1114,10 @@ func TestAwsSdkSpanWithDeprecatedAwsRemoteServiceName(t *testing.T) { assert.NotNil(t, jsonStr) assert.NoError(t, err) - assert.True(t, strings.Contains(jsonStr, "DynamoDb")) - assert.False(t, strings.Contains(jsonStr, "DynamoDb.PutItem")) - assert.False(t, strings.Contains(jsonStr, user)) - assert.False(t, strings.Contains(jsonStr, "user")) + assert.Contains(t, jsonStr, "DynamoDb") + assert.NotContains(t, jsonStr, "DynamoDb.PutItem") + assert.NotContains(t, jsonStr, user) + assert.NotContains(t, jsonStr, "user") } func TestAwsSdkSpanWithAwsRemoteServiceName(t *testing.T) { @@ -1143,10 +1142,10 @@ func TestAwsSdkSpanWithAwsRemoteServiceName(t *testing.T) { assert.NotNil(t, jsonStr) assert.NoError(t, err) - assert.True(t, strings.Contains(jsonStr, "DynamoDb")) - assert.False(t, strings.Contains(jsonStr, "DynamoDb.PutItem")) - assert.False(t, strings.Contains(jsonStr, user)) - assert.False(t, strings.Contains(jsonStr, "user")) + assert.Contains(t, jsonStr, "DynamoDb") + assert.NotContains(t, jsonStr, "DynamoDb.PutItem") + assert.NotContains(t, jsonStr, user) + assert.NotContains(t, jsonStr, "user") } func TestProducerSpanWithAwsRemoteServiceName(t *testing.T) { @@ -1172,9 +1171,9 @@ func TestProducerSpanWithAwsRemoteServiceName(t *testing.T) { assert.NotNil(t, jsonStr) assert.NoError(t, err) - assert.True(t, strings.Contains(jsonStr, "ProducerService")) - assert.False(t, strings.Contains(jsonStr, user)) - assert.False(t, strings.Contains(jsonStr, "user")) + assert.Contains(t, jsonStr, "ProducerService") + assert.NotContains(t, jsonStr, user) + assert.NotContains(t, jsonStr, "user") } func TestConsumerSpanWithAwsRemoteServiceName(t *testing.T) { @@ -1191,9 +1190,9 @@ func TestConsumerSpanWithAwsRemoteServiceName(t *testing.T) { assert.NotNil(t, jsonStr) assert.NoError(t, err) - assert.True(t, strings.Contains(jsonStr, "ConsumerService")) - assert.False(t, strings.Contains(jsonStr, user)) - assert.False(t, strings.Contains(jsonStr, "user")) + assert.Contains(t, jsonStr, "ConsumerService") + assert.NotContains(t, jsonStr, user) + assert.NotContains(t, jsonStr, "user") } func TestServerSpanWithAwsLocalServiceName(t *testing.T) { @@ -1219,9 +1218,9 @@ func TestServerSpanWithAwsLocalServiceName(t *testing.T) { assert.NotNil(t, jsonStr) assert.NoError(t, err) - assert.True(t, strings.Contains(jsonStr, "PaymentLocalService")) - assert.False(t, strings.Contains(jsonStr, user)) - assert.False(t, strings.Contains(jsonStr, "user")) + assert.Contains(t, jsonStr, "PaymentLocalService") + assert.NotContains(t, jsonStr, user) + assert.NotContains(t, jsonStr, "user") } func validateLocalRootDependencySubsegment(t *testing.T, segment *awsxray.Segment, span ptrace.Span, parentID string) { diff --git a/exporter/awsxrayexporter/internal/translator/service_test.go b/exporter/awsxrayexporter/internal/translator/service_test.go index 9d26c5f2f098..81745b031aba 100644 --- a/exporter/awsxrayexporter/internal/translator/service_test.go +++ b/exporter/awsxrayexporter/internal/translator/service_test.go @@ -4,7 +4,6 @@ package translator import ( - "strings" "testing" "github.com/stretchr/testify/assert" @@ -23,7 +22,7 @@ func TestServiceFromResource(t *testing.T) { require.NoError(t, w.Encode(service)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "semver:1.1.4")) + assert.Contains(t, jsonStr, "semver:1.1.4") } func TestServiceFromResourceWithNoServiceVersion(t *testing.T) { @@ -36,7 +35,7 @@ func TestServiceFromResourceWithNoServiceVersion(t *testing.T) { require.NoError(t, w.Encode(service)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "v1")) + assert.Contains(t, jsonStr, "v1") } func TestServiceFromNullResource(t *testing.T) { diff --git a/exporter/awsxrayexporter/internal/translator/span_links_test.go b/exporter/awsxrayexporter/internal/translator/span_links_test.go index 1c70f1c75009..6c1fb6107bf8 100644 --- a/exporter/awsxrayexporter/internal/translator/span_links_test.go +++ b/exporter/awsxrayexporter/internal/translator/span_links_test.go @@ -5,7 +5,6 @@ package translator // import "github.com/open-telemetry/opentelemetry-collector- import ( "encoding/binary" - "strings" "testing" "time" @@ -37,10 +36,10 @@ func TestSpanLinkSimple(t *testing.T) { jsonStr, _ := MakeSegmentDocumentString(span, resource, nil, false, nil, false) - assert.True(t, strings.Contains(jsonStr, "links")) - assert.False(t, strings.Contains(jsonStr, "attributes")) - assert.True(t, strings.Contains(jsonStr, convertedTraceID)) - assert.True(t, strings.Contains(jsonStr, spanLink.SpanID().String())) + assert.Contains(t, jsonStr, "links") + assert.NotContains(t, jsonStr, "attributes") + assert.Contains(t, jsonStr, convertedTraceID) + assert.Contains(t, jsonStr, spanLink.SpanID().String()) } func TestSpanLinkEmpty(t *testing.T) { @@ -56,7 +55,7 @@ func TestSpanLinkEmpty(t *testing.T) { jsonStr, _ := MakeSegmentDocumentString(span, resource, nil, false, nil, false) - assert.False(t, strings.Contains(jsonStr, "links")) + assert.NotContains(t, jsonStr, "links") } func TestOldSpanLinkError(t *testing.T) { @@ -125,14 +124,14 @@ func TestTwoSpanLinks(t *testing.T) { jsonStr, _ := MakeSegmentDocumentString(span, resource, nil, false, nil, false) - assert.True(t, strings.Contains(jsonStr, "attributes")) - assert.True(t, strings.Contains(jsonStr, "links")) - assert.True(t, strings.Contains(jsonStr, "myKey1")) - assert.True(t, strings.Contains(jsonStr, "myKey2")) - assert.True(t, strings.Contains(jsonStr, "ABC")) - assert.True(t, strings.Contains(jsonStr, "1234")) - assert.True(t, strings.Contains(jsonStr, convertedTraceID1)) - assert.True(t, strings.Contains(jsonStr, convertedTraceID2)) + assert.Contains(t, jsonStr, "attributes") + assert.Contains(t, jsonStr, "links") + assert.Contains(t, jsonStr, "myKey1") + assert.Contains(t, jsonStr, "myKey2") + assert.Contains(t, jsonStr, "ABC") + assert.Contains(t, jsonStr, "1234") + assert.Contains(t, jsonStr, convertedTraceID1) + assert.Contains(t, jsonStr, convertedTraceID2) } func TestSpanLinkComplexAttributes(t *testing.T) { @@ -198,34 +197,34 @@ func TestSpanLinkComplexAttributes(t *testing.T) { jsonStr, _ := MakeSegmentDocumentString(span, resource, nil, false, nil, false) - assert.True(t, strings.Contains(jsonStr, "links")) + assert.Contains(t, jsonStr, "links") - assert.True(t, strings.Contains(jsonStr, "myKey1")) - assert.True(t, strings.Contains(jsonStr, "myValue")) + assert.Contains(t, jsonStr, "myKey1") + assert.Contains(t, jsonStr, "myValue") - assert.True(t, strings.Contains(jsonStr, "myKey2")) - assert.True(t, strings.Contains(jsonStr, "true")) + assert.Contains(t, jsonStr, "myKey2") + assert.Contains(t, jsonStr, "true") - assert.True(t, strings.Contains(jsonStr, "myKey3")) - assert.True(t, strings.Contains(jsonStr, "112233")) + assert.Contains(t, jsonStr, "myKey3") + assert.Contains(t, jsonStr, "112233") - assert.True(t, strings.Contains(jsonStr, "myKey4")) - assert.True(t, strings.Contains(jsonStr, "3.1415")) + assert.Contains(t, jsonStr, "myKey4") + assert.Contains(t, jsonStr, "3.1415") - assert.True(t, strings.Contains(jsonStr, "myKey5")) - assert.True(t, strings.Contains(jsonStr, "apple")) - assert.True(t, strings.Contains(jsonStr, "pear")) - assert.True(t, strings.Contains(jsonStr, "banana")) + assert.Contains(t, jsonStr, "myKey5") + assert.Contains(t, jsonStr, "apple") + assert.Contains(t, jsonStr, "pear") + assert.Contains(t, jsonStr, "banana") - assert.True(t, strings.Contains(jsonStr, "myKey6")) - assert.True(t, strings.Contains(jsonStr, "false")) + assert.Contains(t, jsonStr, "myKey6") + assert.Contains(t, jsonStr, "false") - assert.True(t, strings.Contains(jsonStr, "myKey7")) - assert.True(t, strings.Contains(jsonStr, "1234")) - assert.True(t, strings.Contains(jsonStr, "5678")) - assert.True(t, strings.Contains(jsonStr, "9012")) + assert.Contains(t, jsonStr, "myKey7") + assert.Contains(t, jsonStr, "1234") + assert.Contains(t, jsonStr, "5678") + assert.Contains(t, jsonStr, "9012") - assert.True(t, strings.Contains(jsonStr, "myKey8")) - assert.True(t, strings.Contains(jsonStr, "2.718")) - assert.True(t, strings.Contains(jsonStr, "1.618")) + assert.Contains(t, jsonStr, "myKey8") + assert.Contains(t, jsonStr, "2.718") + assert.Contains(t, jsonStr, "1.618") } diff --git a/exporter/awsxrayexporter/internal/translator/sql_test.go b/exporter/awsxrayexporter/internal/translator/sql_test.go index c15ecc639d87..cba2222b64d7 100644 --- a/exporter/awsxrayexporter/internal/translator/sql_test.go +++ b/exporter/awsxrayexporter/internal/translator/sql_test.go @@ -4,7 +4,6 @@ package translator import ( - "strings" "testing" "time" @@ -35,7 +34,7 @@ func TestClientSpanWithStatementAttribute(t *testing.T) { require.NoError(t, w.Encode(sqlData)) jsonStr := w.String() testWriters.release(w) - assert.True(t, strings.Contains(jsonStr, "mysql://db.example.com:3306/customers")) + assert.Contains(t, jsonStr, "mysql://db.example.com:3306/customers") } func TestClientSpanWithNonSQLDatabase(t *testing.T) { diff --git a/exporter/elasticsearchexporter/exporter_test.go b/exporter/elasticsearchexporter/exporter_test.go index 9a9b86a5be6f..32584fd7f8a6 100644 --- a/exporter/elasticsearchexporter/exporter_test.go +++ b/exporter/elasticsearchexporter/exporter_test.go @@ -233,7 +233,7 @@ func TestExporterLogs(t *testing.T) { t.Run("publish with dedup", func(t *testing.T) { rec := newBulkRecorder() server := newESTestServer(t, func(docs []itemRequest) ([]itemResponse, error) { - assert.Equal(t, `{"@timestamp":"1970-01-01T00:00:00.000000000Z","Scope":{"name":"","value":"value","version":""},"SeverityNumber":0,"TraceFlags":0}`, string(docs[0].Document)) + assert.JSONEq(t, `{"@timestamp":"1970-01-01T00:00:00.000000000Z","Scope":{"name":"","value":"value","version":""},"SeverityNumber":0,"TraceFlags":0}`, string(docs[0].Document)) rec.Record(docs) return itemsAllOK(docs) }) @@ -706,9 +706,9 @@ func TestExporterLogs(t *testing.T) { assert.Len(t, rec.Items(), 1) doc := rec.Items()[0].Document - assert.Equal(t, `{"some.record.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `attributes`).Raw) - assert.Equal(t, `{"some.scope.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `scope.attributes`).Raw) - assert.Equal(t, `{"some.resource.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `resource.attributes`).Raw) + assert.JSONEq(t, `{"some.record.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `attributes`).Raw) + assert.JSONEq(t, `{"some.scope.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `scope.attributes`).Raw) + assert.JSONEq(t, `{"some.resource.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `resource.attributes`).Raw) }) t.Run("otel mode attribute key prefix conflict", func(t *testing.T) { @@ -1223,9 +1223,9 @@ func TestExporterMetrics(t *testing.T) { assert.Len(t, rec.Items(), 1) doc := rec.Items()[0].Document - assert.Equal(t, `{"some.record.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `attributes`).Raw) - assert.Equal(t, `{"some.scope.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `scope.attributes`).Raw) - assert.Equal(t, `{"some.resource.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `resource.attributes`).Raw) + assert.JSONEq(t, `{"some.record.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `attributes`).Raw) + assert.JSONEq(t, `{"some.scope.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `scope.attributes`).Raw) + assert.JSONEq(t, `{"some.resource.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `resource.attributes`).Raw) }) t.Run("otel mode _doc_count hint", func(t *testing.T) { @@ -1689,9 +1689,9 @@ func TestExporterTraces(t *testing.T) { assert.Len(t, rec.Items(), 2) for _, item := range rec.Items() { doc := item.Document - assert.Equal(t, `{"some.record.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `attributes`).Raw) - assert.Equal(t, `{"some.scope.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `scope.attributes`).Raw) - assert.Equal(t, `{"some.resource.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `resource.attributes`).Raw) + assert.JSONEq(t, `{"some.record.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `attributes`).Raw) + assert.JSONEq(t, `{"some.scope.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `scope.attributes`).Raw) + assert.JSONEq(t, `{"some.resource.attribute":["foo","bar"]}`, gjson.GetBytes(doc, `resource.attributes`).Raw) } }) diff --git a/exporter/honeycombmarkerexporter/logs_exporter_test.go b/exporter/honeycombmarkerexporter/logs_exporter_test.go index 3eceacedaf4d..05f2e8c61f46 100644 --- a/exporter/honeycombmarkerexporter/logs_exporter_test.go +++ b/exporter/honeycombmarkerexporter/logs_exporter_test.go @@ -8,7 +8,6 @@ import ( "encoding/json" "net/http" "net/http/httptest" - "strings" "testing" "github.com/stretchr/testify/assert" @@ -138,7 +137,7 @@ func TestExportMarkers(t *testing.T) { userAgent := req.Header.Get(userAgentHeaderKey) assert.NotEmpty(t, userAgent) - assert.True(t, strings.Contains(userAgent, "OpenTelemetry Collector")) + assert.Contains(t, userAgent, "OpenTelemetry Collector") rw.WriteHeader(http.StatusAccepted) })) diff --git a/exporter/mezmoexporter/exporter_test.go b/exporter/mezmoexporter/exporter_test.go index 885dee55756d..868cdf8153bf 100644 --- a/exporter/mezmoexporter/exporter_test.go +++ b/exporter/mezmoexporter/exporter_test.go @@ -268,5 +268,5 @@ func Test404IngestError(t *testing.T) { responseField := logLine.Context[0] assert.Equal(t, "response", responseField.Key) - assert.Equal(t, `{"foo":"bar"}`, responseField.String) + assert.JSONEq(t, `{"foo":"bar"}`, responseField.String) } diff --git a/exporter/pulsarexporter/jaeger_marshaler_test.go b/exporter/pulsarexporter/jaeger_marshaler_test.go index 8b0eb9bec1ca..4df974bac0f2 100644 --- a/exporter/pulsarexporter/jaeger_marshaler_test.go +++ b/exporter/pulsarexporter/jaeger_marshaler_test.go @@ -42,7 +42,7 @@ func TestJaegerJsonBatchMarshaler(t *testing.T) { } jaegerJSONMessages, err := jaegerJSONMarshaler.Marshal(ptraces, "") require.NoError(t, err) - assert.Equal(t, jaegerJSONMessages[0].Payload, jsonBytes) + assert.JSONEq(t, string(jaegerJSONMessages[0].Payload), string(jsonBytes)) } func TestJaegerProtoBatchMarshaler(t *testing.T) { diff --git a/exporter/pulsarexporter/marshaler_test.go b/exporter/pulsarexporter/marshaler_test.go index b82e5531cae4..d84f69c89e02 100644 --- a/exporter/pulsarexporter/marshaler_test.go +++ b/exporter/pulsarexporter/marshaler_test.go @@ -102,7 +102,7 @@ func TestOTLPTracesJsonMarshaling(t *testing.T) { // Since marshaling json is not guaranteed to be in order // within a string, using a map to compare that the expected values are there - expectedJSON := map[string]any{ + expectedMap := map[string]any{ "resourceSpans": []any{ map[string]any{ "resource": map[string]any{}, @@ -133,5 +133,5 @@ func TestOTLPTracesJsonMarshaling(t *testing.T) { err = json.Unmarshal(payload, &final) require.NoError(t, err, "Must not error marshaling expected data") - assert.Equal(t, expectedJSON, final, "Must match the expected value") + assert.Equal(t, expectedMap, final, "Must match the expected value") } diff --git a/exporter/splunkhecexporter/metricdata_to_splunk_test.go b/exporter/splunkhecexporter/metricdata_to_splunk_test.go index a2ea1bb718d3..b15d5e840b0c 100644 --- a/exporter/splunkhecexporter/metricdata_to_splunk_test.go +++ b/exporter/splunkhecexporter/metricdata_to_splunk_test.go @@ -716,7 +716,7 @@ func TestMergeEvents(t *testing.T) { require.Len(t, merged, 1) b, err := json.Marshal(merged[0]) require.NoError(t, err) - require.Equal(t, `{"host":"","event":"metric","fields":{"IF-Azure":"azure-env","k8s.cluster.name":"devops-uat","k8s.namespace.name":"splunk-collector-tests","k8s.node.name":"myk8snodename","k8s.pod.name":"my-otel-collector-pod","metric_name:otel.collector.test":3411,"metric_name:otel.collector.test2":26059,"metric_type":"Gauge","metricsIndex":"test_metrics","metricsPlatform":"unset","resourceAttrs":"NO","testNumber":"number42","testRun":"42"}}`, string(b)) + require.JSONEq(t, `{"host":"","event":"metric","fields":{"IF-Azure":"azure-env","k8s.cluster.name":"devops-uat","k8s.namespace.name":"splunk-collector-tests","k8s.node.name":"myk8snodename","k8s.pod.name":"my-otel-collector-pod","metric_name:otel.collector.test":3411,"metric_name:otel.collector.test2":26059,"metric_type":"Gauge","metricsIndex":"test_metrics","metricsPlatform":"unset","resourceAttrs":"NO","testNumber":"number42","testRun":"42"}}`, string(b)) } func newMetricsWithResources() pcommon.Resource { diff --git a/exporter/syslogexporter/rfc5424_formatter_test.go b/exporter/syslogexporter/rfc5424_formatter_test.go index 3c6f48cd8ee7..edf4e157ffc8 100644 --- a/exporter/syslogexporter/rfc5424_formatter_test.go +++ b/exporter/syslogexporter/rfc5424_formatter_test.go @@ -6,7 +6,6 @@ package syslogexporter import ( "fmt" "regexp" - "strings" "testing" "time" @@ -81,10 +80,10 @@ func TestRFC5424Formatter(t *testing.T) { matched, err := regexp.MatchString(expectedRegex, actual) assert.NoError(t, err) assert.Truef(t, matched, "unexpected form of formatted message, formatted message: %s, regexp: %s", actual, expectedRegex) - assert.True(t, strings.Contains(actual, "Realm=\"SecureAuth0\"")) - assert.True(t, strings.Contains(actual, "UserHostAddress=\"192.168.2.132\"")) - assert.True(t, strings.Contains(actual, "UserID=\"Tester2\"")) - assert.True(t, strings.Contains(actual, "PEN=\"27389\"")) + assert.Contains(t, actual, "Realm=\"SecureAuth0\"") + assert.Contains(t, actual, "UserHostAddress=\"192.168.2.132\"") + assert.Contains(t, actual, "UserID=\"Tester2\"") + assert.Contains(t, actual, "PEN=\"27389\"") // Test defaults expected = "<165>1 2003-08-24T12:14:15.000003Z - - - - -\n" diff --git a/extension/encoding/avrologencodingextension/extension_test.go b/extension/encoding/avrologencodingextension/extension_test.go index c8b44021dc47..b66f12fbd9b0 100644 --- a/extension/encoding/avrologencodingextension/extension_test.go +++ b/extension/encoding/avrologencodingextension/extension_test.go @@ -34,7 +34,7 @@ func TestUnmarshal(t *testing.T) { logRecord := logs.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0) assert.NoError(t, err) - assert.Equal(t, "{\"count\":5,\"hostname\":\"host1\",\"level\":\"warn\",\"levelEnum\":\"INFO\",\"mapField\":{},\"message\":\"log message\",\"nestedRecord\":{\"field1\":12,\"field2\":\"val2\"},\"properties\":[\"prop1\",\"prop2\"],\"severity\":1,\"timestamp\":1697187201488000000}", logRecord.Body().AsString()) + assert.JSONEq(t, "{\"count\":5,\"hostname\":\"host1\",\"level\":\"warn\",\"levelEnum\":\"INFO\",\"mapField\":{},\"message\":\"log message\",\"nestedRecord\":{\"field1\":12,\"field2\":\"val2\"},\"properties\":[\"prop1\",\"prop2\"],\"severity\":1,\"timestamp\":1697187201488000000}", logRecord.Body().AsString()) } func TestInvalidUnmarshal(t *testing.T) { diff --git a/extension/encoding/jsonlogencodingextension/json_test.go b/extension/encoding/jsonlogencodingextension/json_test.go index 2fcfa3d13129..afb77d24f5b4 100644 --- a/extension/encoding/jsonlogencodingextension/json_test.go +++ b/extension/encoding/jsonlogencodingextension/json_test.go @@ -25,7 +25,7 @@ func TestMarshalUnmarshal(t *testing.T) { buf, err := e.MarshalLogs(ld) assert.NoError(t, err) assert.NotEmpty(t, buf) - assert.Equal(t, json, string(buf)) + assert.JSONEq(t, json, string(buf)) } func TestInvalidMarshal(t *testing.T) { @@ -59,7 +59,7 @@ func TestPrettyLogProcessor(t *testing.T) { lp, err := j.logProcessor(sampleLog()) assert.NoError(t, err) assert.NotNil(t, lp) - assert.Equal(t, `[{"body":{"log":"test"},"logAttributes":{"foo":"bar"},"resourceAttributes":{"test":"logs-test"}},{"body":"log testing","resourceAttributes":{"test":"logs-test"}}]`, string(lp)) + assert.JSONEq(t, `[{"body":{"log":"test"},"logAttributes":{"foo":"bar"},"resourceAttributes":{"test":"logs-test"}},{"body":"log testing","resourceAttributes":{"test":"logs-test"}}]`, string(lp)) } func sampleLog() plog.Logs { diff --git a/extension/healthcheckextension/integration_test.go b/extension/healthcheckextension/integration_test.go index af8756b50892..ba765f569ab7 100644 --- a/extension/healthcheckextension/integration_test.go +++ b/extension/healthcheckextension/integration_test.go @@ -37,7 +37,7 @@ func Test_SimpleHealthCheck(t *testing.T) { var buf bytes.Buffer _, err = io.Copy(&buf, resp.Body) require.NoError(t, err) - assert.Equal(t, `{"status":"Server not available","upSince":"0001-01-01T00:00:00Z","uptime":""}`, buf.String()) + assert.JSONEq(t, `{"status":"Server not available","upSince":"0001-01-01T00:00:00Z","uptime":""}`, buf.String()) err = e.(*healthCheckExtension).Ready() require.NoError(t, err) resp, err = http.DefaultClient.Get(fmt.Sprintf("http://localhost:%d/", port)) diff --git a/extension/healthcheckv2extension/extension_test.go b/extension/healthcheckv2extension/extension_test.go index c15acc269245..57ba700e7e31 100644 --- a/extension/healthcheckv2extension/extension_test.go +++ b/extension/healthcheckv2extension/extension_test.go @@ -131,5 +131,5 @@ func TestNotifyConfig(t *testing.T) { body, err := io.ReadAll(resp.Body) require.NoError(t, err) - assert.Equal(t, confJSON, body) + assert.JSONEq(t, string(confJSON), string(body)) } diff --git a/extension/healthcheckv2extension/internal/http/server_test.go b/extension/healthcheckv2extension/internal/http/server_test.go index 4a11d0138d55..de365258206e 100644 --- a/extension/healthcheckv2extension/internal/http/server_test.go +++ b/extension/healthcheckv2extension/internal/http/server_test.go @@ -2986,7 +2986,7 @@ func TestStatus(t *testing.T) { body, err := io.ReadAll(resp.Body) require.NoError(t, err) - assert.True(t, strings.Contains(string(body), ts.expectedBody)) + assert.Contains(t, string(body), ts.expectedBody) if ts.expectedComponentStatus != nil { st := &serializableStatus{} diff --git a/extension/httpforwarderextension/extension_test.go b/extension/httpforwarderextension/extension_test.go index 7e3563bf6fe8..f5acd26cbe30 100644 --- a/extension/httpforwarderextension/extension_test.go +++ b/extension/httpforwarderextension/extension_test.go @@ -205,7 +205,7 @@ func TestExtension(t *testing.T) { if test.startUpError { err = hf.Start(ctx, componenttest.NewNopHost()) if test.startUpErrorMessage != "" { - require.True(t, strings.Contains(err.Error(), test.startUpErrorMessage)) + require.Contains(t, err.Error(), test.startUpErrorMessage) } require.Error(t, err) diff --git a/extension/httpforwarderextension/factory_test.go b/extension/httpforwarderextension/factory_test.go index 74824c3ab0ad..f515c94cdb47 100644 --- a/extension/httpforwarderextension/factory_test.go +++ b/extension/httpforwarderextension/factory_test.go @@ -5,7 +5,6 @@ package httpforwarderextension import ( "context" - "strings" "testing" "time" @@ -57,7 +56,7 @@ func TestFactory(t *testing.T) { ) if test.wantErr { if test.wantErrMessage != "" { - require.True(t, strings.Contains(err.Error(), test.wantErrMessage)) + require.Contains(t, err.Error(), test.wantErrMessage) } require.Error(t, err) require.Nil(t, e) diff --git a/extension/jaegerremotesampling/internal/http_test.go b/extension/jaegerremotesampling/internal/http_test.go index 0ad7a113e9a5..075073d82215 100644 --- a/extension/jaegerremotesampling/internal/http_test.go +++ b/extension/jaegerremotesampling/internal/http_test.go @@ -80,7 +80,7 @@ func TestEndpointsAreWired(t *testing.T) { resp.Body.Close() body := string(samplingStrategiesBytes) - assert.Equal(t, `{"probabilisticSampling":{"samplingRate":1}}`, body) + assert.JSONEq(t, `{"probabilisticSampling":{"samplingRate":1}}`, body) }) } } diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 373c22ae3427..84ff19abb0e5 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -1,9 +1,11 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/internal/tools -go 1.22.0 +go 1.22.1 + +toolchain go1.22.8 require ( - github.com/Antonboom/testifylint v1.4.3 + github.com/Antonboom/testifylint v1.5.0 github.com/Khan/genqlient v0.7.0 github.com/client9/misspell v0.3.4 github.com/daixiang0/gci v0.13.5 diff --git a/internal/tools/go.sum b/internal/tools/go.sum index ff9fceffcdc2..b9dc248f5aab 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -12,8 +12,8 @@ github.com/Antonboom/errname v0.1.13 h1:JHICqsewj/fNckzrfVSe+T33svwQxmjC+1ntDsHO github.com/Antonboom/errname v0.1.13/go.mod h1:uWyefRYRN54lBg6HseYCFhs6Qjcy41Y3Jl/dVhA87Ns= github.com/Antonboom/nilnil v0.1.9 h1:eKFMejSxPSA9eLSensFmjW2XTgTwJMjZ8hUHtV4s/SQ= github.com/Antonboom/nilnil v0.1.9/go.mod h1:iGe2rYwCq5/Me1khrysB4nwI7swQvjclR8/YRPl5ihQ= -github.com/Antonboom/testifylint v1.4.3 h1:ohMt6AHuHgttaQ1xb6SSnxCeK4/rnK7KKzbvs7DmEck= -github.com/Antonboom/testifylint v1.4.3/go.mod h1:+8Q9+AOLsz5ZiQiiYujJKs9mNz398+M6UgslP4qgJLA= +github.com/Antonboom/testifylint v1.5.0 h1:dlUIsDMtCrZWUnvkaCz3quJCoIjaGi41GzjPBGkkJ8A= +github.com/Antonboom/testifylint v1.5.0/go.mod h1:wqaJbu0Blb5Wag2wv7Z5xt+CIV+eVLxtGZrlK13z3AE= github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/Crocmagnon/fatcontext v0.2.2 h1:OrFlsDdOj9hW/oBEJBNSuH7QWf+E9WPVHw+x52bXVbk= diff --git a/pkg/stanza/operator/operatortest/confmap.go b/pkg/stanza/operator/operatortest/confmap.go index 90486dd435e5..dc237dfaa6ce 100644 --- a/pkg/stanza/operator/operatortest/confmap.go +++ b/pkg/stanza/operator/operatortest/confmap.go @@ -4,7 +4,6 @@ package operatortest // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/operatortest" import ( - "fmt" "testing" "github.com/stretchr/testify/require" @@ -37,7 +36,7 @@ func (c ConfigUnmarshalTests) Run(t *testing.T) { t.Run(tc.Name, func(t *testing.T) { testConfMap, err := testConfMaps.Sub(tc.Name) require.NoError(t, err) - require.NotEmpty(t, testConfMap.AllKeys(), fmt.Sprintf("config not found: '%s'", tc.Name)) + require.NotEmpty(t, testConfMap.AllKeys(), "config not found: '%s'", tc.Name) cfg := newAnyOpConfig(c.DefaultConfig) err = testConfMap.Unmarshal(cfg) diff --git a/processor/remotetapprocessor/server_test.go b/processor/remotetapprocessor/server_test.go index aa27991ff900..8a6b68397e0f 100644 --- a/processor/remotetapprocessor/server_test.go +++ b/processor/remotetapprocessor/server_test.go @@ -50,7 +50,7 @@ func TestSocketConnectionLogs(t *testing.T) { n, _ := wsConn.Read(buf) return n == 132 }, 1*time.Second, 100*time.Millisecond, "received message") - require.Equal(t, `{"resourceLogs":[{"resource":{},"scopeLogs":[{"scope":{},"logRecords":[{"body":{"stringValue":"foo"},"traceId":"","spanId":""}]}]}]}`, string(buf[0:132])) + require.JSONEq(t, `{"resourceLogs":[{"resource":{},"scopeLogs":[{"scope":{},"logRecords":[{"body":{"stringValue":"foo"},"traceId":"","spanId":""}]}]}]}`, string(buf[0:132])) err = processor.Shutdown(context.Background()) require.NoError(t, err) @@ -86,7 +86,7 @@ func TestSocketConnectionMetrics(t *testing.T) { n, _ := wsConn.Read(buf) return n == 94 }, 1*time.Second, 100*time.Millisecond, "received message") - require.Equal(t, `{"resourceMetrics":[{"resource":{},"scopeMetrics":[{"scope":{},"metrics":[{"name":"foo"}]}]}]}`, string(buf[0:94])) + require.JSONEq(t, `{"resourceMetrics":[{"resource":{},"scopeMetrics":[{"scope":{},"metrics":[{"name":"foo"}]}]}]}`, string(buf[0:94])) err = processor.Shutdown(context.Background()) require.NoError(t, err) @@ -122,7 +122,7 @@ func TestSocketConnectionTraces(t *testing.T) { n, _ := wsConn.Read(buf) return n == 143 }, 1*time.Second, 100*time.Millisecond, "received message") - require.Equal(t, `{"resourceSpans":[{"resource":{},"scopeSpans":[{"scope":{},"spans":[{"traceId":"","spanId":"","parentSpanId":"","name":"foo","status":{}}]}]}]}`, string(buf[0:143])) + require.JSONEq(t, `{"resourceSpans":[{"resource":{},"scopeSpans":[{"scope":{},"spans":[{"traceId":"","spanId":"","parentSpanId":"","name":"foo","status":{}}]}]}]}`, string(buf[0:143])) err = processor.Shutdown(context.Background()) require.NoError(t, err) diff --git a/processor/tailsamplingprocessor/internal/cache/lru_cache_test.go b/processor/tailsamplingprocessor/internal/cache/lru_cache_test.go index 36627bed0e87..b0f86e1c46a5 100644 --- a/processor/tailsamplingprocessor/internal/cache/lru_cache_test.go +++ b/processor/tailsamplingprocessor/internal/cache/lru_cache_test.go @@ -61,8 +61,8 @@ func TestLeastRecentlyUsedIsEvicted(t *testing.T) { c.Put(id1, true) c.Put(id2, true) v, ok := c.Get(id1) // use id1 - assert.True(t, true, v) - assert.True(t, true, ok) + assert.True(t, v) + assert.True(t, ok) c.Put(id3, true) v, ok = c.Get(id1) diff --git a/processor/transformprocessor/internal/metrics/func_convert_exponential_hist_to_explicit_hist_test.go b/processor/transformprocessor/internal/metrics/func_convert_exponential_hist_to_explicit_hist_test.go index 8d5d6ec8aa3c..f61969b17c18 100644 --- a/processor/transformprocessor/internal/metrics/func_convert_exponential_hist_to_explicit_hist_test.go +++ b/processor/transformprocessor/internal/metrics/func_convert_exponential_hist_to_explicit_hist_test.go @@ -4,7 +4,6 @@ package metrics import ( - "strings" "testing" "time" @@ -782,7 +781,7 @@ func Test_convertExponentialHistToExplicitHist_validate(t *testing.T) { t.Run(tt.name, func(t *testing.T) { _, err := convertExponentialHistToExplicitHist("random", tt.sliceExplicitBoundsArgs) assert.Error(t, err) - assert.True(t, strings.Contains(err.Error(), "explicit bounds cannot be empty")) + assert.Contains(t, err.Error(), "explicit bounds cannot be empty") }) } } diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/internal/handlecount/handles_windows_test.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/internal/handlecount/handles_windows_test.go index 9ce32bf51e51..b757c83404bb 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/internal/handlecount/handles_windows_test.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/internal/handlecount/handles_windows_test.go @@ -7,7 +7,6 @@ package handlecount import ( "errors" - "strings" "testing" "github.com/stretchr/testify/assert" @@ -33,7 +32,7 @@ func TestHandleCountManager(t *testing.T) { _, err = m.GetProcessHandleCount(3) assert.ErrorIs(t, errors.Unwrap(err), ErrNoHandleCountForProcess) - assert.True(t, strings.Contains(err.Error(), "3")) + assert.Contains(t, err.Error(), "3") } type mockQueryer struct { diff --git a/receiver/splunkhecreceiver/receiver_test.go b/receiver/splunkhecreceiver/receiver_test.go index 3c7351aedd0e..f45b3ee2e011 100644 --- a/receiver/splunkhecreceiver/receiver_test.go +++ b/receiver/splunkhecreceiver/receiver_test.go @@ -41,14 +41,14 @@ import ( func assertHecSuccessResponse(t *testing.T, resp *http.Response, body any) { status := resp.StatusCode assert.Equal(t, http.StatusOK, status) - assert.Equal(t, httpJSONTypeHeader, resp.Header.Get(httpContentTypeHeader)) + assert.Equal(t, "application/json", resp.Header.Get(httpContentTypeHeader)) assert.Equal(t, map[string]any{"code": float64(0), "text": "Success"}, body) } func assertHecSuccessResponseWithAckID(t *testing.T, resp *http.Response, body any, ackID uint64) { status := resp.StatusCode assert.Equal(t, http.StatusOK, status) - assert.Equal(t, httpJSONTypeHeader, resp.Header.Get(httpContentTypeHeader)) + assert.Equal(t, "application/json", resp.Header.Get(httpContentTypeHeader)) assert.Equal(t, map[string]any{"code": float64(0), "text": "Success", "ackId": float64(ackID)}, body) } @@ -1768,7 +1768,7 @@ func Test_splunkhecreceiver_handleHealthPath(t *testing.T) { respBytes, err := io.ReadAll(resp.Body) assert.NoError(t, err) defer resp.Body.Close() - assert.Equal(t, responseHecHealthy, string(respBytes)) + assert.JSONEq(t, responseHecHealthy, string(respBytes)) assert.Equal(t, 200, resp.StatusCode) } @@ -1837,7 +1837,7 @@ func Test_splunkhecreceiver_handle_nested_fields(t *testing.T) { assert.Equal(t, 1, sink.LogRecordCount()) } else { assert.Equal(t, http.StatusBadRequest, w.Code) - assert.Equal(t, fmt.Sprintf(responseErrHandlingIndexedFields, 0), w.Body.String()) + assert.JSONEq(t, fmt.Sprintf(responseErrHandlingIndexedFields, 0), w.Body.String()) } }) @@ -1861,7 +1861,7 @@ func Test_splunkhecReceiver_rawReqHasmetadataInResource(t *testing.T) { assertResponse := func(t *testing.T, status int, body string) { assert.Equal(t, http.StatusOK, status) - assert.Equal(t, responseOK, body) + assert.JSONEq(t, responseOK, body) } tests := []struct { @@ -2012,7 +2012,7 @@ func Test_splunkhecReceiver_healthCheck_success(t *testing.T) { }(), assertResponse: func(t *testing.T, status int, body string) { assert.Equal(t, http.StatusOK, status) - assert.Equal(t, responseHecHealthy, body) + assert.JSONEq(t, responseHecHealthy, body) }, }, { @@ -2023,7 +2023,7 @@ func Test_splunkhecReceiver_healthCheck_success(t *testing.T) { }(), assertResponse: func(t *testing.T, status int, body string) { assert.Equal(t, http.StatusOK, status) - assert.Equal(t, responseHecHealthy, body) + assert.JSONEq(t, responseHecHealthy, body) }, }, { @@ -2034,7 +2034,7 @@ func Test_splunkhecReceiver_healthCheck_success(t *testing.T) { }(), assertResponse: func(t *testing.T, status int, body string) { assert.Equal(t, http.StatusBadRequest, status) - assert.Equal(t, responseNoData, body) + assert.JSONEq(t, responseNoData, body) }, }, }