Repository navigation
Commit 08ba447
tests: wait for the fake OpenVMM's whole command line (flaky state read)
The Windows job of CI run 43131964028, on #1496, which doesn't touch
this code, failed in the CLI test
start_opens_the_stable_caller_paths_that_provision_checked:
tests\cli\harness.rs:538:33: ...\build\fake-openvmm-state.json:
EOF while parsing a value at line 1 column 0
The test starts a sandbox in the background, waits until the fake
OpenVMM's record of its command line, fake-openvmm-state.json, exists,
and then parses it. The fake writes the record with fs::write, which
creates the file before it writes its content, so a test that reads it
in between finds it empty. #1460 added the parse right after that wait,
which until then only told the test that OpenVMM had started.
wait_for_json, which the same file already uses for the fake's record
of its block devices, waits for exactly this.
The test now takes the arguments from wait_for_json, which returns once
the record holds a whole JSON document, and checks the same things in
the same order: the record of the block devices still doesn't exist
then, since the fake opens its images 1.5 s after it starts. wait_for's
comment now sends a test that reads a file's content to wait_for_json.
The fake keeps writing its records with fs::write. Its other readers
run once the command that launched it has returned, or once it has
exited, so after it wrote them. A temporary file and a rename would
spare future readers the wait, but on Windows a rename fails while
another process, such as a scanner, holds the record that it replaces
open without sharing its deletion, and the fake ignores its write
errors, so a second launch of the same sandbox could leave the first
one's record in place.
Evidence, at 14ca267, with a fake that waits 300 ms between
creating the record and writing it: the base test failed with the CI
symptom on a Windows 11 workstation and on nvx-kvm-test (Linux, KVM),
and this change passed on both. Without that wait, this change passed
50 of 50 runs of the test and 3 of 3 runs of the CLI suite on each.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 5b3fab2 commit 08ba447
1 file changed
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1885 | 1885 | | |
1886 | 1886 | | |
1887 | 1887 | | |
1888 | | - | |
| 1888 | + | |
| 1889 | + | |
1889 | 1890 | | |
1890 | 1891 | | |
1891 | 1892 | | |
| |||
1947 | 1948 | | |
1948 | 1949 | | |
1949 | 1950 | | |
1950 | | - | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
1951 | 1954 | | |
1952 | 1955 | | |
1953 | 1956 | | |
1954 | 1957 | | |
1955 | 1958 | | |
1956 | | - | |
1957 | 1959 | | |
1958 | 1960 | | |
1959 | 1961 | | |
| |||
0 commit comments