open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.09k stars 2.38k forks source link

[exporter/rabbitmq] Linting failures in tests #35333

Closed crobert-1 closed 1 month ago

crobert-1 commented 1 month ago

Component(s)

exporter/rabbitmq

Describe the issue you're reporting

Failing CI/CD action

Failure output:

Running target 'lint' in module 'exporter/rabbitmqexporter' as part of group 'exporter-3'
make --no-print-directory -C exporter/rabbitmqexporter lint
go: downloading github.com/rabbitmq/amqp091-go v1.10.0
Check License finished successfully
running /home/runner/work/opentelemetry-collector-contrib/opentelemetry-collector-contrib/.tools/misspell -error
/home/runner/work/opentelemetry-collector-contrib/opentelemetry-collector-contrib/.tools/golangci-lint run --allow-parallel-runners --verbose --build-tags integration --timeout=30m --path-prefix rabbitmqexporter
level=info msg="golangci-lint has version v1.59.1 built with go1.22.7 from (unknown, modified: ?, mod sum: \"h1:CRRLu1JbhK5avLABFJ/OHVSQ0Ie5c4ulsOId1h3TTks=\") on (unknown)"
level=info msg="[config_reader] Config search paths: [./ /home/runner/work/opentelemetry-collector-contrib/opentelemetry-collector-contrib/exporter/rabbitmqexporter /home/runner/work/opentelemetry-collector-contrib/opentelemetry-collector-contrib/exporter /home/runner/work/opentelemetry-collector-contrib/opentelemetry-collector-contrib /home/runner/work/opentelemetry-collector-contrib /home/runner/work /home/runner /home /]"
level=info msg="[config_reader] Used config file ../../.golangci.yml"
level=info msg="[lintersdb] Active 25 linters: [decorder depguard errcheck errorlint exhaustive exportloopref gci gocritic gofmt goimports gosec gosimple govet ineffassign misspell predeclared reassign revive staticcheck tenv testifylint unconvert unparam unused wastedassign]"
level=info msg="[loader] Using build tags: [integration]"
level=info msg="[loader] Go packages loading at mode 575 (deps|imports|name|types_sizes|compiled_files|exports_file|files) took 2.941375603s"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 8.722658ms"
level=info msg="[linters_context/goanalysis] analyzers took 5.857583573s with top 10 stages: buildir: 4.539111605s, exhaustive: 277.140843ms, findcall: 167.55889ms, inspect: 142.038428ms, fact_deprecated: 107.096323ms, fact_purity: 104.00287ms, ctrlflow: 89.148724ms, printf: 77.426261ms, SA5012: 63.416348ms, nilness: 52.302903ms"
level=info msg="[runner/max_same_issues] 3/6 issues with text \"connection.AssertExpectations undefined (type *mockConnection has no field or method AssertExpectations)\" were hidden, use --max-same-issues"
level=info msg="[runner/max_same_issues] 3/6 issues with text \"connection.On undefined (type mockConnection has no field or method On)\" were hidden, use --max-same-issues"
level=info msg="[runner/max_same_issues] 3/6 issues with text \"confirmation.AssertExpectations undefined (type *mockDeferredConfirmation has no field or method AssertExpectations)\" were hidden, use --max-same-issues"
level=info msg="[runner/max_same_issues] 3/6 issues with text \"channel.On undefined (type mockChannel has no field or method On)\" were hidden, use --max-same-issues"
Error: rabbitmqexporter/marshaler_test.go:23:7: host.On undefined (type mockHostWithEncodings has no field or method On) (typecheck)
level=info msg="[runner/max_same_issues] 3/6 issues with text \"client.AssertExpectations undefined (type *mockClient has no field or method AssertExpectations)\" were hidden, use --max-same-issues"
level=info msg="[runner/max_same_issues] 3/6 issues with text \"channel.AssertExpectations undefined (type *mockChannel has no field or method AssertExpectations)\" were hidden, use --max-same-issues"
level=info msg="[runner/max_same_issues] 2/5 issues with text \"connection.On undefined (type *mockConnection has no field or method On)\" were hidden, use --max-same-issues"
level=info msg="[runner/max_same_issues] 2/5 issues with text \"m.Called undefined (type *mockConnection has no field or method Called)\" were hidden, use --max-same-issues"
level=info msg="[runner/max_same_issues] 1/4 issues with text \"connection.ExpectedCalls undefined (type *mockConnection has no field or method ExpectedCalls)\" were hidden, use --max-same-issues"
level=info msg="[runner/max_same_issues] 1/4 issues with text \"confirmation.ExpectedCalls undefined (type *mockDeferredConfirmation has no field or method ExpectedCalls)\" were hidden, use --max-same-issues"
level=info msg="[runner/max_same_issues] 1/4 issues with text \"m.Called undefined (type *mockChannel has no field or method Called)\" were hidden, use --max-same-issues"
level=info msg="[runner/max_same_issues] 1/4 issues with text \"client.AssertNumberOfCalls undefined (type *mockClient has no field or method AssertNumberOfCalls)\" were hidden, use --max-same-issues"
level=info msg="[runner/max_from_linter] 18/68 issues from linter typecheck were hidden, use --max-issues-per-linter"
level=info msg="[runner] Issues before processing: 16168, after processing: 50"
level=info msg="[runner] Processors filtering stat (out/in): max_from_linter: 50/68, filename_unadjuster: 16168/16168, path_prettifier: 16168/16168, identifier_marker: 16168/16168, exclude-rules: 16168/16168, nolint: 16168/16168, uniq_by_line: 94/16168, max_per_file_from_linter: 94/94, max_same_issues: 68/94, cgo: 16168/16168, skip_dirs: 16168/16168, autogenerated_exclude: 16168/16168, exclude: 16168/16168, severity-rules: 50/50, path_prefixer: 50/50, invalid_issue: 16168/16168, diff: 94/94, sort_results: 50/50, skip_files: 16168/16168, source_code: 50/50, path_shortener: 50/50, fixer: 50/50"
level=info msg="[runner] processing took 2.134260253s with stages: exclude-rules: 1.488439116s, identifier_marker: 604.710567ms, path_prettifier: 21.379502ms, nolint: 9.475989ms, uniq_by_line: 2.893131ms, skip_dirs: 2.383632ms, max_same_issues: 1.955365ms, cgo: 1.142449ms, autogenerated_exclude: 571.044µs, filename_unadjuster: 559.352µs, invalid_issue: 500.473µs, source_code: 204.01µs, path_prefixer: 15.418µs, max_from_linter: 12.023µs, path_shortener: 9.918µs, max_per_file_from_linter: 6.081µs, skip_files: 551ns, sort_results: 440ns, diff: 410ns, exclude: 301ns, fixer: 281ns, severity-rules: 200ns"
level=info msg="[runner] linters took 5.620248992s with stages: goanalysis_metalinter: 3.485872451s"
level=info msg="File cache stats: 4 entries of total size 19.6KiB"
level=info msg="Memory: 87 samples, avg is 166.4MB, max is 324.9MB"
level=info msg="Execution took 8.584607706s"
    host.On("GetExtensions").Return(extensionMap)
         ^
