Commit 16972c0
authored
[Streams] Make ES|QL view creation best-effort and guard test against unsupported ES versions (elastic#258584)
Resolves elastic#256797
## Summary
Fixes a consistent CI failure in the `basic.ts` deployment-agnostic API
integration test for Streams where `POST /api/streams/_enable` returned
a `500 Internal Server Error`. The failure was introduced by elastic#256096,
which added ES|QL view creation to the `enableStreams` flow, and had
occurred 15+ times on `main` (tracked in elastic#256797).
### Root cause
The `ExecutionPlan.execute()` method called `upsertEsqlViews()` inside
the same `try/catch` block as all other Elasticsearch operations. The
ES|QL views API (`/_query/view/`) is not available in all Elasticsearch
builds used in CI (e.g. the 9.4.0-SNAPSHOT used by the
deployment-agnostic stateful test cluster). When that call failed, the
error propagated up through `FailedToExecuteElasticsearchActionsError`
and ultimately caused `enableStreams` to return a 500.
The test itself contributed by unconditionally enabling
`OBSERVABILITY_STREAMS_ENABLE_WIRED_STREAM_VIEWS` via
`uiSettings.update` before calling `enableStreams`, which activated the
ES|QL view creation path regardless of whether the API was actually
available in the environment.
### Changes
**`execution_plan.ts` — make ES|QL view creation best-effort**
The `upsertEsqlViews()` call is moved outside the main `try/catch` block
and given its own `.catch()` that logs a warning instead of rethrowing.
This ensures that stream enablement succeeds even when the ES|QL views
API is unavailable, treating view creation as a non-critical
side-effect.
**`basic.ts` — runtime-probe the ES|QL views API before using it**
Instead of unconditionally enabling the feature flag, the `before` hook
now probes `GET /_query/view/__kibana_probe__` against the test
Elasticsearch cluster:
- A `404` response means the endpoint exists (but the probe view
doesn't) → API is available, feature flag is enabled, view assertions
run normally.
- Any other error means the API is not supported in this environment →
feature flag is left disabled, view-specific `it` blocks return early.
This makes the test self-adapting to the ES version present in each CI
environment without skipping the entire suite.
### Verification
The root cause was confirmed from [Buildkite build
90333](https://buildkite.com/elastic/kibana-on-merge/builds/90333): the
test cluster ran ES `9.4.0-SNAPSHOT` (March 9 2026 snapshot), the
failure was the 15th consecutive occurrence, and no Kibana-level error
log for `plugins.streams` was emitted — consistent with the error being
swallowed by the framework router after `throw error` in the route
handler, never reaching a log sink visible in FTR output.1 parent b12d5a0 commit 16972c0
2 files changed
Lines changed: 42 additions & 12 deletions
Lines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | 246 | | |
250 | 247 | | |
251 | 248 | | |
| |||
254 | 251 | | |
255 | 252 | | |
256 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
257 | 269 | | |
258 | 270 | | |
259 | 271 | | |
| |||
Lines changed: 27 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
74 | | - | |
| 73 | + | |
75 | 74 | | |
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
79 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
80 | 84 | | |
81 | 85 | | |
82 | 86 | | |
83 | 87 | | |
84 | | - | |
85 | | - | |
86 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
87 | 101 | | |
88 | 102 | | |
89 | 103 | | |
90 | 104 | | |
91 | | - | |
| 105 | + | |
92 | 106 | | |
93 | 107 | | |
94 | 108 | | |
| |||
127 | 141 | | |
128 | 142 | | |
129 | 143 | | |
130 | | - | |
| 144 | + | |
131 | 145 | | |
132 | 146 | | |
| 147 | + | |
133 | 148 | | |
134 | 149 | | |
135 | 150 | | |
| |||
220 | 235 | | |
221 | 236 | | |
222 | 237 | | |
223 | | - | |
| 238 | + | |
224 | 239 | | |
225 | 240 | | |
| 241 | + | |
226 | 242 | | |
227 | 243 | | |
228 | 244 | | |
| |||
320 | 336 | | |
321 | 337 | | |
322 | 338 | | |
323 | | - | |
| 339 | + | |
324 | 340 | | |
325 | 341 | | |
| 342 | + | |
326 | 343 | | |
327 | 344 | | |
328 | 345 | | |
| |||
336 | 353 | | |
337 | 354 | | |
338 | 355 | | |
| 356 | + | |
339 | 357 | | |
340 | 358 | | |
341 | 359 | | |
| |||
0 commit comments