Commit df71818
committed
fix(telemetry): e2e suite singleton reset + relaxed flush-on-close assert
CI on the previous commit showed two e2e failures driven by state that
leaks across e2e test files, not by real defects:
1. `should initialize telemetry when telemetryEnabled is true` —
`featureFlagCacheSpy.called` was false because a prior e2e suite had
already created a TelemetryClient for the test host. Subsequent
`getOrCreateClient` calls hit the existing holder and skip the
constructor (and the FFCache.getOrCreateContext call inside it).
Fixed by `before` + `beforeEach` `__resetInstanceForTests()` so this
suite always sees a fresh provider regardless of execution order.
That also clears the "second context, different auth" F4 warn that
was firing on every test in this suite.
2. `should cleanup telemetry on close` — `MetricsAggregator.flush()`
isn't called by the close-drain when `pendingMetrics` is empty
(the test connects + closes without ever `openSession`-ing, so no
events are queued). Replaced the strict `flushSpy.called` assert
with `aggregatorCloseSpy.called` — `MetricsAggregator.close()` is
the cleanup surface that always runs, regardless of buffer state.
Also: change the outer `describe` from `function ()` to arrow form
(eslint `prefer-arrow-callback`); only `before`/`it` need the
function-form for `this`.
Co-authored-by: Isaac
Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>1 parent 44bb38f commit df71818
1 file changed
Lines changed: 25 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
77 | 81 | | |
78 | 82 | | |
79 | 83 | | |
80 | 84 | | |
| 85 | + | |
81 | 86 | | |
| 87 | + | |
82 | 88 | | |
83 | 89 | | |
84 | 90 | | |
85 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
86 | 98 | | |
87 | 99 | | |
88 | 100 | | |
| |||
222 | 234 | | |
223 | 235 | | |
224 | 236 | | |
225 | | - | |
| 237 | + | |
226 | 238 | | |
227 | 239 | | |
228 | 240 | | |
| |||
234 | 246 | | |
235 | 247 | | |
236 | 248 | | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
241 | 257 | | |
242 | | - | |
| 258 | + | |
243 | 259 | | |
244 | 260 | | |
245 | | - | |
| 261 | + | |
246 | 262 | | |
247 | 263 | | |
248 | 264 | | |
| |||
0 commit comments