[APM][Scout] Stabilize service map embeddable test panel time range#268459
Conversation
The flake on this test was caused by a time-drift between when synthtrace
ingested data in global setup (`now-15m..now` at setup time) and when the
spec actually ran. The Service Map embeddable factory hard-codes a default
panel-level `time_range: { from: 'now-15m', to: 'now' }` that overrides the
dashboard's range, and that range cannot be configured from the editor
flyout itself. So even with the dashboard widened, the panel queried only
`now-15m..now` at view time -- if the parallel test suite spent more than
~15 minutes between setup and this spec running, the synth window slid
fully outside the panel's window and `service-map-test` was missing from
both the suggestions endpoint (combo box) and the rendered service map.
Restructure the spec so the panel is added with no filters first, then
its custom time range is widened to "Last 24 hours" via the Customize
panel flow before re-opening the editor in edit mode to apply filters.
The editor flyout in edit mode is fed the panel's current time range,
so the suggestions endpoint now resolves `service-map-test` in a 24h
window, and the rendered service map sees the synth data regardless of
realistic setup-to-test drift.
Closes elastic#265639
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Pinging @elastic/obs-presentation-team (Team:obs-presentation) |
|
/flaky scoutConfig:x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel.playwright.config.ts:50 |
Flaky Test Runner✅ Build triggered - kibana-flaky-test-suite-runner#12204
|
sbelastic
left a comment
There was a problem hiding this comment.
Assuming flaky tests pass, LGTM.
Note: In a future improvement/implementation we should consider instead of having a wider time range, to take advantage of page.clock.install() and page.clock.fastForward()
@sbelastic that's a good idea, I would add that in terms of UX it would be nice to have the time picker on top before the filters so it is clear why the service is not visible for example if the user is looking for a service which is not present in the last 15 mins (but this is only during the creation the time range is visible in the panel after) |
💚 Build Succeeded
Metrics [docs]
|
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#12204[✅] x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel.playwright.config.ts (--arch stateful --domain classic): 50/50 tests passed. |
|
Starting backport for target branches: 9.3, 9.4 https://github.com/elastic/kibana/actions/runs/25566111245 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Summary
Fixes the flaky Service map embeddable Scout test by removing the
implicit dependency on wall-clock drift between global setup and test
execution.
Why it was flaky
`now-15m..now` (anchored to the moment global setup runs).
`time_range: { from: 'now-15m', to: 'now' }` that overrides the
dashboard's range, and that range cannot be configured from the
editor flyout at panel creation time.
parallel suite (global setup + everything that runs before this spec)
has to complete in well under ~15 minutes. Once the cumulative
`testNow - setupNow` drift exceeds the 15-minute panel window, the
synth data slides fully outside the panel's range and
`service-map-test`:
`apmServiceMapEditorServiceNameComboBox` option never appears →
`selectSingleOption` times out (the original failure in Failing test: Service map embeddable - adds Service map panel with service name, environment and KQL filter #265639), or
"No services available" → the
`serviceMapNode-service-service-map-test` visibility assertion
times out.
Why we have to use the edit flow
The editor flyout exposes only `service_name`, `environment` and
`kuery`; it has no UI for `time_range`. The factory always seeds the
new panel with the 15-minute default, so the only way to widen the
panel's queried window is the dashboard-level Customize panel flow
after the panel exists. To make that widened window actually take
effect for the suggestions endpoint, we then have to re-open the editor
in edit mode — `onEdit` passes
`timeRangeManager.api.timeRange$.getValue()` (now 24h) into the
flyout, so the combo boxes' suggestions are resolved in the wider
window. We can't apply the filters first and widen later, because the
first `selectSingleOption` is exactly what was failing.
What changed
`x-pack/solutions/observability/plugins/apm/test/scout/ui/parallel_tests/service_map/service_map_embeddable.spec.ts`:
editor) → panel exists with the factory's default 15-minute custom
range and the `CUSTOM_TIME_RANGE_BADGE` is asserted.
toggle is on, set the panel's range to Last 24 hours via the
panel-scoped `superDatePicker` quick menu, save.
`embeddablePanelAction-editPanel` and apply
`service_name` / `environment` / `kuery`. With the 24h panel
range, the `apmServiceMapEditorServiceNameComboBox` reliably
resolves `service-map-test` even with realistic setup-to-test
delay.
disable-custom-time-range, View full service map) run against the
24h panel range, so they no longer depend on the 15-minute synth
window aligning with wall-clock "now".
`global.setup.ts` is unchanged — synth still ingests at
`now-15m..now`. 24h easily covers any realistic delay between global
setup and this spec running.
References
Closes #265639
Test plan
Made with Cursor