diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8a5dc64..7ea4579 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -37,7 +37,7 @@ jobs: uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0 with: working-directory: ${{ matrix.directory }} - version: v1.60.3 # renovate: datasource=github-tags depName=golangci/golangci-lint + version: v1.61.0 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 66fd3eb..c44e248 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: - id: gitleaks - repo: https://github.com/golangci/golangci-lint - rev: v1.60.3 + rev: v1.61.0 hooks: - id: golangci-lint-full name: golangci-lint-root diff --git a/Makefile b/Makefile index cf3af76..87c72d6 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # renovate: datasource=docker depName=golangci/golangci-lint -GOLANGCI_LINT_VERSION = v1.60.3 +GOLANGCI_LINT_VERSION = v1.61.0 .DEFAULT_GOAL := help .PHONY: help diff --git a/tests/exporter_test.go b/tests/exporter_test.go index fa285a6..3850572 100644 --- a/tests/exporter_test.go +++ b/tests/exporter_test.go @@ -6,6 +6,7 @@ import ( "log/slog" "strings" "sync" + "time" "github.com/go-logr/logr" . "github.com/onsi/ginkgo/v2" @@ -69,11 +70,10 @@ var _ = Describe("Exporter", func() { lc *matchingLogConsumer exporter *telemetry.Exporter collector testcontainers.Container - ctx context.Context ) BeforeEach(func() { - ctx = context.Background() + ctx := context.Background() // Run the collector container @@ -108,6 +108,7 @@ var _ = Describe("Exporter", func() { Started: true, }) Expect(errCollector).ToNot(HaveOccurred()) + DeferCleanup(collector.Terminate, ctx) // Create the exporter @@ -134,18 +135,10 @@ var _ = Describe("Exporter", func() { telemetry.WithGlobalOTelErrorHandler(errorHandler), ) Expect(err).ToNot(HaveOccurred()) + DeferCleanup(exporter.Shutdown, ctx) }) - AfterEach(func() { - if collector != nil { - Expect(collector.Terminate(ctx)).To(Succeed()) - } - if exporter != nil { - Expect(exporter.Shutdown(ctx)).To(Succeed()) - } - }) - - It("exports data successfully", func() { + It("exports data successfully", func(ctx SpecContext) { lc.setExpectedSubstrings([]string{ "resourceCount: Int(1)", }) @@ -156,6 +149,8 @@ var _ = Describe("Exporter", func() { Expect(exporter.Export(ctx, data)).To(Succeed()) - Eventually(lc.unmatchedCount, "10s").Should(BeZero()) - }) + Eventually(func() int { + return lc.unmatchedCount() + }).WithContext(ctx).Should(BeZero()) + }, SpecTimeout(time.Second*10)) })