Error: rabbitmqexporter/marshaler_test.go:51:12: h.Called undefined (type *mockHostWithEncodings has no field or method Called) (typecheck)
    args := h.Called()
              ^
Error: rabbitmqexporter/rabbitmq_exporter_test.go:40:6: pub.On undefined (type mockPublisher has no field or method On) (typecheck)
    pub.On("Close").Return(nil)
        ^
Error: rabbitmqexporter/rabbitmq_exporter_test.go:44:6: pub.AssertExpectations undefined (type mockPublisher has no field or method AssertExpectations) (typecheck)
    pub.AssertExpectations(t)
        ^
Error: rabbitmqexporter/rabbitmq_exporter_test.go:103:6: pub.On undefined (type *mockPublisher has no field or method On) (typecheck)
    pub.On("Publish", mock.Anything, mock.MatchedBy(func(message publisher.Message) bool {
        ^
Error: rabbitmqexporter/rabbitmq_exporter_test.go:109:6: pub.AssertExpectations undefined (type *mockPublisher has no field or method AssertExpectations) (typecheck)
    pub.AssertExpectations(t)
        ^
Error: rabbitmqexporter/rabbitmq_exporter_test.go:115:6: pub.On undefined (type *mockPublisher has no field or method On) (typecheck)
    pub.On("Publish", mock.Anything, mock.MatchedBy(func(message publisher.Message) bool {
        ^
Error: rabbitmqexporter/rabbitmq_exporter_test.go:121:6: pub.AssertExpectations undefined (type *mockPublisher has no field or method AssertExpectations) (typecheck)
    pub.AssertExpectations(t)
        ^
Error: rabbitmqexporter/rabbitmq_exporter_test.go:127:6: pub.On undefined (type *mockPublisher has no field or method On) (typecheck)
    pub.On("Publish", mock.Anything, mock.MatchedBy(func(message publisher.Message) bool {
        ^
Error: rabbitmqexporter/rabbitmq_exporter_test.go:133:6: pub.AssertExpectations undefined (type *mockPublisher has no field or method AssertExpectations) (typecheck)
    pub.AssertExpectations(t)
        ^
Error: rabbitmqexporter/rabbitmq_exporter_test.go:156:12: c.Called undefined (type *mockPublisher has no field or method Called) (typecheck)
    args := c.Called(ctx, message)
              ^
Error: rabbitmqexporter/rabbitmq_exporter_test.go:161:12: c.Called undefined (type *mockPublisher has no field or method Called) (typecheck)
    args := c.Called()
              ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:39:9: client.On undefined (type mockClient has no field or method On) (typecheck)
    client.On("DialConfig", mock.Anything).Return(&connection, nil)
           ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:40:13: connection.On undefined (type mockConnection has no field or method On) (typecheck)
    connection.On("NotifyClose", mock.Anything).Return(make(chan *amqp.Error))
               ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:45:9: client.AssertExpectations undefined (type mockClient has no field or method AssertExpectations) (typecheck)
    client.AssertExpectations(t)
           ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:48:13: connection.On undefined (type mockConnection has no field or method On) (typecheck)
    connection.On("Close").Return(nil)
               ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:52:9: client.AssertExpectations undefined (type mockClient has no field or method AssertExpectations) (typecheck)
    client.AssertExpectations(t)
           ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:53:13: connection.AssertExpectations undefined (type mockConnection has no field or method AssertExpectations) (typecheck)
    connection.AssertExpectations(t)
               ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:67:13: connection.On undefined (type mockConnection has no field or method On) (typecheck)
    connection.On("NotifyClose", mock.Anything).Return(make(chan *amqp.Error))
               ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:68:9: client.On undefined (type mockClient has no field or method On) (typecheck)
    client.On("DialConfig", mock.Anything).Return(nil, errors.New("simulated connection error"))
           ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:76:9: client.AssertExpectations undefined (type mockClient has no field or method AssertExpectations) (typecheck)
    client.AssertExpectations(t)
           ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:88:9: client.AssertExpectations undefined (type *mockClient has no field or method AssertExpectations) (typecheck)
    client.AssertExpectations(t)
           ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:89:13: connection.AssertExpectations undefined (type *mockConnection has no field or method AssertExpectations) (typecheck)
    connection.AssertExpectations(t)
               ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:90:10: channel.AssertExpectations undefined (type *mockChannel has no field or method AssertExpectations) (typecheck)
    channel.AssertExpectations(t)
            ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:91:15: confirmation.AssertExpectations undefined (type *mockDeferredConfirmation has no field or method AssertExpectations) (typecheck)
    confirmation.AssertExpectations(t)
                 ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:96:25: confirmation.ExpectedCalls undefined (type *mockDeferredConfirmation has no field or method ExpectedCalls) (typecheck)
    resetCall(confirmation.ExpectedCalls, "Acked", t)
                           ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:97:15: confirmation.On undefined (type *mockDeferredConfirmation has no field or method On) (typecheck)
    confirmation.On("Acked").Return(false)
                 ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:105:9: client.AssertExpectations undefined (type *mockClient has no field or method AssertExpectations) (typecheck)
    client.AssertExpectations(t)
           ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:106:13: connection.AssertExpectations undefined (type *mockConnection has no field or method AssertExpectations) (typecheck)
    connection.AssertExpectations(t)
               ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:107:10: channel.AssertExpectations undefined (type *mockChannel has no field or method AssertExpectations) (typecheck)
    channel.AssertExpectations(t)
            ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:108:15: confirmation.AssertExpectations undefined (type *mockDeferredConfirmation has no field or method AssertExpectations) (typecheck)
    confirmation.AssertExpectations(t)
                 ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:114:25: confirmation.ExpectedCalls undefined (type *mockDeferredConfirmation has no field or method ExpectedCalls) (typecheck)
    resetCall(confirmation.ExpectedCalls, "Done", t)
                           ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:115:25: confirmation.ExpectedCalls undefined (type *mockDeferredConfirmation has no field or method ExpectedCalls) (typecheck)
    resetCall(confirmation.ExpectedCalls, "Acked", t)
                           ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:117:15: confirmation.On undefined (type *mockDeferredConfirmation has no field or method On) (typecheck)
    confirmation.On("Done").Return(emptyConfirmationChan)
                 ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:[125](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/10962326349/job/30441375905?pr=35322#step:8:126):9: client.AssertExpectations undefined (type *mockClient has no field or method AssertExpectations) (typecheck)
    client.AssertExpectations(t)
           ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:[126](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/10962326349/job/30441375905?pr=35322#step:8:127):13: connection.AssertExpectations undefined (type *mockConnection has no field or method AssertExpectations) (typecheck)
    connection.AssertExpectations(t)
               ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:[127](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/10962326349/job/30441375905?pr=35322#step:8:128):10: channel.AssertExpectations undefined (type *mockChannel has no field or method AssertExpectations) (typecheck)
    channel.AssertExpectations(t)
            ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:[128](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/10962326349/job/30441375905?pr=35322#step:8:129):15: confirmation.AssertExpectations undefined (type *mockDeferredConfirmation has no field or method AssertExpectations) (typecheck)
    confirmation.AssertExpectations(t)
                 ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:140:15: confirmation.On undefined (type *mockDeferredConfirmation has no field or method On) (typecheck)
    confirmation.On("Done").Return(confirmationChanRet)
                 ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:150:9: client.AssertNumberOfCalls undefined (type *mockClient has no field or method AssertNumberOfCalls) (typecheck)
    client.AssertNumberOfCalls(t, "DialConfig", 1)
           ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:161:23: connection.ExpectedCalls undefined (type *mockConnection has no field or method ExpectedCalls) (typecheck)
    resetCall(connection.ExpectedCalls, "NotifyClose", t)
                         ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:163:13: connection.On undefined (type *mockConnection has no field or method On) (typecheck)
    connection.On("NotifyClose", mock.Anything).Return(make(chan *amqp.Error)).Run(func(args mock.Arguments) {
               ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:171:13: connection.On undefined (type *mockConnection has no field or method On) (typecheck)
    connection.On("Close").Return(nil)
               ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:176:13: connection.AssertNumberOfCalls undefined (type *mockConnection has no field or method AssertNumberOfCalls) (typecheck)
    connection.AssertNumberOfCalls(t, "ReconnectIfUnhealthy", 1)
               ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:178:23: connection.ExpectedCalls undefined (type *mockConnection has no field or method ExpectedCalls) (typecheck)
    resetCall(connection.ExpectedCalls, "Close", t)
                         ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:193:9: client.AssertNumberOfCalls undefined (type *mockClient has no field or method AssertNumberOfCalls) (typecheck)
    client.AssertNumberOfCalls(t, "DialConfig", 1)
           ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:205:9: client.AssertNumberOfCalls undefined (type *mockClient has no field or method AssertNumberOfCalls) (typecheck)
    client.AssertNumberOfCalls(t, "DialConfig", 1)
           ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:207:13: connection.On undefined (type *mockConnection has no field or method On) (typecheck)
    connection.On("IsClosed").Return(true)
               ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:209:19: client.ExpectedCalls undefined (type *mockClient has no field or method ExpectedCalls) (typecheck)
    resetCall(client.ExpectedCalls, "DialConfig", t)
                     ^
Error: rabbitmqexporter/internal/publisher/publisher_test.go:210:9: client.On undefined (type *mockClient has no field or method On) (typecheck)
    client.On("DialConfig", connectURL, mock.Anything).Return(nil, errors.New("simulated connection error"))
           ^
make[2]: *** [../../Makefile.Common:203: lint] Error 1
make[1]: *** [Makefile:187: exporter/rabbitmqexporter] Error 2
github-actions[bot] commented 1 month ago

Pinging code owners:

crobert-1 commented 1 month ago

This hasn't happened again, and I'd expect lint failures to happen every time. Maybe this a flaky failure?

atoulme commented 1 month ago

Closing, please reopen if this happens again.