[Flaky Test] x-pack/heartbeat/scenarios TestStateContinuity
- Dominant language
- Go
- Stars
- 12.7k
- Forks
- 5k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 370
Description
## Flaky Test
* **Test Name:** TestStateContinuity
* **Link:** Link to file/line number in github.
* **Branch:** main
* **Artifact Link:** https://github.com/elastic/beats/actions/runs/18601334154/job/53040242982?pr=47192#step:5:266
### Stack Trace
```
=== FAIL: x-pack/heartbeat/scenarios TestStateContinuity/simple-browser~<<~MULTI-TWIST~[>~~ (0.26s)
stateloader_test.go:37:
Error Trace: /Users/runner/work/beats/beats/x-pack/heartbeat/scenarios/stateloader_test.go:37
/Users/runner/work/beats/beats/x-pack/heartbeat/scenarios/framework/framework.go:144
Error: Not equal:
expected: "up"
actual : "down"
Diff:
--- Expected
+++ Actual
@@ -1,2 +1,2 @@
-(monitorstate.StateStatus) (len=2) "up"
+(monitorstate.StateStatus) (len=4) "down"
Test: TestStateContinuity/simple-browser~<<~MULTI-TWIST~[>~~
Messages: monitor had unexpected state down, synthetics console output:
Error: failed to execute go: exit status 1
/Users/runner/hostedtoolcache/node/18.20.3/arm64/lib/node_modules/@elastic/synthetics/node_modules/undici/lib/web/webidl/index.js:531
webidl.is.File = webidl.util.MakeTypeAssertion(File)
^
ReferenceError: File is not defined
at Object. (/Users/runner/hostedtoolcache/node/18.20.3/arm64/lib/node_modules/@elastic/synthetics/node_modules/undici/lib/web/webidl/index.js:531:48)
at Module._compile (node:internal/modules/cjs/loader:1364:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
at Module.load (node:internal/modules/cjs/loader:1203:32)
at Module._load (node:internal/modules/cjs/loader:1019:12)
at Module.require (node:internal/modules/cjs/loader:1231:19)
at require (node:internal/modules/helpers:177:18)
at Object. (/Users/runner/hostedtoolcache/node/18.20.3/arm64/lib/node_modules/@elastic/synthetics/node_modules/undici/lib/web/fetch/util.js:12:20)
at Module._compile (node:internal/modules/cjs/loader:1364:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
Node.js v18.20.3
/Users/runner/hostedtoolcache/node/18.20.3/arm64/lib/node_modules/@elastic/synthetics/node_modules/undici/lib/web/webidl/index.js:531
webidl.is.File = webidl.util.MakeTypeAssertion(File)
^
ReferenceError: File is not defined
at Object. (/Users/runner/hostedtoolcache/node/18.20.3/arm64/lib/node_modules/@elastic/synthetics/node_modules/undici/lib/web/webidl/index.js:531:48)
at Module._compile (node:internal/modules/cjs/loader:1364:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
at Module.load (node:internal/modules/cjs/loader:1203:32)
at Module._load (node:internal/modules/cjs/loader:1019:12)
at Module.require (node:internal/modules/cjs/loader:1231:19)
at require (node:internal/modules/helpers:177:18)
at Object. (/Users/runner/hostedtoolcache/node/18.20.3/arm64/lib/node_modules/@elastic/synthetics/node_modules/undici/lib/web/fetch/util.js:12:20)
at Module._compile (node:internal/modules/cjs/loader:1364:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
Node.js v18.20.3, errors%!(EXTRA []*beat.Event=[{"@metadata":{"raw_index":"synthetics-browser-default"},"@timestamp":"0001-01-01T00:00:00Z","data_stream":{"Namespace":"default","Dataset":"browser","Type":"synthetics"},"error":{"type":"io","code":"BAD_CMD_STATUS","message":"journey did not finish executing, 0 steps ran (attempt: 1): error executing step: command '/Users/runner/hostedtoolcache/node/18.20.3/arm64/bin/elastic-synthetics --screenshots on --inline --rich-events --outfd 3' exited unexpectedly with code: 1","stack_trace":null},"event":{"dataset":"browser","type":"heartbeat/summary"},"monitor":{"check_group":"5a2488f2-ab86-11f0-b360-16e1245332cb-1","id":"browser-test-id","name":"browser-test-name","status":"down","timespan":{"gte":"2025-10-17T18:23:17.635957Z","lt":"2025-10-17T18:24:17.635957Z"},"type":"browser"},"observer":{"geo":{"location":"44.9778, 93.2650","name":"Minneapolis"},"name":"na-mpls"},"state":{"id":"na-mpls-199f3697083-0","started_at":"2025-10-17T18:23:17.635963Z","duration_ms":"105","status":"down","checks":2,"up":0,"down":2,"flap_history":[],"ends":null},"summary":{"attempt":1,"max_attempts":1,"final_attempt":true,"up":0,"down":1,"status":"down","retry_group":"5a2488f2-ab86-11f0-b360-16e1245332cb"},"synthetics":{"type":"heartbeat/summary"}} {"@metadata":{"raw_index":"synthetics-browser-default"},"@timestamp":"0001-01-01T00:00:00Z","data_stream":{"Namespace":"default","Dataset":"browser","Type":"synthetics"},"error":{"type":"io","code":"BAD_CMD_STATUS","message":"journey did not finish executing, 0 steps ran (attempt: 1): error executing step: command '/Users/runner/hostedtoolcache/node/18.20.3/arm64/bin/elastic-synthetics --screenshots on --inline --rich-events --outfd 3' exited unexpectedly with code: 1","stack_trace":null},"event":{"dataset":"browser","type":"heartbeat/summary"},"monitor":{"check_group":"5a3c76ec-ab86-11f0-b360-16e1245332cb-1","id":"browser-test-id","name":"browser-test-name","status":"down","timespan":{"gte":"2025-10-17T18:23:17.741875Z","lt":"2025-10-17T18:24:17.741875Z"},"type":"browser"},"observer":{"geo":{"location":"44.9778, 93.2650","name":"Minneapolis"},"name":"na-mpls"},"state":{"id":"na-mpls-199f3697083-0","started_at":"2025-10-17T18:23:17.635963Z","duration_ms":"105","status":"down","checks":2,"up":0,"down":2,"flap_history":[],"ends":null},"summary":{"attempt":1,"max_attempts":1,"final_attempt":true,"up":0,"down":1,"status":"down","retry_group":"5a3c76ec-ab86-11f0-b360-16e1245332cb"},"synthetics":{"type":"heartbeat/summary"}}])
```
Contributor guide
Research direction
Start with x-pack/heartbeat/scenarios/stateloader_test.go and the referenced framework/framework.go call site. Reproduce TestStateContinuity on main using the Node.js 18.20.3 environment, then investigate the @elastic/synthetics/undici ReferenceError: File is not defined and why it makes the monitor state down instead of up. Done means the scenario runs successfully and the test reports the expected up state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, node.js
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100