From 6cde085b2215f03ebd6a855ec7054ccf90926548 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Fri, 29 Nov 2024 02:04:42 +0100 Subject: [PATCH] fix timeout cleanup --- internal/telemetry_test.go | 2 +- libs/telemetry/logger_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/telemetry_test.go b/internal/telemetry_test.go index 35bb6c0d5..d5f8e0ec3 100644 --- a/internal/telemetry_test.go +++ b/internal/telemetry_test.go @@ -36,7 +36,7 @@ func TestAccTelemetryLogger(t *testing.T) { // Extend the maximum wait time for the telemetry flush just for this test. telemetry.MaxAdditionalWaitTime = 1 * time.Hour t.Cleanup(func() { - telemetry.MaxAdditionalWaitTime = 2 + telemetry.MaxAdditionalWaitTime = 2 * time.Second }) // Log some events. diff --git a/libs/telemetry/logger_test.go b/libs/telemetry/logger_test.go index ff84c1f18..8ae38942b 100644 --- a/libs/telemetry/logger_test.go +++ b/libs/telemetry/logger_test.go @@ -5,6 +5,7 @@ import ( "fmt" "net/http" "testing" + "time" "github.com/databricks/cli/cmd/root" "github.com/stretchr/testify/assert" @@ -78,7 +79,7 @@ func TestTelemetryLoggerFlushExitsOnTimeout(t *testing.T) { // Set the maximum additional wait time to 0 to ensure that the Flush method times out immediately. MaxAdditionalWaitTime = 0 t.Cleanup(func() { - MaxAdditionalWaitTime = 2 + MaxAdditionalWaitTime = 2 * time.Second }) mockClient := &mockDatabricksClient{