fix timeout cleanup

This commit is contained in:
Shreyas Goenka 2024-11-29 02:04:42 +01:00
parent a9c53acdff
commit 6cde085b22
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
2 changed files with 3 additions and 2 deletions

View File

@ -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.

View File

@ -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{