Skip to content

Commit 38230c6

Browse files
committed
Fix telemetry e2e tests for default-enabled behavior
- Update test expectations to reflect telemetry being enabled by default - Add feature flags cache cleanup in teardown to prevent state leakage between tests - This ensures each test runs with fresh feature flag state
1 parent ad01fc2 commit 38230c6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/e2e/test_telemetry_e2e.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ def telemetry_setup_teardown(self):
5858
TelemetryClientFactory._stop_flush_thread()
5959
TelemetryClientFactory._initialized = False
6060

61+
# Clear feature flags cache to prevent state leakage between tests
62+
from databricks.sql.common.feature_flag import FeatureFlagsContextFactory
63+
with FeatureFlagsContextFactory._lock:
64+
FeatureFlagsContextFactory._context_map.clear()
65+
if FeatureFlagsContextFactory._executor:
66+
FeatureFlagsContextFactory._executor.shutdown(wait=False)
67+
FeatureFlagsContextFactory._executor = None
68+
6169
@pytest.fixture
6270
def telemetry_interceptors(self):
6371
"""Setup reusable telemetry interceptors as a fixture"""
@@ -163,7 +171,7 @@ def verify_events(self, captured_events, captured_futures, expected_count):
163171
(True, False, 2, "enable_on_force_off"),
164172
(False, True, 2, "enable_off_force_on"),
165173
(False, False, 0, "both_off"),
166-
(None, None, 0, "default_behavior"),
174+
(None, None, 2, "default_behavior"),
167175
])
168176
def test_telemetry_flags(self, telemetry_interceptors, enable_telemetry,
169177
force_enable, expected_count, test_id):

0 commit comments

Comments
 (0)