Author SHA1 Message Date
faumarayandClaude Fable 5.1 3930ef2945 Merge phase5/test-hygiene: test hygiene after the runner-image round (DatabaseBusy twin, closed-port race, the load-only flakes, ts6_banners alone with its server, docs/testing/load.md)
CI / Linux checks (push) Failing after 5m13s
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 06:12:04 +03:00
faumarayandClaude Fable 5.1 8614b120fe docs: load.md records the review's undecodable_video flake and the seven unformatted intermediate commits
The review's 100 whole-binary runs of the head saw
media::tests::undecodable_video_is_noticed_through_the_pipeline fail once
at load 106-146 (untouched by the round); it joins "Seen and left alone".
cargo fmt differed at seven intermediate commits, not six (the shell-only
5c029a9 sits on the unformatted tree); the orchestrator waives per-commit
rustfmt for them, fixed forward in 94195db, history not rewritten.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 06:11:47 +03:00
faumarayandClaude Sonnet 5.5 f791d3926f docs: testing/load.md names its own commits
The record's table said "this one" for the commit that adds the page; there
are two, the page and its record.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 04:54:19 +03:00
faumarayandClaude Sonnet 5.5 376925a96e docs: testing/load.md records the round, its commits and what ran
The record of the round at the top of the page, in the form of the earlier
rounds' records: the branch and its base, the fallback for the unregistered
mao-* agents, the commit table (which commits are the cut-off run's, which are
this attempt's, which are beyond the list), the two hunks dropped from the
cut-off run's tree, and a table of the checks that ran on the final tree. The
scope test's row gets the failures of the earlier tree that only had the first
half of its fix.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 04:54:03 +03:00
faumarayandClaude Sonnet 5.5 d4ccb8c8b8 docs: testing/load.md, how to make a machine busy and what the load-only tests assert
The recipe of the round (32 busy loops beside many runs of a test binary, a
build before and one after run alternately), the rules the fixes followed, the
table of the tests that failed only under load with their counts before and
after, the account-change test of the seam follow-ups (not reproduced; the
timing of its steps against its deadlines, and the reading of the code that
found no race), the tests seen at heavier load and left alone, and the
engine stage of the live smoke (ts6_banners failed because the test shared the
TeamSpeak 6 server with the others; what the smoke still does not do
reliably). docs/ci.md points to it from the section on the job image.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 04:34:05 +03:00
faumarayandClaude Sonnet 5.5 ad806606ac Say in the smoke script which of its checks still flake
After the roundtrip and ts6_banners fixes the smoke passed two of three runs
on the head of the branch; the third failed at the directory check of the
TeamSpeak 6 stage, `the directory did not list the stream`. The viewer of that
check ends when it has 30 frames and the script looks for the directory's
`"title"` line, which the viewer prints only if its own gateway session had
connected by then; in the failed run it was still `observe=Connecting`. The
fix is in voelinctl engine (end the viewer on both), not in a round about
tests, so the comment above directory_check records it, with the earlier
`expected output did not appear` of the gateway stage that was seen with the
same engine state.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 04:34:05 +03:00
faumarayandClaude Sonnet 5.5 f508e5bec4 Count frames, not a pause, in the automatic-bitrate test's "not per frame" check
Beyond the list of this round, found by its final whole-binary run: 1 of 150
runs of the voelin-core lib beside 32 busy loops failed in
an_automatic_bitrate_follows_the_stream, at the assertion that the sink is told
the layer's format once per change and not per frame (`left: 2, right: 1`), and
the unchanged test failed 2 of 900 runs of its own beside the same load.

The sink is told twice for the first picture, and the test counted in between:
Streamer::attach tells it the format from the size captured so far (when a
frame has been captured before the attach), and the encoder tells it again
before its first frame, because its record of what it told starts empty. The
test waited for the format, took the count, slept 200 ms and compared; on a
busy machine the encoder's first frame comes later than the 200 ms.

The test now waits until a frame has been handed over (the encoder tells before
it hands over, so both tellings are done), takes the count, waits for five more
frames, and compares: "per frame" is counted in frames. The deadline of 30 s
only ends a hang. 0 failures of 600 runs of the test beside 32 busy loops.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 03:59:07 +03:00
faumarayandClaude Sonnet 5.5 94195db16a Format four spots of the test changes of this round with rustfmt
cargo fmt on the own crates changed these four places of the commits before:
the match arm of ask_files_until, the closure of the features test, the count
closure of streamer_sends_opus and the call of preview_until in the studio
test. No change of meaning. Each of those commits passes clippy on its own;
rustfmt was not clean in them until this one.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 03:42:19 +03:00
faumarayandClaude Sonnet 5.5 5c029a982a Start the smoke's action when its listener is on the server, not after 3 s
roundtrip started the listener in the background, waited a fixed 3 s and ran
the action (the poke, the private message, the avatar request, the file
upload). A dev server that is slow to let a client in (4 s and more, 13 s
seen, when the machine is busy) left the action running against a client that
was not on the server yet: `error: message: the client is not on the server`,
and `FAIL: private message: the action failed` (the action's client printed
`connected: 2 clients` and the listener's `connected: 1 clients` came after).
That is one of the places at which the earlier steps of the smoke flaked.

voelinctl engine prints `connected: N clients` once its client is on the
server and has seen the presence, for every action; roundtrip now waits for
that line in the listener's log (60 s at most, and not when the listener has
ended) and then 1 s more, for the others on the server to see the listener.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 03:30:02 +03:00
faumarayandClaude Sonnet 5.5 069fd2ac12 Run ts6_banners with the TeamSpeak 6 server to itself
The engine stage of the live smoke failed in every run that reached it, before
and after every recent branch, at crates/voelin-core/tests/live.rs
`disabled policy must prevent HTTP requests` (ts6_banners, left: 4, right: 0),
while the six tests of the file passed one after the other.

ts6_banners sets and unsets the TeamSpeak 6 server's banners, and it counts the
requests that reach an HTTP server of its own for the images it set, to show
that an engine whose policy is disabled makes none. The server tells every
client that connects while the banners are set where they are, and an engine
fetches what it is told (as it should): the other tests of the binary, which
cargo runs side by side, connect engines to the same server, and their
requests were counted as the engine under test's. Reproduced against the
development servers with the tests in pairs: ts6_banners alone passes (62 s),
with ts6_avatars, ts6_engine or ts6_channel_joins at the same time it fails
(`left: 2` or, in the join test's case, a later count, `left: 6, right: 4`),
and the TS3 and TS6 tests without it pass in any combination. So the test was
wrong, not the engine or the script's ordering: it needs the server to itself.

The TeamSpeak 6 tests that connect now hold a lock shared and ts6_banners
holds it exclusively, so it runs before or after them and not meanwhile. The
smoke is not run with --test-threads=1 for this: that would hide it, not
remove it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 03:29:42 +03:00
faumarayandClaude Sonnet 5.5 661a607a35 Make two more link and media tests independent of how long the machine takes
Beyond the list of this round, found by its load runs and rarer than the tests
of the list: in about 500 runs of the whole voelin-core lib beside 32 busy
loops, a_scope_bigger_than_the_channel_is_sent_in_bigger_chunks failed 3 times
(the scope had 1 channel, not 5,003) and streamer_sends_opus 2 times (the
`video too` expectation). The fixes are of the mechanism the code shows; the
runs after them (docs/testing/load.md) are too few to count a rate that low.

a_scope_...: the connector waits 250 ms for a link's first snapshot after it
said it is connected, and the test made its 5,000 channels after saying it, so
a busy machine made the session without them. The channels are made first. The
scope is also sent whole only if the presence is in the host's state when it
is asked for, so the test now sends a voice packet of one of the presence's
clients and waits for it to come through: the link takes its events in order,
and a packet of a client comes through only once the presence is in.

streamer_sends_opus: it waited for ten frames of audio and then expected a
frame of video, but audio is made quickly and a busy machine can keep the
video encoder from its first frame for longer. It now waits for ten frames of
audio and one of video, whichever the encoders make first; its deadline, 30 s,
only ends a hang.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 03:27:19 +03:00
faumarayandClaude Sonnet 5.5 92d02b0e00 Wait for the studio's delivered count in the capture-backend test
Beyond the list of this round, found by its load runs: in 150 runs of the
whole voelin-media test binary beside 32 busy loops, 11 failed, 9 of them in
packets_reach_the_outputs_and_the_studio_is_a_capture_backend at
`assert!(studio.shared.delivered.load(..) > 0)` (the other 2 in
it_composes_into_the_preview_and_follows_commands, fixed in the commit before).

The studio counts a frame as delivered after it has handed it to the capture
sink (`sink.frame(..)`, then `delivered.fetch_add`), so a test that has just
received the frame can read the count before it is made. The test now waits
for the count to become non-zero after it has the frame; the wait for the
frame is 30 s instead of 5 s, and the wait for the count 30 s, which only end
a hang.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 03:26:56 +03:00
faumarayandClaude Sonnet 5.5 9d04e0158a Wait for a preview frame of the size and scene asked for in the studio test
it_composes_into_the_preview_and_follows_commands took the first preview frame
after SetPreview and asserted its size. The studio composes from the moment it
starts, at the preview size and rate it has then (480x270, 15 fps), so the
first frame there is can be one of that size, composed before the command was
applied; on a busy machine it is. The 2 s waits for the new scene's colour
and the test's overall 5 s and 10 s limits measured the machine too.

preview_until now reads the preview until a frame that the test takes comes,
and looks at 20 frames at most: the preview keeps only the latest frame, so
few older ones are waiting or on their way, and the number of frames looked at
is the bound by the work. The wait for each frame, 30 s, only ends a hang.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 03:26:33 +03:00
faumarayandClaude Sonnet 5.5 77304604fe Let the stream task say when it is done in the layer-format test
layer_formats_reach_the_live_stream sent the same layer format a second time
and then slept 200 ms before asserting that no keyframe was asked for, which
tests that the stream task had not got to the command within 200 ms. It is the
task that asks for a keyframe (when the layer's bitrate changes) and it takes
its commands in the order they are sent, from the sink and from the handle
through the same channel. The test now sends a command whose answer is an
error event (Kick of a viewer, 65535, that is none) and waits for that
event: it comes after everything the format set going, and nothing is left to
wait out. A keyframe request the viewer's side makes late is not covered, and
none was seen.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 03:26:33 +03:00
faumarayandClaude Sonnet 5.5 c5bb74ffcb Ask the file list one question at a time in the server-features test
the_features_of_a_server_are_the_hosts_narrowed_by_the_servers_list asked for
the lobby's file list every 20 ms until the answer was the one it wanted. The
bus holds 16 events, so on a busy machine the answers fell behind it (and
behind the host's work) and the one that counted was lost in the backlog, or
an answer to a question asked before the host narrowed what it offers was
taken for one asked after.

A helper, ask_files_until, now asks one question and reads the bus until that
question's answer comes, then asks the next only if the answer was not the one
wanted. Every question is answered before the next is asked, so those asked
after the update is pushed are the ones the update can refuse; nothing has to
be told apart by number, and nothing is waited out by the clock. The test
checks that the answer after the server lifted its list came from the host.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 03:26:33 +03:00
faumarayandClaude Sonnet 5.5 81c40a4b09 Wait for the states audio_sources_change_live asserts, and keep feeding the microphone
audio_sources_change_live failed 6 of 200 runs beside 32 busy loops, in two
ways. It waited for the sources' meters and then asserted their state and the
mixer's level and limiter, which are set at other times than the meters: the
state could still be Starting when the meters showed the tones. And its
microphone thread published 50 chunks of 20 ms, one second, and the source
takes what is published only from when it runs, which a busy machine delays
by any time, so the test then waited 5 s for a level that had gone by.

The first wait now includes the state, the mix and the limiter. The thread
publishes until the test has heard the tone (or, as a cap that ends a thread
whose test failed first, 120 s), and the second wait includes the window
source's error and the muted tone's own level, which the test asserted right
after it. The deadlines of the waits, 30 s, only end a hang; what is waited
for is a state.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 03:26:22 +03:00
faumarayandClaude Sonnet 5.5 25be4337a8 State what the preview's rates are, not what a busy machine reaches
The end of local_preview_decodes_the_pattern asked the rates of the second
since the first stats call to be 20 to 40 pictures and 100,000 to 5,000,000
bits a second. How many pictures a second the pipeline manages is a property
of the machine's load, and a second of sleep is longer than a second when the
machine is busy; neither is what the stats are about. What they promise is
that fps and bitrate are the counters' change over the time since the call
before.

The test now times its two stats calls and the sleep between them. The time
the stats measured lies between the two spans that the test measured around
it (from the end of the first call to the start of the second, and from the
start of the first to the end of the second), so the reported fps has to be
the pictures counted in that time, within the rounding of fps, and the
bitrate the bits counted in it, within the cut-off of bitrate. At least one
picture has to have come in the second.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 03:26:22 +03:00
faumarayandClaude Sonnet 5.5 f9bfd5d305 Check the test pattern's structure, not its pixels within a tolerance
rectangle_span, the pixel check of local_preview_decodes_the_pattern and
test_pattern_through_stream_tasks, asked every pixel further than two columns
from the rectangle's edges to be within 24 per channel of the rectangle's
colour or of the background. The streamer's VP8 speed control lowers the
quality when the encoder falls behind, and a flat colour then moves by 30 and
more per channel (seen: [33, 31, 101] and [50, 33, 48] for the background
[24, 40, 72], [255, 85, 5] for the rectangle [240, 90, 30]), still nowhere
near the other colour. A tolerance of 40 was tried and reverted: it only moves
the load at which it fails.

A pixel is now whichever of the pattern's two colours it is nearer to, and
what the test is about is the row's structure: background, one run of the
rectangle, background. The first and last pixel that are the rectangle's give
the span; everything between them, but the two blurred columns at each end,
has to be the rectangle's too, and the callers still check the span's width
and that it moves. A stray rectangle-coloured pixel in the background
stretches the span over background and fails there.

Before, the two tests failed 4 and 2 of 100 runs each beside 32 busy loops; see
docs/testing/load.md for the runs after.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 03:26:13 +03:00
faumarayandClaude Sonnet 5.5 0bc6abadfe Name the step in which the account-change test timed out
account_change_cancels_pending_handshake was seen to fail about once in 130
runs of the whole suite under load, and the failure was not kept. Its three
timeouts (5 s for the first handshake packet, 5 s for a packet from a new
socket after the account changed, 2 s for the connection to end after the
account source closed) were bare unwrap()s, so a failure said only that a
timeout had elapsed, at a line. Each now says which step it was.

No race was found, in the test or in the code it drives. The account receiver
has seen its version before the connection is made, so a change after the
first packet always restarts the connection; the restart opens a new socket,
so a packet from another port is a packet of the new connection; dropping the
sender makes changed() fail, which ends the loop with the reason the test
expects. The ways the test can fail are those three deadlines. With the steps
timed (a throw-away instrumented build, not committed), 300 runs of the test
alone, eight at a time beside 32 busy loops, all passed, and the steps took at
most 34 ms, 33 ms and 9 ms against deadlines of 5000, 5000 and 2000 ms. So
the failure needs a stall of seconds, which is the machine's and not a
property of the test; docs/testing/load.md has the numbers and what to do if
it is seen again.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 03:26:12 +03:00
faumarayandClaude Fable 5.1 de89fddcb6 deps: crypto-bigint 0.7.7, ctutils 0.4.5, rustls-webpki 0.103.16, tokio 1.54.1, webpki-root-certs 1.0.11 (RUSTSEC-2026-0382, -0383, -0385, -0386, -0387); notices regenerated
CI / Linux checks (push) Successful in 37m31s
RUSTSEC-2026-0387 stays on the crypto-bigint 0.5 and 0.6 lines that the
tsclientlib fork pins (p256 0.13 in tsproto-types, crypto-bigint in tsproto);
ignored until 2026-12-20 with the fork's move to p256 0.14 as the follow-up.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 02:44:31 +03:00
faumarayandClaude Sonnet 5.5 e465a55b9e Give the fallback gateway test a port that stays refused
the_next_published_gateway_is_used_when_one_fails took its "port nothing
listens on" by binding a listener to port 0 and dropping it at once. A port
that is free only for a moment can be given to another socket before the
engine connects to it: the other tests of the binary bind port 0 for their
fake gateways and proxies, and the one that gets the port answers the
connection, so the test then passes over a gateway that is no longer closed,
or fails on the 650 ms deadline.

The test now binds a TCP socket and keeps it, without listening, for its
whole length: the port is taken, so nobody else gets it, and a connection to
it is refused at once. It checks that refusal before it relies on it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 02:21:55 +03:00
faumarayandClaude Sonnet 5.5 ac957a0c87 Reopen the history database of the gateway test after the engine has closed it
history_on_open_paging_and_offline_messages drops its engine and opens the same
database again for the restart it tests, the same shape as the contacts test
that 0d67dd7 fixed: dropping an Engine does not close the history database, the
engine task ends later and closing the connection checkpoints the write-ahead
log under an exclusive lock, and a History::open meanwhile waits for that lock
only for the 5 s busy timeout, failing with DatabaseBusy on a loaded disk.

The test now waits until the -wal file is gone before it reopens. The helper
that does so (closed) moves from voice_features.rs to tests/common/mod.rs,
which both test binaries declare.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 02:21:55 +03:00
faumarayandClaude Sonnet 5.5 35408a3dfe Require the portal proxy test's child to report one passed test
The test runs itself again under dbus-run-session and, on a zero exit, returned
without looking at what the child printed. A child that ran no test at all
(its --exact filter matching nothing, as after a rename of the test) also exits
0 and printed "running 0 tests ... 0 passed", so the wrapper passed having
checked nothing. A zero exit now has to come with libtest's "test result: ok.
1 passed;" in the child's output, else the wrapper fails with that output.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 02:20:03 +03:00
faumarayandClaude Sonnet 5.5 7e63092bcd Say in from_json's doc who reads the identity text through it
The doc said every reader of the TeamSpeak identity text refuses it through
from_json. Only voelin-core reads it through there: voelin-store parses the
same text on its own (keystore.rs check_teamspeak and level, store.rs list),
and drops or forwards serde's message by its own rules. The doc now names
voelin-core and says voelin-store parses it too.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 02:19:48 +03:00
faumarayandClaude Fable 5.1 2ffe5ffb99 Merge phase5/tests-under-runner: the workspace suite green as root inside the runner image
CI / Linux checks (push) Failing after 35m27s
Every machine assumption of the tests fixed (root writes anywhere, no sound
card, no session bus, no GPU, no FFmpeg, no H.264 encoder, no display beyond
xvfb, no TeamSpeak servers, no DNS); a cancelled download's part file removed
after its task stopped (a real defect a test exposed). docs/ci.md: how to run
the suite the way CI runs it. Sonnet review accepted; its three docs minors
are in the last commit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 02:04:09 +03:00
faumarayandClaude Fable 5.1 e807df40e5 docs: ci.md quotes the right git error, removes root's files, names the bare clone, follows main's loopback and D-Bus tests; .scratch/ ignored
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 02:04:08 +03:00
faumaray a8dbc5ba74 Merge remote-tracking branch 'origin/main' into phase5/tests-under-runner 2026-10-25 02:03:16 +03:00
faumarayandClaude Sonnet 5.5 1de2725f19 Remove a cancelled download's part file after its task has stopped
The download test, which 61458df of this branch made wait for the part file,
exposed a defect of the link: a download reports Started just before it opens its part file, and the
open ran on tokio's blocking pool. Link::cancel() aborted the task and removed
the part file at once; when the cancel came between Started and the end of the
open, there was no file yet to remove, the abort cannot stop an open that is
already on the blocking pool, and the open then made an empty `<name>.part`
next to the target after the transfer had been reported Cancelled. The user
sees a leftover file, and a later download with `resume` continues from it.

files::receive now makes the directory and opens the part file with std::fs in
one step (the same kind of small blocking call as Sink::offset and the removal
in cancel, which already ran on the loop), so an abort, which takes effect at
an await, cannot come in the middle of it. Link::cancel() keeps the task's
JoinHandle instead of its AbortHandle, aborts the task, and removes the part
file and reports Cancelled from a task of its own after the aborted one has
stopped: the file the task made is then there to be found, or the task never
got to make one. Cancelled is therefore reported after the removal and after
the task has stopped, where it was reported before both.

The test goes back to the shape it had before 61458df: it cancels as soon as
the transfer is Started (and now fails loudly if it never was). That shape
failed in 10 of 100 runs of the voelin-core lib tests three at a time with 16
busy loops beside them on a 32-core machine, and in the final runs of the CI
test step in the runner image of this task (the second of three); with this
change it failed in none of 200 such runs. The link and files tests pass.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 23:07:48 +03:00
faumarayandClaude Sonnet 5.5 443559aa79 Take the keyframe baseline of the layer-format test after the streamer has settled
stream::tests::layer_formats_reach_the_live_stream asserts that telling the
sink the same layer format twice asks for no second keyframe: it drains the
sink's keyframe requests, changes the format, waits for the request that
follows, tells the same format again and expects none within 200 ms. It failed
once ("nothing changed", stream.rs:1326) in the first of the three final runs of
the CI test step in the runner image of this task, with the machine busy with
another job.

Requests reach the sink from the stream going live, from the streamer's own
view of its viewer connecting (PeerEvent::Connected, a moment after the viewer
sees WatchState::Connected, which is all the test waited for), from the
viewer's picture requests, and from a changed layer. The test drained once,
right after the viewer's side was connected, so a request of one of the first
three that arrives later is taken for the one the changed format asked for, and
the real one then arrives after the "same again" and is counted as a change.
This could not be reproduced here (0 in 400 runs of the single test, 32 at a
time with 48 busy loops, nor in 200 runs of the lib tests); the change closes
those windows as far as they can be named: the test waits for the streamer's
own Connected (StreamViewers) as well, and drains until a moment longer than
the merge interval of requests (250 ms) passes with no request, before the
format is changed. The assertions are those of before.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 21:42:15 +03:00
faumarayandClaude Sonnet 5.5 272de7a13d Read the streamer's stats until they show what the viewer already saw
Two voelin-core tests read Streamer::stats() once, at the moment a consumer had
seen the effect, and the stats lag behind it:

- stream::tests::test_pattern_through_stream_tasks asserted `video_frames >= 15`
  right after the viewer had decoded 15 pictures. The encoder counts a frame
  after the sink has taken it (`sink.send_video(..)`, then `fetch_add`), so the
  15th picture can be at the viewer first: video_frames was 14 with
  captured_frames 15 and the picture on screen.
- media::tests::an_automatic_bitrate_follows_the_stream asserted the layer's
  bitrate in the stats right after the sink had been told the layer's format;
  the stats had 0 (the layer's target is stored by the encoder thread, not by
  the call that tells the sink).

Both now poll for the value with a deadline (5 s, and 10 s as the test's other
waits), which is the same assertion without the order of two threads. Before,
on a 32-core machine with 32 busy loops beside the runs: the first failed on
that assertion in 7 of 150 runs of the stream tests six at a time, the second
in 19 of 120 runs of the voelin-core lib tests six at a time. After, in 200
runs of the lib tests three at a time with 16 busy loops beside them, neither
failed on these assertions.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 21:42:03 +03:00
faumarayandClaude Sonnet 5.5 61458df625 Cancel the download test's transfer only once its part file is made
link::tests::a_file_is_downloaded_through_the_connection_the_link_opens waited
for the Started state and then cancelled, expecting the part file to be gone
100 ms later. The download reports Started just before it opens the part file
(files::download, then receive), and the open runs on tokio's blocking pool. A
cancel that arrives in between finds no part file to remove (link cancel()
removes it at once and reports Cancelled), the aborted task cannot stop the
open that is already going on, and the part file is made after the cancel:
`assert!(!part.exists())` failed. It did so in the second of the final runs of
the CI test step in the runner image of this task, and in 10 of 100 runs of
the voelin-core lib tests with three of them at a time and 16 busy loops
beside them on a 32-core machine (none in 200 such runs with this change).

The test now waits for the part file itself, which is what "the transfer
waits in the middle" means, and checks that Started was reported.

This is a real, if small, defect of the product that the test exposed: a
cancel in the moment between Started and the end of the open leaves an empty
`<name>.part` next to the target. It is not fixed here: closing it takes
reporting Started after the open (it also feeds the chat and the preview size
limit) or waiting for the aborted task before the part is removed, which is a
change of the transfer code and not of a test. Recorded in the report of this
branch.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 21:41:37 +03:00
faumarayandClaude Sonnet 5.5 637ee58979 Record log lines in the tests through one subscriber for the whole process
web::tests::info_lines read the lines a closure logs with
tracing::subscriber::with_default. While that scoped subscriber is the only
one alive, tracing-core registers a callsite that another thread meets first
against that thread's own default, which is none, and the callsite stays
disabled for every thread. session::banner_tests::
a_failing_banner_is_logged_once_with_its_address flakes this way (lines == []):
it failed in one of eight runs of the CI test step in the runner image of
this task (assertion `left == right` failed: [] left: 0 right: 1 at
session.rs:2541; it passed in the other seven). Several other tests reach the same
"banner not downloaded" callsite through image_finished while it runs.

info_lines now installs a recording subscriber as the global default the first
time it is called, and each call records into a buffer of its own thread, so
every callsite is registered against the same subscriber and no scoped
dispatcher is created or dropped while tests run. The result is the same: the
lines `f` logged at info and above on its thread. The new test
info_lines_see_a_callsite_another_thread_met_first fails with the old helper
(lines == []) and passes with the new one.

The same change is 4be37e1 on phase4/seam-followups (not merged yet; it
measured 1 failure in 300 runs of banner_tests before and 0 in 600 after),
taken here unchanged so that a CI run of this branch does not stop on it and
the two branches merge without a conflict.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 20:08:50 +03:00
faumarayandClaude Sonnet 5.5 9aea876437 Ask improve_level for more than the test identity already has
ts::identity::tests::improve_level_keeps_the_key made its identity with
Identity::create(), which stops at the first counter whose level is 8 or more,
and asked improve_level for 13. About one identity in 32 has 13 or more
already, and improve_level then returns it as it is, so the assertion that the
counter grew fails. The test does not depend on the machine: it failed 9 times
in 300 runs of the single test on a developer machine, and once in the
offline run in the runner image of this task, a CI run that fails one time in
about thirty for it.

The target is now three levels above what the identity has, so the search
always runs. The assertions on the level, the callbacks and the counter use
that target.

The same change is 9254e08 on phase4/seam-followups (which also fixes four
other tests that fail on their own and is not merged yet): it is taken here
unchanged so that a CI run of this branch does not stop on it, and the two
branches merge without a conflict.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 19:53:00 +03:00
faumarayandClaude Sonnet 5.5 172bee5337 Say what the tests print when they skip only as precisely as the code does
The table of docs/ci.md quoted one skip message per row, but the tests print
several wordings per piece (for the H.264 encoder: "skipped: no H.264
encoder", "skipped: needs VP8 and H.264 encoders", "no h264_vaapi or H.264
decoder, skipped"; for FFmpeg: "FFmpeg not installed, skipped", "no FFmpeg with
libavformat, skipped", ...), and some live tests return without printing. The
rows now say a skipped line naming the piece, and keep an exact string only
where the code has exactly that one.

The row on DNS and the internet sat under a column headed "The image has no",
which read as if the job had no network; it has, for apt, rustup and crates.
The column is now headed "A test cannot count on" and the row says the tests
use no DNS or internet and names the #[ignore]d ones that would.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 19:11:42 +03:00
faumarayandClaude Sonnet 5.5 ac6937289d Name in docs/ci.md the job image the runner really registers
Runner setup told to register ubuntu-24.04:docker://ghcr.io/catthehacker/
ubuntu:act-24.04 while the new section on the tests says the test step runs in
docker.gitea.com/runner-images:ubuntu-24.04. The runner of this machine
(gitea-runner-performance, register script of its NixOS unit) is registered
with ubuntu-24.04:docker://docker.gitea.com/runner-images:ubuntu-24.04, and
`docker ps` shows its CI tasks running that image, so the label line was the
stale one. It now names that image, the network list names its registry in
place of GHCR, and the tests section says it is the image of the
ubuntu-24.04 label.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 19:11:03 +03:00
faumarayandClaude Sonnet 5.5 cd08498092 Make the documented image run start cargo, and its VoelinProtocol mirror work
The docker run that docs/ci.md prints for the tests under the job image hung
for ever once the apt and rustup setup was done: bash -c execs its last
command, so xvfb-run became the container's process 1 and never started cargo
(probed: with the runner image and xvfb installed, xvfb-run -a as process 1
stays up with an idle Xvfb, and the same command under --init finishes). The
command now has --init. The runner is not affected: it starts its steps with
docker exec.

The hint for the private dependency is part of the block now, so the block
runs as printed: the bare clone is mounted at /protocol.git (it was never
mounted into the container before) and `git config` runs with -C /, because a
git worktree's .git file points outside the /src mount and git config in /src
exits 128 with "gitfile does not point to a valid repository".

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 19:11:03 +03:00
faumarayandClaude Fable 5.1 6e0df5178e Merge phase4/seam-followups: the gate's identity-text minor, the H9 edge list, five flaky tests
CI / Linux checks (push) Failing after 27m35s
An unreadable TeamSpeak identity is refused without its key in the text (the
classification of from_blob shared as from_json); VoiceOptions fields and
Backends::set_account documented; docs/session-seam.md 17.6 holds the complete
engine/ts edge list for the second half; improve_level, the contacts database
reopen, the banner log subscriber, the two localhost tests and the portal proxy
test made deterministic. Sonnet review accepted; its five minors (two more
DatabaseBusy/port races in tests/gateway.rs, a 1-in-130 voice handshake flake,
the from_json doc, the proxy wrapper's success check) go to the next
test-hygiene round.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-24 17:32:58 +03:00
faumarayandClaude Sonnet 5.5 8541d7c9e5 Document what the Linux job image lacks and how the tests cope
The test step runs as root in docker.gitea.com/runner-images:ubuntu-24.04
with only the apt packages of the system-dependencies action. docs/ci.md now
says how to run the CI's test command in that image with --no-fail-fast, and
lists what the image has no (a regular user, sound card, PipeWire daemons, a
session bus, GPU and VA-API, FFmpeg, an H.264 encoder, Wayland, a browser, the
TeamSpeak dev servers) with what each kind of test does about it. It also
records that two voelin-core tests fail on a machine whose ::1 swallows
connections, whatever the change under test is.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 17:16:19 +03:00
faumarayandClaude Sonnet 5.5 2c9c739732 Make an_unwritable_path_fails_at_once hold for root
The test started a recording at /nonexistent-root-dir/x/clip.webm and expected
an error. Recorder::start creates the missing parent directories, which a
regular user cannot do below / but root can: under the runner image (Gitea
run 1091, docker.gitea.com/runner-images:ubuntu-24.04, root) the call
succeeded, created /nonexistent-root-dir and left a file behind.

The test now builds its unwritable paths in a temporary directory from things
that fail for every user: a path below a regular file (ENOTDIR, so
create_dir_all fails) and a path that names an existing directory (EISDIR, so
File::create fails). The unknown-container name is checked in the same place
and also asserts that no file was created. Reproduced in the runner image as
root with the old test failing and the new one passing.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 16:42:41 +03:00
faumarayandClaude Fable 5.1 c91a3b719d Merge phase5/media-codec-test: peer_config_follows_codecs on a machine without an H.264 encoder
CI / Linux checks (push) Failing after 25m38s
The first CI run that could fetch the private dependency failed on this test
under the runner image. It now states preferred_codec's contract on any
machine. Reproduced and shown green inside docker.gitea.com/runner-images:ubuntu-24.04.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-24 15:34:27 +03:00
faumarayandClaude Sonnet 5.5 6329e56780 Make peer_config_follows_codecs state what preferred_codec promises on any machine
The test compared preferred_codec(&all, Some(H264)).is_some() with whether an
H.264 encoder exists. preferred_codec falls back to another encodable codec
when the configured one cannot be encoded, so is_some() is true on every
machine with any encoder and the assertion held only where an H.264 encoder
exists. The first CI run that could fetch the private dependency (Gitea run
1089, runner image without an H.264 encoder) failed on it; a developer machine
with FFmpeg or a GPU passed.

The test now says the contract: a configured H.264 is the result when
all.encoder_codecs() has it, and otherwise the result equals the automatic
choice, preferred_codec(&all, None). The built-in codecs (no OpenH264) pin both
branches on every machine: VP9 configured gives VP9, H.264 configured gives
the automatic choice, VP8.

The H.264-in-software offer assertion assumed VP8 second after H.264
(offer_codecs(&all, H264)[..2]). A hardware AV1 or VP9 encoder ranks before
libvpx's VP8, so a machine with software H.264 and one of them fails it (the
dev machine does with the named av1_vaapi encoder and hardware off). It now
says H.264 leads exactly the codecs the VP8-led offer has.

Checked at 9714dc2 in docker.gitea.com/runner-images:ubuntu-24.04 with the
apt packages of .github/actions/system-deps and rustup 1.94: the test failed
at media.rs:3426 and passes now; the voelin-core lib tests there were 268
passed, 1 failed, 2 ignored before and are 269 passed, 0 failed, 2 ignored
after.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 15:06:54 +03:00
Aleksey Selihov 9714dc2226 Merge pull request 'CI and release builds read the private VoelinProtocol repository' (#1) from phase0/ci-private-dependency into main
CI / Linux checks (push) Failing after 22m41s
2026-10-24 11:46:50 +00:00
faumarayandClaude Fable 5.1 b8ba43f0c9 Check each OpenSSH tool on its own and stop only an agent this job started
CI / Linux checks (pull_request) Failing after 21m18s
command -v with two names returns 0 when one resolves, so the guards were
weaker than they read. The release workflow's final step killed whatever agent
SSH_AGENT_PID named; it now needs the marker the start step writes after it
succeeded. Two documentation lines re-wrapped (the review's three minors).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-24 14:24:19 +03:00
faumarayandClaude Sonnet 5.5 e5956e40e9 Set CARGO_NET_GIT_FETCH_WITH_CLI in the CI workflow's own env as well
The checks action exports it through GITHUB_ENV, which depends on the runner
handing a composite action's environment file on to the later steps of the
job. If a runner did not, Cargo would silently go back to its built-in git
client, which cannot use the deploy key's IdentityFile, and fail with a
confusing authentication error in the first cargo command. The workflow-level
env does not depend on that, so both are set; the access check step still
exercises the key, the host key and the ssh configuration through git.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 13:45:56 +03:00
faumarayandClaude Sonnet 5.5 6e774873bf Document how CI and the release builds read the private VoelinProtocol repository
docs/ci.md gets a "VoelinProtocol access" section: why every cargo command
needs the access (Cargo resolves the whole workspace, so the gateway image
needs it too), the deploy key and the repository secret
VOELIN_PROTOCOL_DEPLOY_KEY, what the checks action, the release workflow and
the Dockerfiles do with it, why Cargo is told to use the system git, the
committed host key line with its fingerprint and the two commands that
re-check it, the effect on fork pull requests, and what each failure message
means. The runner setup no longer says that a fresh checkout does not build
there. docs/building.md says that the Docker builds need an ssh-agent with a
key that can read VoelinProtocol (--ssh default) and summarises the CI setup;
the plain docker build commands in it and in docs/gateway-admin.md gain
--ssh default, without which they would now stop at the cargo step.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 13:44:44 +03:00
faumarayandClaude Sonnet 5.5 b89116c0f4 Let the Docker builds fetch the private VoelinProtocol repository with an ssh-agent
Every cargo command in the images (linux, windows, android and the gateway
image) failed for the same reason as the CI job: Cargo resolves the whole
workspace, which includes the git dependency voelin-identity on the private
Voelin/VoelinProtocol repository, and the images had no SSH access to it. The
crates that depend on voelin-identity are voelin-store and, through it,
voelin-core, voelin-ui, voelin-ui-vm, voelin-android and voelinctl; the
gateway crate does not, but `cargo build -p voelin-gateway` fails without
access too (checked with an empty CARGO_HOME), so its Dockerfile needs the
same.

Each cargo RUN gets --mount=type=ssh,required=true: the build is handed the
caller's ssh-agent (docker build --ssh default), the key stays in the agent
and never reaches a layer or the build context, and a build without --ssh
fails at that step with "unset ssh forward key default". The build stage
copies the host key committed in .gitea/known_hosts to
/etc/ssh/ssh_known_hosts and sets CARGO_NET_GIT_FETCH_WITH_CLI=true, so that
Cargo uses the system git and ssh. The toolchain stages install git and
openssh-client where they were missing; the gateway Dockerfile gets the
syntax directive the others already have. scripts/docker-build.sh passes
--ssh default and stops early, with a message, when ssh-add -l shows no agent
or no key.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 13:43:12 +03:00
faumarayandClaude Sonnet 5.5 437b508047 Start an ssh-agent with the VoelinProtocol deploy key in the release workflow
The Docker builds run cargo, which has to fetch the private VoelinProtocol
repository over SSH. After checkout the workflow now loads the deploy key
(secret VOELIN_PROTOCOL_DEPLOY_KEY) into a new ssh-agent through stdin, so
the key is never written to the runner's disk and never reaches an image
layer, and exports SSH_AUTH_SOCK and SSH_AGENT_PID for the later steps. The
agent is started with a nine hour key lifetime and stopped by a last step
that runs even after a failure, because the release runner is a persistent
host. The gateway image, which is built with a plain docker build and not
through scripts/docker-build.sh, gets --ssh default; the Dockerfiles use it
in the next commit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 13:34:08 +03:00
faumarayandClaude Sonnet 5.5 8b6dcbf442 Give the Linux checks read access to the private VoelinProtocol repository
The workspace depends on voelin-identity from Voelin/VoelinProtocol over SSH,
and the job container had no key and no known_hosts, so the first cargo
command failed with "unknown SSH host key" (runs 1037 and 1050).

The checks action takes the private half of a read-only deploy key as the
input protocol-deploy-key (secrets are not visible inside a composite action,
so ci.yml passes ${{ secrets.VOELIN_PROTOCOL_DEPLOY_KEY }}). Its first step
fails at once, with a message that names the secret, when the input is empty
or not a private key; it writes the key to ~/.ssh/voelin_protocol (0600),
appends the host key line committed in .gitea/known_hosts, writes a Host
block for git.faumaray.com (User gitea, IdentityFile, IdentitiesOnly,
StrictHostKeyChecking yes) and sets CARGO_NET_GIT_FETCH_WITH_CLI=true and
GIT_SSH_COMMAND for the rest of the job: Cargo's built-in git client cannot
use an IdentityFile, the system git and ssh can. The key reaches the step
through the environment only, is never echoed, and only the public
fingerprint is printed. A second step, after the system packages, runs
git ls-remote against VoelinProtocol, so a wrong key or a changed host key
fails there and not minutes later inside a cargo command.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 13:34:08 +03:00
faumarayandClaude Sonnet 5.5 5afa5a9740 Commit the SSH host key of git.faumaray.com for the CI and release builds
Cargo reaches the private VoelinProtocol repository over SSH and, in a fresh
job container or image, has no known_hosts: every cargo command failed with
"unknown SSH host key" (runs 1037 and 1050). The server (Gitea's built-in SSH,
SSH-2.0-Go) offers an RSA host key only; the line is committed here, after
checking its fingerprint (SHA256:fugBYnqAnqmTLsGpafVgQF9gPQzJqps7uHvs48blg2A)
against ssh-keyscan and Cargo's own report, so that jobs trust the reviewed
key instead of fetching one while they run. The next commits use it in the
checks action, the release workflow and the Dockerfiles.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 13:28:02 +03:00
32 changed files with 1237 additions and 247 deletions

No files matched your search

+109
View File
@@ -1,9 +1,118 @@
name: Linux checks
description: Shared Linux validation for Gitea CI and release packaging.
inputs:
protocol-deploy-key:
description: >
Private half of the read-only deploy key registered on the private
Voelin/VoelinProtocol repository (the repository secret
VOELIN_PROTOCOL_DEPLOY_KEY, passed in by the workflow: secrets are not
visible inside a composite action). The action fails when it is empty.
required: true
runs:
using: composite
steps:
# The workspace depends on the private VoelinProtocol repository over SSH
# (docs/ci.md, "VoelinProtocol access"). First, so that a missing key fails
# in seconds and before anything runs cargo.
- name: Install the VoelinProtocol deploy key
# The key reaches this step through the environment only: never in the
# script text, never echoed, no `set -x`.
env:
PROTOCOL_DEPLOY_KEY: ${{ inputs.protocol-deploy-key }}
run: |
set -euo pipefail
umask 077
if [[ -z "${PROTOCOL_DEPLOY_KEY//[[:space:]]/}" ]]; then
echo "::error::The VoelinProtocol deploy key is empty. Set the repository secret VOELIN_PROTOCOL_DEPLOY_KEY to the private key of the read-only deploy key on Voelin/VoelinProtocol (docs/ci.md, VoelinProtocol access). Pull requests from forks get no secrets." >&2
exit 1
fi
for tool in ssh ssh-keygen; do
command -v "$tool" > /dev/null || {
echo "::error::The job image needs the OpenSSH client: $tool is missing." >&2
exit 1
}
done
ssh_dir="$HOME/.ssh"
key_file="$ssh_dir/voelin_protocol"
mkdir -p "$ssh_dir"
chmod 700 "$ssh_dir"
# Whatever the secret store did to the line ends and the final newline,
# OpenSSH needs LF lines, the BEGIN line first and a newline at the end.
printf '%s\n' "$PROTOCOL_DEPLOY_KEY" | tr -d '\r' | sed '/^[[:space:]]*$/d' > "$key_file"
unset PROTOCOL_DEPLOY_KEY
chmod 600 "$key_file"
if ! public=$(ssh-keygen -y -f "$key_file" < /dev/null); then
rm -f "$key_file"
echo "::error::VOELIN_PROTOCOL_DEPLOY_KEY is not an unencrypted OpenSSH or PEM private key." >&2
exit 1
fi
# The fingerprint of the public half, to compare with the deploy key in
# the VoelinProtocol settings.
printf 'Deploy key installed: %s\n' "$(ssh-keygen -lf - <<< "$public")"
# The reviewed host key from the repository, never one fetched now.
known_hosts="$ssh_dir/known_hosts"
touch "$known_hosts"
chmod 600 "$known_hosts"
[[ -s "${GITHUB_WORKSPACE:-.}/.gitea/known_hosts" ]] || {
echo "::error::.gitea/known_hosts is missing from the checkout." >&2
exit 1
}
while IFS= read -r line; do
case "$line" in '' | '#'*) continue ;; esac
grep -qxF -- "$line" "$known_hosts" || printf '%s\n' "$line" >> "$known_hosts"
done < "${GITHUB_WORKSPACE:-.}/.gitea/known_hosts"
# Use this key, and only this one, for the Gitea server; fail rather than
# ask when its host key is unknown or changed. The block goes first: ssh
# takes the first value it finds for each option.
config="$ssh_dir/config"
marker="# VoelinProtocol deploy key (.gitea/actions/checks)"
touch "$config"
if ! grep -qxF -- "$marker" "$config"; then
{
cat << EOF
$marker
Host git.faumaray.com
User gitea
IdentityFile $key_file
IdentitiesOnly yes
UserKnownHostsFile $known_hosts
StrictHostKeyChecking yes
BatchMode yes
ConnectTimeout 30
EOF
cat "$config"
} > "$config.new"
mv "$config.new" "$config"
fi
chmod 600 "$config"
# Cargo's built-in git client (libgit2) cannot use IdentityFile; the
# system git runs ssh, which reads the config above. `-F` names it
# outright: ssh looks for ~/.ssh in the passwd entry's home directory, not
# in $HOME, and a job image may set the two apart.
{
echo "CARGO_NET_GIT_FETCH_WITH_CLI=true"
echo "GIT_SSH_COMMAND=ssh -F '$config'"
} >> "$GITHUB_ENV"
shell: bash
- uses: ./.github/actions/system-deps
- name: Check read access to VoelinProtocol
# The first thing cargo does, with the same git and ssh configuration, so
# that a wrong key or a changed host key fails here with a clear message
# and not minutes later inside a cargo command.
run: |
set -euo pipefail
if ! GIT_TERMINAL_PROMPT=0 timeout 120 git ls-remote --exit-code \
ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git HEAD > /dev/null; then
echo "::error::git cannot read Voelin/VoelinProtocol over SSH with the deploy key. 'Permission denied (publickey)' above: the key is not registered on that repository (or is not the one in VOELIN_PROTOCOL_DEPLOY_KEY). 'Host key verification failed': .gitea/known_hosts no longer matches the server (docs/ci.md, VoelinProtocol access)." >&2
exit 1
fi
echo "Voelin/VoelinProtocol is readable with the deploy key."
shell: bash
- name: Install pinned Rust toolchain
run: |
set -euo pipefail
+10
View File
@@ -0,0 +1,10 @@
# SSH host key of git.faumaray.com (Gitea's built-in SSH server, which offers an
# RSA host key only). Fingerprint SHA256:fugBYnqAnqmTLsGpafVgQF9gPQzJqps7uHvs48blg2A,
# recorded on 2026-10-24 with `ssh-keyscan -t rsa git.faumaray.com`.
#
# Committed, never fetched while a job runs, so a CI or release build trusts the
# key reviewed here and not whatever answers on the network at that moment.
# Read by .gitea/actions/checks (appended to ~/.ssh/known_hosts) and COPYed by
# docker/*.Dockerfile and crates/voelin-gateway/Dockerfile. How to re-check it
# and how to rotate it: docs/ci.md, "VoelinProtocol access".
git.faumaray.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzZEz9JLrzk6oLiloSbueAN28vYL58Y/dTHBgRuBMMib9IJ1aDJShhr3kwC9sfOT0AzK0uwcMAqCAIkwJwttde8dIg0Mee0cmB/1JkoqFF4X3MUGD1r3nk8SSZNhIiPqo16hDF9Hf3FkovztIlBVntkyP9Iy9hYfP818Tiq3yRXROGdHjR7IfY4jR2QGfGrd/RtvPGExVqusxidy141240A8aRAwMFUqFdEvmXWjizrtCUqcrL/k1GEh0yJzbCdNOVUI6OuWd8tPluSBvmmeoNpKnCSl4Mkg36HObbOyrsme0asZqjcj0od65WYWApMPN0pUqhNu2CP83Nfor2VFwkdPRwe7cAZ0OD/8wyT6Hz5q1wWgf82y4tYDoDRYsd8JU86eebkJ07T5nCrEeC4Sj+qT4S5xv/kECAhxyP4QGnunORnY2fYsdNGzpPvbMN7gHe9UcIcQdOIgV3wrR1qpMVNcd8AEC2A3TRv/jzMCHSjmGGpgiy1Db2CZAjp5+PcjNmjvoPNN0NiA9X4rIVSeTfflWnDRmeNRJeZa73StjpU17EcAf97COUQPGWJQDgpJqINSpYU50fuaLBfzKnIRuiHjKQmyKe/zgRSmulnYFYM3AJfn8Ykg2VvkUQGvCt1+fqYiUa1iVFuwPP3ZigYF1mOZRpPnos5kaNmlB01q2sZw==
+10
View File
@@ -20,6 +20,11 @@ on:
env:
CARGO_TERM_COLOR: always
# Cargo fetches the private VoelinProtocol dependency with the system git and
# ssh (docs/ci.md, "VoelinProtocol access"). The checks action exports this
# too; set here as well, it does not depend on the runner handing a composite
# action's GITHUB_ENV on to the later steps.
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
jobs:
linux:
@@ -32,3 +37,8 @@ jobs:
steps:
- uses: https://github.com/actions/checkout@v4
- uses: ./.gitea/actions/checks
with:
# A repository secret is not visible inside the composite action, so
# it is passed in. Pull requests from forks get no secrets: the
# action then fails at once with a message that says so.
protocol-deploy-key: ${{ secrets.VOELIN_PROTOCOL_DEPLOY_KEY }}
+39 -1
View File
@@ -32,6 +32,38 @@ jobs:
docker info >/dev/null
# Remove only output owned by this workflow in its checkout.
rm -rf dist
# The workspace depends on the private VoelinProtocol repository over SSH
# (docs/ci.md, "VoelinProtocol access"). The Docker builds fetch it with
# this agent (`docker build --ssh default`): the key lives in the agent's
# memory, never on disk and never in an image layer. Stopped by the last
# step; the lifetime below ends the key anyway if the runner dies first.
- name: Start ssh-agent with the VoelinProtocol deploy key
env:
PROTOCOL_DEPLOY_KEY: ${{ secrets.VOELIN_PROTOCOL_DEPLOY_KEY }}
run: |
set -euo pipefail
if [[ -z "${PROTOCOL_DEPLOY_KEY//[[:space:]]/}" ]]; then
echo "::error::The repository secret VOELIN_PROTOCOL_DEPLOY_KEY is missing or empty. It holds the private key of the read-only deploy key on Voelin/VoelinProtocol (docs/ci.md, VoelinProtocol access)." >&2
exit 1
fi
for tool in ssh-agent ssh-add; do
command -v "$tool" > /dev/null || { echo "::error::The runner needs the OpenSSH client: $tool is missing." >&2; exit 1; }
done
eval "$(ssh-agent -s -t 32400)" > /dev/null
started=
trap '[[ -n "$started" ]] || ssh-agent -k > /dev/null' EXIT
# LF lines and one final newline, whatever the secret store did.
printf '%s\n' "$PROTOCOL_DEPLOY_KEY" | tr -d '\r' | sed '/^[[:space:]]*$/d' | ssh-add -q -
unset PROTOCOL_DEPLOY_KEY
# The fingerprint of the public half, to compare with the deploy key.
ssh-add -l
{
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
echo "SSH_AGENT_PID=$SSH_AGENT_PID"
# Only an agent this job started is stopped at the end.
echo "VOELIN_AGENT_STARTED=1"
} >> "$GITHUB_ENV"
started=1
- name: Linux packages
run: scripts/docker-build.sh linux --progress=plain
- name: Windows packages (MinGW)
@@ -77,7 +109,7 @@ jobs:
set -euo pipefail
version=$(sed -n 's/^version = "\(.*\)"$/\1/p' crates/voelin-gateway/Cargo.toml | head -n 1)
test -n "$version"
docker build -f crates/voelin-gateway/Dockerfile -t "tsgw:$version" -t tsgw:latest .
DOCKER_BUILDKIT=1 docker build --ssh default -f crates/voelin-gateway/Dockerfile -t "tsgw:$version" -t tsgw:latest .
mkdir -p dist/gateway
docker save "tsgw:$version" tsgw:latest | gzip > dist/gateway/tsgw-image.tar.gz
- name: Collect packages and checksums
@@ -104,3 +136,9 @@ jobs:
# Gitea refuses secret names starting with GITEA_ or GITHUB_.
GITEA_RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: scripts/gitea-release.sh dist/release
- name: Stop the ssh-agent
if: always()
run: |
if [[ -n "${VOELIN_AGENT_STARTED:-}" && -n "${SSH_AGENT_PID:-}" ]]; then
ssh-agent -k > /dev/null || true
fi
+2
View File
@@ -2,3 +2,5 @@
/dev/.state/
/dist/
/.cargo/
# agent scratch of a worktree (the MAO policy in CLAUDE.md)
/.scratch/
Generated
+25 -25
View File
@@ -1774,9 +1774,9 @@ dependencies = [
[[package]]
name = "crypto-bigint"
version = "0.7.5"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a52aa3fcda4e6302a9f48734f234d35d4721b96f8fe07d073f07ce9df4f0271"
checksum = "cc907c45bb7e9ef8fc3778defd0f3cd8c81288f1b4e748eba064948f20c47122"
dependencies = [
"cpubits",
"ctutils",
@@ -1817,7 +1817,7 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3633a51a39c69ebbaa4feaa694bd83d241e4093901c84a0963b19d9bb3f0cf8f"
dependencies = [
"crypto-bigint 0.7.5",
"crypto-bigint 0.7.7",
"rand_core 0.10.1",
]
@@ -1871,9 +1871,9 @@ dependencies = [
[[package]]
name = "ctutils"
version = "0.4.2"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d5515a3834141de9eafb9717ad39eea8247b5674e6066c404e8c4b365d2a29e"
checksum = "38d28fb6aa7dd680b3ffd1a3e64e115c177bdba63c0ae7f9cd48129ff05c4fa0"
dependencies = [
"cmov",
"subtle",
@@ -2400,7 +2400,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d65aa39b3a5c1c9c1b745c9a019234bb7a21b77abcb4f4d266d706e2d577d65"
dependencies = [
"base16ct 1.0.0",
"crypto-bigint 0.7.5",
"crypto-bigint 0.7.7",
"crypto-common 0.2.2",
"digest 0.11.3",
"ff 0.14.0",
@@ -2512,7 +2512,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@@ -5676,7 +5676,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"
dependencies = [
"libc",
"windows-sys 0.61.2",
"windows-sys 0.45.0",
]
[[package]]
@@ -6271,7 +6271,7 @@ version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c555a6e4eb7d4e158fcb028c835c3b8642206ddc279b5c6b202ef9a8bdb592f4"
dependencies = [
"crypto-bigint 0.7.5",
"crypto-bigint 0.7.7",
"crypto-common 0.2.2",
"ff 0.14.0",
"rand_core 0.10.1",
@@ -6467,7 +6467,7 @@ dependencies = [
"once_cell",
"socket2",
"tracing",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@@ -6842,7 +6842,7 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4a459cddafb3fe76b31fd8f1108007566c40301feb64dc7b54656eb7388172b"
dependencies = [
"crypto-bigint 0.7.5",
"crypto-bigint 0.7.7",
"hmac 0.13.0",
]
@@ -6898,7 +6898,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30b2aa4ba0d89f73d1e332df05be0eeab8840351c36ca5654341dfdb57bb3caf"
dependencies = [
"const-oid 0.10.2",
"crypto-bigint 0.7.5",
"crypto-bigint 0.7.7",
"crypto-primes",
"digest 0.11.3",
"pkcs1",
@@ -6996,7 +6996,7 @@ dependencies = [
"bytes",
"cbc",
"cipher 0.5.2",
"crypto-bigint 0.7.5",
"crypto-bigint 0.7.7",
"ctr 0.10.1",
"curve25519-dalek 5.0.0",
"data-encoding",
@@ -7144,7 +7144,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys 0.12.1",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@@ -7201,7 +7201,7 @@ dependencies = [
"security-framework",
"security-framework-sys",
"webpki-root-certs",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@@ -7212,9 +7212,9 @@ checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f"
[[package]]
name = "rustls-webpki"
version = "0.103.15"
version = "0.103.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2"
checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281"
dependencies = [
"aws-lc-rs",
"ring",
@@ -8061,7 +8061,7 @@ checksum = "7b54d0ed0498daf3f78d82e00e28c8eec9d75a067c4cfbcc7a0f7d0f4077749e"
dependencies = [
"base64ct",
"bytes",
"crypto-bigint 0.7.5",
"crypto-bigint 0.7.7",
"ctutils",
"digest 0.11.3",
"pem-rfc7468 1.0.0",
@@ -8405,10 +8405,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
dependencies = [
"fastrand",
"getrandom 0.4.3",
"getrandom 0.3.4",
"once_cell",
"rustix 1.1.5",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@@ -8589,9 +8589,9 @@ checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee"
[[package]]
name = "tokio"
version = "1.53.1"
version = "1.54.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed"
checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3"
dependencies = [
"bytes",
"libc",
@@ -10082,9 +10082,9 @@ dependencies = [
[[package]]
name = "webpki-root-certs"
version = "1.0.9"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b96554aa2acc8ccdb7e1c9a58a7a68dd5d13bccc69cd124cb09406db612a1c9b"
checksum = "e49d0e65abc00c142e8f9428da991da9f1a250c39be97459901eb12b9b49f62a"
dependencies = [
"rustls-pki-types",
]
@@ -10279,7 +10279,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.61.2",
"windows-sys 0.48.0",
]
[[package]]
+12 -5
View File
@@ -175,7 +175,7 @@ the crate's authors are listed as its copyright holders.
| License | Crates |
|---|---|
| MIT License | 660 |
| MIT License | 667 |
| Apache License 2.0 | 31 |
| Unicode License v3 | 26 |
| BSD 3-Clause "New" or "Revised" License | 22 |
@@ -2611,7 +2611,7 @@ THIS SOFTWARE.
````
Used by: rustls-webpki 0.103.15
Used by: rustls-webpki 0.103.16
````text
Except as otherwise noted, this project is licensed under the following
@@ -7308,7 +7308,7 @@ DEALINGS IN THE SOFTWARE.
````
Used by: argon2 0.6.0, crypto-bigint 0.7.5, pkcs5 0.8.1, scrypt 0.12.0, sec1 0.8.1, spki 0.8.0, ssh-encoding 0.3.0, ssh-key 0.7.0-rc.11
Used by: argon2 0.6.0, crypto-bigint 0.7.7, pkcs5 0.8.1, scrypt 0.12.0, sec1 0.8.1, spki 0.8.0, ssh-encoding 0.3.0, ssh-key 0.7.0-rc.11
````text
Copyright (c) 2021-2026 The RustCrypto Project Developers
@@ -7930,7 +7930,7 @@ DEALINGS IN THE SOFTWARE.
````
Used by: ctutils 0.4.2
Used by: ctutils 0.4.5
````text
Copyright (c) 2025-2026 The RustCrypto Project Developers
@@ -9833,15 +9833,22 @@ Standard text, used by:
- windows-result 0.4.1 (https://github.com/microsoft/windows-rs)
- windows-strings 0.4.2: Microsoft (https://github.com/microsoft/windows-rs)
- windows-strings 0.5.1 (https://github.com/microsoft/windows-rs)
- windows-sys 0.45.0: Microsoft (https://github.com/microsoft/windows-rs)
- windows-sys 0.48.0: Microsoft (https://github.com/microsoft/windows-rs)
- windows-sys 0.52.0: Microsoft (https://github.com/microsoft/windows-rs)
- windows-sys 0.61.2 (https://github.com/microsoft/windows-rs)
- windows-targets 0.42.2: Microsoft (https://github.com/microsoft/windows-rs)
- windows-targets 0.48.5: Microsoft (https://github.com/microsoft/windows-rs)
- windows-targets 0.52.6: Microsoft (https://github.com/microsoft/windows-rs)
- windows-threading 0.1.0: Microsoft (https://github.com/microsoft/windows-rs)
- windows-threading 0.2.1 (https://github.com/microsoft/windows-rs)
- windows-version 0.1.7 (https://github.com/microsoft/windows-rs)
- windows 0.61.3: Microsoft (https://github.com/microsoft/windows-rs)
- windows 0.62.2 (https://github.com/microsoft/windows-rs)
- windows_x86_64_gnu 0.48.5: Microsoft (https://github.com/microsoft/windows-rs)
- windows_x86_64_gnu 0.52.6: Microsoft (https://github.com/microsoft/windows-rs)
- windows_x86_64_msvc 0.42.2: Microsoft (https://github.com/microsoft/windows-rs)
- windows_x86_64_msvc 0.48.5: Microsoft (https://github.com/microsoft/windows-rs)
- windows_x86_64_msvc 0.52.6: Microsoft (https://github.com/microsoft/windows-rs)
````text
@@ -9881,7 +9888,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
````
Used by: tokio-stream 0.1.19, tokio-util 0.7.19, tokio 1.53.1
Used by: tokio-stream 0.1.19, tokio-util 0.7.19, tokio 1.54.1
````text
MIT License
+14 -11
View File
@@ -199,19 +199,22 @@ async fn receive<R: AsyncRead + Unpin>(
let mut done = offset;
match sink {
Sink::File { part, dest, append } => {
// The directory and the file are made in one step, without a pause in
// which the task could be stopped: a cancel stops the task, waits for
// it and then removes the part file, so what the task made must be
// there by then (a pending open on the blocking pool would not be).
if let Some(dir) = part.parent().filter(|d| !d.as_os_str().is_empty()) {
tokio::fs::create_dir_all(dir)
.await
.map_err(|e| format!("{}: {e}", dir.display()))?;
std::fs::create_dir_all(dir).map_err(|e| format!("{}: {e}", dir.display()))?;
}
let mut file = tokio::fs::OpenOptions::new()
.create(true)
.write(true)
.append(*append)
.truncate(!*append)
.open(part)
.await
.map_err(|e| format!("{}: {e}", part.display()))?;
let mut file = tokio::fs::File::from_std(
std::fs::OpenOptions::new()
.create(true)
.write(true)
.append(*append)
.truncate(!*append)
.open(part)
.map_err(|e| format!("{}: {e}", part.display()))?,
);
let received = async {
while done < size {
let n = stream.read(&mut buf).await.map_err(|e| e.to_string())?;
+19 -13
View File
@@ -77,7 +77,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
use std::time::{Duration, Instant};
use tokio::sync::mpsc;
use tokio::task::AbortHandle;
use tokio::task::JoinHandle;
use tracing::{debug, info, warn};
use voelin_audio::EncodedVoice;
use voelin_model::replica::{Replica, SCHEMA_GENERATION, ScopeId};
@@ -325,7 +325,7 @@ async fn drive(
/// A transfer a user can cancel.
struct Running {
task: AbortHandle,
task: JoinHandle<()>,
part: Option<PathBuf>,
report: Report,
/// The server has opened it (a part file may exist).
@@ -1479,7 +1479,7 @@ impl Conn {
receive.await;
}
});
self.running(transfer, Running { task: task.abort_handle(), part, report, started });
self.running(transfer, Running { task, part, report, started });
}
fn upload(
@@ -1560,7 +1560,7 @@ impl Conn {
let stored = async move { done.await.map(|_| ()).map_err(|e| text(&e, false)) };
files::upload_to(body, stored, from, size, offset, progress, task_report).await;
});
self.running(transfer, Running { task: task.abort_handle(), part: None, report, started });
self.running(transfer, Running { task, part: None, report, started });
}
fn running(&mut self, transfer: Option<TransferId>, running: Running) {
@@ -1572,15 +1572,21 @@ impl Conn {
fn cancel(&mut self, id: TransferId) {
match self.transfers.remove(&id) {
Some(running) if !running.task.is_finished() => {
running.task.abort();
// A part file exists once the server has opened the transfer.
if running.started.load(Ordering::Acquire)
&& let Some(part) = running.part
{
let _ = std::fs::remove_file(part);
}
(running.report)(TransferState::Cancelled);
Some(Running { task, part, report, started }) if !task.is_finished() => {
task.abort();
// The part file goes once the task has stopped, not at once: the task
// opens it in one step (files::download), so it is there or it never
// will be, and a removal that came before the open would leave it.
tokio::spawn(async move {
let _ = task.await;
// A part file exists once the server has opened the transfer.
if started.load(Ordering::Acquire)
&& let Some(part) = part
{
let _ = std::fs::remove_file(part);
}
report(TransferState::Cancelled);
});
}
_ => debug!(id, "cancel: no such transfer (finished?)"),
}
+72 -41
View File
@@ -607,6 +607,12 @@ async fn a_file_is_downloaded_through_the_connection_the_link_opens() {
}
tokio::time::sleep(Duration::from_millis(10)).await;
}
assert!(
states.lock().unwrap().iter().any(|s| matches!(s, TransferState::Started { .. })),
"the transfer started: {:?}",
states.lock().unwrap()
);
// Cancelled the moment it is Started, when its part file may be opening.
rig.give(LinkCmd::CancelTransfer(3));
assert_eq!(final_state(&states).await, TransferState::Cancelled);
rig.quiet();
@@ -1956,20 +1962,38 @@ async fn a_scope_bigger_than_the_channel_is_sent_in_bigger_chunks() {
const CHANNELS: u64 = 5_000;
let (conns, mut seen) = mpsc::unbounded_channel();
let connector = LinkConnector::new(Arc::new(Recorder(conns)), &["ts3server"]);
let (mut params, _media) = connect_params("ts3server://fake.test?port=9987");
let (mut params, mut media) = connect_params("ts3server://fake.test?port=9987");
params.credential = Credential::Foreign { kind: "teamspeak", blob: Default::default() };
params.push_capacity = 1;
let connecting = tokio::spawn(connector.connect(params));
let inner = within("the link to be asked", seen.recv()).await;
inner.events.send(connected(everything())).unwrap();
// Made before the link is told it is connected: the connector waits only
// 250 ms for the first snapshot, and making 5,000 channels can take longer
// than that on a busy machine, which left the session without them.
let mut big = presence();
for id in 100..100 + CHANNELS {
let channel = ChannelInfo { id, name: format!("c{id}"), ..Default::default() };
big.channels.insert(id, channel);
}
inner.events.send(connected(everything())).unwrap();
inner.events.send(LinkEvent::Presence(Box::new(big))).unwrap();
let connected = within("a session", async { connecting.await.ok().and_then(Result::ok) }).await;
let (session, mut pushes) = (connected.session, connected.pushes);
// The scope is sent whole only if the presence is in the host's state when
// it is asked for. The link takes its events in order, and a voice packet
// of one of the presence's clients comes through only once the presence
// is in: the packet says it is.
inner
.events
.send(LinkEvent::Audio(VoicePacket {
talker: TalkerId(8),
seq: 1,
codec: VoiceCodec::Voice,
whisper: false,
payload: OPUS_20_MS.to_vec(),
}))
.unwrap();
within("the voice", media.recv()).await;
let server = ScopeId::Server(1);
session.request(subscribe(server)).await.unwrap();
@@ -2178,12 +2202,48 @@ async fn event_of<T>(
.await
}
/// Asks for the file list of the lobby until the answer is one `wanted` takes,
/// one question at a time: the next goes out only when the last is answered.
/// Asked every few milliseconds instead, the answers fell behind the 16
/// events the bus holds (and the host's work), and the one that counted was
/// lost in the backlog.
async fn ask_files_until(
cmd_tx: &mpsc::UnboundedSender<LinkCmd>,
bus: &mut broadcast::Receiver<Event>,
request: &mut crate::files::RequestId,
wanted: impl Fn(&Result<Vec<FileEntry>, String>) -> bool,
) {
within("the file list to be answered as wanted", async {
loop {
*request += 1;
let dir = remote(10, None, "/");
cmd_tx.send(LinkCmd::ListFiles { request: *request, dir }).ok()?;
let result = loop {
match bus.recv().await {
Ok(Event::FileList { request: answered, result, .. })
if answered == *request =>
{
break result;
}
Ok(_) | Err(broadcast::error::RecvError::Lagged(_)) => {}
Err(broadcast::error::RecvError::Closed) => return None,
}
};
if wanted(&result) {
return Some(());
}
tokio::time::sleep(Duration::from_millis(20)).await;
}
})
.await;
}
/// `Server.features` narrows what the host offers (protocol 1.3,
/// `docs/session-seam.md` 4.7), and a `HostUpdate` changes what is narrowed.
#[tokio::test(flavor = "multi_thread")]
async fn the_features_of_a_server_are_the_hosts_narrowed_by_the_servers_list() {
use v1::entity::Kind;
use voelin_proto::test_util::{FakeConnector, eventually};
use voelin_proto::test_util::FakeConnector;
let connector = FakeConnector::new();
let host = connector.host();
@@ -2235,55 +2295,26 @@ async fn the_features_of_a_server_are_the_hosts_narrowed_by_the_servers_list() {
})
.count()
};
let ask = |request| {
let dir = remote(10, None, "/");
cmd_tx.send(LinkCmd::ListFiles { request, dir }).unwrap();
};
let refusal = "not offered by this server: files";
let refused =
|event: &Event| matches!(event, Event::FileList { result: Err(why), .. } if why == refusal);
|result: &Result<Vec<FileEntry>, String>| matches!(result, Err(why) if why == refusal);
let mut request = 0;
// Refused here: nothing reaches the host.
ask(1);
loop {
let event = within("the refusal", async { bus.recv().await.ok() }).await;
if refused(&event) {
break;
}
}
ask_files_until(&cmd_tx, &mut bus, &mut request, refused).await;
assert_eq!(file_lists(), 0);
// The server lifts its list (an empty one keeps all the host's): files work.
put_server(&[]);
let mut request = 1;
eventually(WAIT, "a file list to reach the host", || {
request += 1;
ask(request);
file_lists() > 0
})
.await;
ask_files_until(&cmd_tx, &mut bus, &mut request, |result| !refused(result)).await;
assert!(file_lists() > 0, "the answer did not come from the host");
// The host narrows what it offers this user. A refusal counts only for a
// request made after the update: the earlier ones were answered by the host's
// wider set (or, before the server lifted its list, refused for that).
// The host narrows what it offers this user. Every question is answered
// before the next is asked, so those asked from here on are the ones the
// update can refuse; the earlier ones were answered by the host's wider set.
let update = v1::HostUpdate { features: vec!["voice".into(), "chat".into()], limits: None };
handle.push(v1::Push { body: Some(v1::push::Body::HostUpdate(update)) }).unwrap();
let after = request;
within("the narrower set to apply", async {
loop {
request += 1;
ask(request);
tokio::time::sleep(Duration::from_millis(20)).await;
while let Ok(event) = bus.try_recv() {
if matches!(&event, Event::FileList { request, .. } if *request > after)
&& refused(&event)
{
return Some(());
}
}
}
})
.await;
ask_files_until(&cmd_tx, &mut bus, &mut request, refused).await;
}
/// A port that is no port is refused in words, not dropped: the connection
+136 -43
View File
@@ -3257,9 +3257,13 @@ impl LocalPreview {
}
/// The first and last column of the rectangle in the middle row of a
/// decoded test pattern. Checks that pixels further than two columns from
/// its edges (which the codec blurs) have the colour of the rectangle or
/// the background.
/// decoded test pattern, after checking the row's structure: background, one
/// run of the rectangle, background. A pixel is whichever of the pattern's two
/// colours it is nearer to; it is not asked to be within some distance of one,
/// because an encoder that falls behind lowers its quality (the VP8 speed
/// control of the streamer does) and then moves a flat colour by 30 and more
/// per channel, still nowhere near the other colour. The two columns at each
/// edge, which the codec blurs, may be either.
#[cfg(all(test, feature = "media-desktop"))]
pub(crate) fn rectangle_span(picture: &VideoFrame) -> (u32, u32) {
use voelin_media::capture::synthetic::{BACKGROUND, RECT_COLOR};
@@ -3270,15 +3274,23 @@ pub(crate) fn rectangle_span(picture: &VideoFrame) -> (u32, u32) {
let i = ((y * picture.width + x) * 4) as usize;
[rgba[i], rgba[i + 1], rgba[i + 2]]
};
let close = |p: [u8; 3], c: [u8; 3]| p.iter().zip(c).all(|(a, b)| a.abs_diff(b) <= 24);
let inside: Vec<u32> = (0..picture.width).filter(|&x| close(pixel(x), RECT_COLOR)).collect();
let (&a, &b) = inside.first().zip(inside.last()).expect("no rectangle in the middle row");
for x in 0..picture.width {
if x + 2 < a || x > b + 2 {
assert!(close(pixel(x), BACKGROUND), "pixel {x},{y} is {:?}", pixel(x));
} else if (a + 2..=b.saturating_sub(2)).contains(&x) {
assert!(close(pixel(x), RECT_COLOR), "pixel {x},{y} is {:?}", pixel(x));
}
let distance = |p: [u8; 3], c: [u8; 3]| -> u32 {
p.iter().zip(c).map(|(a, b)| u32::from(a.abs_diff(b)).pow(2)).sum()
};
let rectangle = |x: u32| {
let p = pixel(x);
distance(p, RECT_COLOR) < distance(p, BACKGROUND)
};
let a = (0..picture.width).find(|&x| rectangle(x)).expect("no rectangle in the middle row");
let b = (0..picture.width).rfind(|&x| rectangle(x)).unwrap();
// One run: everything between its ends, but the blurred edges, is the
// rectangle's. Whatever is outside is the background by the choice of a and b.
for x in a + 2..=b.saturating_sub(2) {
assert!(
rectangle(x),
"pixel {x},{y} is {:?}, in the middle of the rectangle (columns {a} to {b})",
pixel(x)
);
}
(a, b)
}
@@ -3410,7 +3422,14 @@ mod tests {
assert!(all.is_hardware(backend), "{codec} offered in software");
}
if all.encoder_codecs().contains(&Codec::H264) && !offer.contains(&Codec::H264) {
assert_eq!(offer_codecs(&all, Codec::H264)[..2], [Codec::H264, Codec::Vp8]);
// H.264 in software only (so not in `offer`): it leads the same
// codecs as with VP8 as the stream codec, whichever hardware
// encoders this machine has (a hardware AV1 or VP9 encoder ranks
// before VP8, so VP8 is not always second).
let h264 = offer_codecs(&all, Codec::H264);
assert_eq!(h264[0], Codec::H264, "{h264:?}");
assert_eq!(h264.len(), offer.len() + 1, "{h264:?} against {offer:?}");
assert!(offer.iter().all(|c| h264.contains(c)), "{h264:?} against {offer:?}");
}
// Whatever this machine has: codecs every TeamSpeak client decodes
// come before H.264, HEVC last, and the automatic stream codec is
@@ -3423,10 +3442,23 @@ mod tests {
let ranks: Vec<_> = offer[1..].iter().map(rank).collect();
assert!(ranks.is_sorted(), "{offer:?}");
assert!(preferred_codec(&all, None).is_some_and(decoded_everywhere), "{all:?}");
assert_eq!(
preferred_codec(&all, Some(Codec::H264)).is_some(),
all.encoder_codecs().contains(&Codec::H264)
);
// A configured codec is the stream codec when this machine can encode
// it; otherwise the result is the automatic choice,
// `preferred_codec(&all, None)` (some codec on any machine that
// encodes anything). Whether H.264 is encodable depends on the
// machine (a desktop with FFmpeg or a GPU has an encoder, a CI
// runner has none), so the expectation follows `all.encoder_codecs()`.
let h264 = preferred_codec(&all, Some(Codec::H264));
if all.encoder_codecs().contains(&Codec::H264) {
assert_eq!(h264, Some(Codec::H264), "{all:?}");
} else {
assert_eq!(h264, preferred_codec(&all, None), "{all:?}");
}
// The built-in codecs are the same everywhere (no OpenH264 loaded):
// VP9 is encodable and wins, H.264 is not and falls back to VP8.
assert_eq!(preferred_codec(&codecs, Some(Codec::Vp9)), Some(Codec::Vp9));
assert_eq!(preferred_codec(&codecs, Some(Codec::H264)), preferred_codec(&codecs, None));
assert_eq!(preferred_codec(&codecs, None), Some(Codec::Vp8));
}
/// A sink whose viewers chose `codecs`; keeps every video frame with its
@@ -3516,11 +3548,30 @@ mod tests {
};
told(30).await;
assert_eq!(streamer.bitrate_kbps(), 1105);
// Not per frame.
let count = lock(&sink.formats).len();
tokio::time::sleep(Duration::from_millis(200)).await;
assert_eq!(lock(&sink.formats).len(), count);
assert_eq!(streamer.stats().layers[0].bitrate, auto_bitrate(640, 480, 30));
// Not per frame. The sink is told when it is attached and again by the
// encoder before its first frame (the same format twice), so the count is
// taken once a frame has been handed over and compared after more have;
// the frames, not a pause, are what "per frame" counts.
let frames_by = |frames: u64| {
let streamer = &streamer;
async move {
let deadline = Instant::now() + Duration::from_secs(30);
while streamer.stats().layers[0].frames < frames {
assert!(Instant::now() < deadline, "{frames} frames: {:?}", streamer.stats());
tokio::time::sleep(Duration::from_millis(20)).await;
}
}
};
frames_by(1).await;
let (count, seen) = (lock(&sink.formats).len(), streamer.stats().layers[0].frames);
frames_by(seen + 5).await;
assert_eq!(lock(&sink.formats).len(), count, "told again within five frames");
// The stats follow the sink's being told, not the other way round.
let deadline = Instant::now() + Duration::from_secs(10);
while streamer.stats().layers[0].bitrate != auto_bitrate(640, 480, 30) {
assert!(Instant::now() < deadline, "{:?}", streamer.stats().layers);
tokio::time::sleep(Duration::from_millis(20)).await;
}
let update = StreamerConfigUpdate { fps: Some(15), ..StreamerConfigUpdate::default() };
streamer.reconfigure(&codecs, update).unwrap();
told(15).await;
@@ -3691,15 +3742,35 @@ mod tests {
assert!((60..=68).contains(&(b - a + 1)), "{spans:?}");
}
assert_ne!(spans.first(), spans.last(), "the rectangle moves");
let stats = preview.stats();
assert!(stats.decoded >= 10 && stats.error.is_none(), "{stats:?}");
assert_eq!(stats.codec, Some(Codec::Vp8));
let (before_first, first) = (Instant::now(), preview.stats());
let after_first = Instant::now();
assert!(first.decoded >= 10 && first.error.is_none(), "{first:?}");
assert_eq!(first.codec, Some(Codec::Vp8));
assert_eq!(preview.streamer().backend(), "synthetic");
// Rates over the second since: the pattern's rate, its bitrate.
// The rates are the counters over the time since the call before. How
// long that was the test does not say (a busy machine stretches a second,
// and the rate of pictures it manages is not what is tested), but it lies
// between the two spans the test timed around it.
tokio::time::sleep(Duration::from_secs(1)).await;
let stats = preview.stats();
assert!((20..=40).contains(&stats.fps), "{stats:?}");
assert!((100_000..5_000_000).contains(&stats.bitrate), "{stats:?}");
let before_second = Instant::now();
let second = preview.stats();
let after_second = Instant::now();
let longest = after_second.duration_since(before_first).as_secs_f64();
let shortest = before_second.duration_since(after_first).as_secs_f64();
let frames = (second.decoded - first.decoded) as f64;
let bits = (second.bytes - first.bytes) as f64 * 8.0;
assert!(frames > 0.0, "no picture in the second: {first:?} {second:?}");
// (The pictures per second are rounded, the bits per second cut off.)
let fps = f64::from(second.fps);
assert!(
(frames / longest - 0.5..=frames / shortest + 0.5).contains(&fps),
"{frames} pictures in {shortest} to {longest} s are not {fps} a second"
);
let bitrate = second.bitrate as f64;
assert!(
(bits / longest - 1.0..=bits / shortest).contains(&bitrate),
"{bits} bits in {shortest} to {longest} s are not {bitrate} a second"
);
}
/// A VP8 decoder for the pipeline tests: fails (with errors, or giving
@@ -4123,7 +4194,8 @@ mod tests {
};
let streamer = Streamer::start(&codecs, config).await.unwrap();
let wait = |what: &str, done: &dyn Fn(&StreamerStats) -> bool| {
let deadline = Instant::now() + Duration::from_secs(5);
// What is waited for is a state; the deadline only ends a hang.
let deadline = Instant::now() + Duration::from_secs(30);
loop {
let stats = streamer.stats();
if done(&stats) {
@@ -4133,15 +4205,18 @@ mod tests {
std::thread::sleep(Duration::from_millis(20));
}
};
// The SineSource tone is 0.05; the second at half gain.
// The SineSource tone is 0.05; the second at half gain. The sources are metered
// before the mixer has made anything of them: the mix and the state of the
// sources are waited for too, not taken to be there with the meters.
let near = |level: f32, want: f32| (level - want).abs() < want * 0.1;
let stats = wait("both tones", &|s| {
let stats = wait("both tones, mixed", &|s| {
s.audio_sources.len() == 2
&& near(s.audio_sources[0].level.peak, 0.05)
&& near(s.audio_sources[1].level.peak, 0.025)
&& s.audio_sources.iter().all(|s| s.state == SourceState::Playing)
&& s.audio_level.peak > 0.05
&& s.audio_limiter == 1.0
});
assert!(stats.audio_sources.iter().all(|s| s.state == SourceState::Playing));
assert!(stats.audio_level.peak > 0.05 && stats.audio_limiter == 1.0, "{stats:?}");
let first = stats.audio_sources[0].id;
// Mute the first (kept: same id), drop the second, add the
@@ -4157,19 +4232,31 @@ mod tests {
streamer.reconfigure(&codecs, update).unwrap();
assert_eq!(streamer.audio_sources().len(), 3);
let publisher = tap::publisher_id();
let speak = std::thread::spawn(move || {
// 20 ms of a 0.2 tone every 20 ms, for a second.
let chunk: Vec<f32> = (0..960).map(|i| 0.2 * (i as f32 * 0.1).sin()).collect();
for _ in 0..50 {
tap::microphone().publish(publisher, &chunk);
std::thread::sleep(Duration::from_millis(20));
let heard = Arc::new(AtomicBool::new(false));
let speak = std::thread::spawn({
let heard = heard.clone();
move || {
// 20 ms of a 0.2 tone every 20 ms, until the test has heard it: the
// source takes what is published only from when it runs, which a
// busy machine delays by any time (the cap ends a thread whose test
// failed first).
let cap = Instant::now() + Duration::from_secs(120);
let chunk: Vec<f32> = (0..960).map(|i| 0.2 * (i as f32 * 0.1).sin()).collect();
while !heard.load(Ordering::Relaxed) && Instant::now() < cap {
tap::microphone().publish(publisher, &chunk);
std::thread::sleep(Duration::from_millis(20));
}
}
});
let stats = wait("microphone in, tone muted", &|s| {
s.audio_sources.len() == 3
&& s.audio_sources[1].level.peak > 0.15
&& s.audio_level.peak > 0.15
&& s.audio_sources[2].error.as_deref().is_some_and(|e| e.contains("no window"))
// Muted, and still metered: the tone's own level is read again.
&& near(s.audio_sources[0].level.peak, 0.05)
});
heard.store(true, Ordering::Relaxed);
speak.join().unwrap();
assert_eq!(stats.audio_sources[0].id, first, "the kept tone keeps its source");
assert!(stats.audio_sources[0].spec.muted);
@@ -4201,9 +4288,15 @@ mod tests {
assert!(streamer.has_audio(), "{:?}", streamer.audio_error());
let mut source = EncodedSource::new(streamer);
let mut frames = Vec::new();
let deadline = Instant::now() + Duration::from_secs(5);
while frames.iter().filter(|f: &&EncodedFrame| f.kind == MediaKind::Audio).count() < 10 {
assert!(Instant::now() < deadline, "no audio");
// Ten frames of audio and one of video, whichever the encoders make first:
// 20 ms of audio is quickly made, and a busy machine can keep the video
// encoder from its first frame for longer than that. The deadline only ends
// a hang.
let deadline = Instant::now() + Duration::from_secs(30);
let count =
|frames: &[EncodedFrame], kind| frames.iter().filter(|f| f.kind == kind).count();
while count(&frames, MediaKind::Audio) < 10 || count(&frames, MediaKind::Video) < 1 {
assert!(Instant::now() < deadline, "no audio or no video in {} frames", frames.len());
tokio::time::sleep(Duration::from_millis(20)).await;
source.poll_frames(Instant::now(), &mut frames);
}
+39 -6
View File
@@ -1295,9 +1295,21 @@ mod tests {
// Before the viewer asks: its offer is made after this.
sink.layer_format(0, format(60_000_000));
handles[1].send(StreamCmd::Watch { stream_id: "s-1".into() });
wait(&mut rx, |e| match e {
Event::WatchState { session: 2, state: WatchState::Connected, .. } => Some(()),
_ => None,
// Connected for the viewer and for the streamer, in either order: the
// streamer asks for a keyframe when its viewer connects, a moment after
// the viewer has seen the connection.
let (mut watching, mut served) = (false, false);
wait(&mut rx, |e| {
match e {
Event::WatchState { session: 2, state: WatchState::Connected, .. } => {
watching = true;
}
Event::StreamViewers { session: 1, viewers } => {
served |= viewers.iter().any(|v| v.state == ViewerState::Connected);
}
_ => {}
}
(watching && served).then_some(())
})
.await;
// 3840x2160 at 60 fps is level 5.2 (0x34) in both profiles.
@@ -1312,7 +1324,15 @@ mod tests {
sink.take_layer_keyframes(&mut layers);
layers.contains(0)
};
keyframes();
// What asked for a keyframe so far (going live, the viewer's connecting
// and its first picture request) is done when a moment longer than the
// merging interval of requests (250 ms) passes with none.
for _ in 0..50 {
tokio::time::sleep(Duration::from_millis(300)).await;
if !keyframes() {
break;
}
}
sink.layer_format(0, format(9_000_000));
timeout(Duration::from_secs(5), async {
while !keyframes() {
@@ -1322,7 +1342,11 @@ mod tests {
.await
.expect("the layer did not change");
sink.layer_format(0, format(9_000_000));
tokio::time::sleep(Duration::from_millis(200)).await;
// The stream task takes its commands in order: its answer to this one
// (an error, nobody is viewer 65535) comes after all that the format
// above set going, and nothing is left to wait out.
handles[0].send(StreamCmd::Kick { viewer: u16::MAX });
wait(&mut rx, |e| matches!(e, Event::Error { session: 1, .. }).then_some(())).await;
assert!(!keyframes(), "nothing changed");
handles[0].send(StreamCmd::Stop);
}
@@ -1701,7 +1725,16 @@ mod tests {
let stats = pipeline.stats();
assert_eq!(stats.codec, Some(Codec::Vp8));
assert!(stats.error.is_none(), "{stats:?}");
let sent = streamer.stats();
// The encoder counts a frame once the sink has taken it, so the picture
// can be at the viewer before the count has moved.
let mut sent = streamer.stats();
for _ in 0..500 {
if sent.video_frames >= 15 && sent.audio_frames > 0 {
break;
}
tokio::time::sleep(Duration::from_millis(10)).await;
sent = streamer.stats();
}
assert!(sent.video_frames >= 15 && sent.audio_frames > 0, "{sent:?}");
handles[0].send(StreamCmd::Stop);
+2 -1
View File
@@ -259,7 +259,8 @@ pub fn from_blob(blob: &IdentityBlob) -> Result<Identity, IdentityError> {
}
/// The TeamSpeak identity in `json`, the text [`to_blob`] writes and the key
/// store keeps; every reader of that text refuses it through here.
/// store keeps; voelin-core reads that text only through here (voelin-store
/// parses it too, for its own checks of a stored row).
///
/// What does not read is refused in words that say how it is wrong
/// (malformed, cut short, not an identity, unreadable) and where (line and
+9 -4
View File
@@ -1650,8 +1650,10 @@ mod account_tests {
events,
));
let mut packet = [0; 2048];
let (_, first) =
timeout(Duration::from_secs(5), server.recv_from(&mut packet)).await.unwrap().unwrap();
let (_, first) = timeout(Duration::from_secs(5), server.recv_from(&mut packet))
.await
.expect("the first handshake packet within 5 s")
.unwrap();
// A logout/clear notification must cancel the old socket and restart.
account.send_replace(None);
let second = timeout(Duration::from_secs(5), async {
@@ -1663,11 +1665,14 @@ mod account_tests {
}
})
.await
.unwrap();
.expect("a handshake packet from a new socket within 5 s of the account change");
assert_ne!(first, second);
// Losing the account authority fails closed immediately, not after connect timeout.
drop(account);
timeout(Duration::from_secs(2), task).await.unwrap().unwrap();
timeout(Duration::from_secs(2), task)
.await
.expect("the connection to end within 2 s of the account source closing")
.unwrap();
assert!(
matches!(received.recv().await, Some(LinkEvent::Disconnected(Some(reason))) if reason == "account source closed")
);
+28
View File
@@ -0,0 +1,28 @@
//! What more than one integration test of this crate needs (a test binary
//! that uses it declares `mod common;`).
use std::path::{Path, PathBuf};
use std::time::Duration;
/// Wait until nothing has the SQLite database at `path` open any more, as when
/// the process that had it has ended: SQLite deletes the write-ahead log
/// (`<path>-wal`) when the last connection closes.
///
/// A dropped `Engine` is not that yet. Its task ends later, the history writer
/// is joined there, and closing the connection checkpoints the log under an
/// exclusive lock, with fsyncs. A connection opened meanwhile waits for the
/// lock only as long as the busy timeout (5 s) and then fails with
/// `DatabaseBusy`, which a loaded disk makes happen (with every fsync taking
/// 6 s it happens every time).
pub async fn closed(path: &Path) {
let mut wal = path.as_os_str().to_owned();
wal.push("-wal");
let wal = PathBuf::from(wal);
tokio::time::timeout(Duration::from_secs(120), async {
while wal.exists() {
tokio::time::sleep(Duration::from_millis(10)).await;
}
})
.await
.expect("the engine's database connection closed");
}
+14 -1
View File
@@ -24,6 +24,8 @@ use voelin_gateway_proto::{
};
use voelin_model::{ChatMessage, ChatTarget, PresenceSnapshot};
mod common;
const LOBBY: ChatTarget = ChatTarget::Channel(1);
const ME: &str = "me-uid";
@@ -529,6 +531,8 @@ async fn history_on_open_paging_and_offline_messages() {
assert_eq!(texts(&stored), ["m1", "m2", "m3", "m4", "m5", "while away 1", "while away 2"]);
history.flush();
drop((engine, history));
// Dropping the engine does not close the database yet (see `closed`).
common::closed(&path).await;
// After a restart, with the gateway down: the stored page, found by the
// gateway's URL, which is remembered with the server's id.
@@ -812,7 +816,16 @@ async fn not_found_proxy() -> String {
#[tokio::test(flavor = "multi_thread")]
async fn the_next_published_gateway_is_used_when_one_fails() {
let proxy = not_found_proxy().await;
let closed = std::net::TcpListener::bind("127.0.0.1:0").unwrap().local_addr().unwrap().port();
// A port that is taken and never listened on: connecting is refused at once,
// and no other test of this process can be given it meanwhile (one that was
// only free for a moment could be, the listeners of the others bind port 0).
let reserved = tokio::net::TcpSocket::new_v4().unwrap();
reserved.bind("127.0.0.1:0".parse().unwrap()).unwrap();
let closed = reserved.local_addr().unwrap().port();
assert!(
tokio::net::TcpStream::connect(("127.0.0.1", closed)).await.is_err(),
"something listens on port {closed}"
);
let gw = FakeGateway::start().await;
let path = temp_db("fallback");
let engine = Engine::start_with(Settings::in_memory(), History::open(&path).unwrap());
+17
View File
@@ -1,8 +1,10 @@
//! Engine against the development servers (dev/docker-compose.yml).
//! Runs only with `VOELIN_LIVE=1`; `scripts/it-smoke.sh` sets it.
use std::sync::LazyLock;
use std::time::Duration;
use tokio::sync::RwLock;
use tokio::sync::broadcast::Receiver;
use tokio::time::{Instant, timeout_at};
use voelin_core::{
@@ -15,6 +17,17 @@ fn live() -> bool {
std::env::var("VOELIN_LIVE").is_ok_and(|v| v == "1")
}
/// The TeamSpeak 6 server's banners are the server's, and `ts6_banners` sets and
/// unsets them there. While it does, whatever else connects to the server is
/// told the addresses of those banners, and an engine fetches what it is told
/// (as it should): the requests of such an engine reached the HTTP server of
/// `ts6_banners`, which counts the requests of the engine under test, and the
/// test failed on `disabled policy must prevent HTTP requests` in every run
/// that had the tests of this file run side by side (as they do). The tests
/// that connect to the server hold this shared, `ts6_banners` exclusively: it
/// runs with the server to itself, and the others before or after it.
static TS6: LazyLock<RwLock<()>> = LazyLock::new(|| RwLock::new(()));
/// Wait for an event matching `f`, failing after 20 s.
async fn wait_for(
rx: &mut Receiver<Event>,
@@ -131,6 +144,7 @@ async fn ts6_engine() {
if !live() {
return;
}
let _server = TS6.read().await;
engine_roundtrip("127.0.0.1:9988", query(voelin_query::Transport::Ssh, "127.0.0.1:10022"))
.await;
}
@@ -258,6 +272,7 @@ async fn ts6_channel_joins() {
if !live() {
return;
}
let _server = TS6.read().await;
channel_joins("127.0.0.1:9988", query(voelin_query::Transport::Ssh, "127.0.0.1:10022")).await;
}
@@ -329,6 +344,7 @@ async fn ts6_banners() {
if !live() {
return;
}
let _server = TS6.write().await;
let voice_addr =
std::env::var("VOELIN_BANNER_VOICE_ADDR").unwrap_or_else(|_| "127.0.0.1:9988".into());
let query_addr =
@@ -512,6 +528,7 @@ async fn ts6_avatars() {
if !live() {
return;
}
let _server = TS6.read().await;
let voice_addr =
std::env::var("VOELIN_BANNER_VOICE_ADDR").unwrap_or_else(|_| "127.0.0.1:9988".into());
let dir = std::env::temp_dir().join(format!("voelin-live-avatars-{}", std::process::id()));
+4 -24
View File
@@ -3,7 +3,6 @@
//! in the client database). The round trips against real servers are in
//! `scripts/it-smoke.sh` (`voelinctl engine`).
use std::path::{Path, PathBuf};
use std::time::Duration;
use tokio::sync::broadcast;
@@ -11,6 +10,10 @@ use voelin_core::settings::Settings;
use voelin_core::{Command, Contact, DownloadTo, Engine, Event, History, Relation, TransferState};
use voelin_model::FileRef;
mod common;
use common::closed;
async fn next<T>(rx: &mut broadcast::Receiver<Event>, mut f: impl FnMut(Event) -> Option<T>) -> T {
tokio::time::timeout(Duration::from_secs(10), async {
loop {
@@ -23,29 +26,6 @@ async fn next<T>(rx: &mut broadcast::Receiver<Event>, mut f: impl FnMut(Event) -
.expect("event in time")
}
/// Wait until nothing has the SQLite database at `path` open any more, as when
/// the process that had it has ended: SQLite deletes the write-ahead log
/// (`<path>-wal`) when the last connection closes.
///
/// A dropped `Engine` is not that yet. Its task ends later, the history writer
/// is joined there, and closing the connection checkpoints the log under an
/// exclusive lock, with fsyncs. A connection opened meanwhile waits for the
/// lock only as long as the busy timeout (5 s) and then fails with
/// `DatabaseBusy`, which a loaded disk makes happen (with every fsync taking
/// 6 s it happens every time).
async fn closed(path: &Path) {
let mut wal = path.as_os_str().to_owned();
wal.push("-wal");
let wal = PathBuf::from(wal);
tokio::time::timeout(Duration::from_secs(120), async {
while wal.exists() {
tokio::time::sleep(Duration::from_millis(10)).await;
}
})
.await
.expect("the engine's database connection closed");
}
#[tokio::test(flavor = "multi_thread")]
async fn requests_without_voice_fail_with_their_ids() {
let engine = Engine::start();
+18 -3
View File
@@ -1,4 +1,9 @@
# Build: docker build -f crates/voelin-gateway/Dockerfile -t tsgw .
# syntax=docker/dockerfile:1
# Build: docker build --ssh default -f crates/voelin-gateway/Dockerfile -t tsgw .
# (--ssh default hands the build your ssh-agent, which must hold a key that
# can read the private VoelinProtocol repository: docs/building.md,
# "Depending on VoelinProtocol". The gateway itself does not use it, but
# Cargo resolves the whole workspace, which includes voelin-identity.)
# Run: docker run -d --name tsgw --init --restart unless-stopped \
# -v ./tsgw.toml:/etc/tsgw/tsgw.toml:ro -v tsgw-data:/var/lib/tsgw \
# -e TSGW_QUERY_PASSWORD=… -p 7788:7788 tsgw
@@ -6,9 +11,19 @@
# the volume: -e TSGW_LOG_FILE=logs/tsgw.log). See docs/gateway-admin.md.
FROM rust:1.94-bookworm AS build
WORKDIR /src
RUN apt-get update && apt-get install -y --no-install-recommends cmake libasound2-dev && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y --no-install-recommends cmake git libasound2-dev openssh-client && rm -rf /var/lib/apt/lists/*
# voelin-identity comes from the private VoelinProtocol repository, fetched
# over SSH by Cargo through the system git, with the agent that
# `docker build --ssh default` forwards (scripts/docker-build.sh passes it):
# the key stays in the agent and never reaches a layer. The host key is the
# reviewed line from .gitea/known_hosts. Cargo resolves the whole workspace, so
# every cargo command needs this, although this crate does not use
# voelin-identity.
COPY .gitea/known_hosts /etc/ssh/ssh_known_hosts
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
COPY . .
RUN cargo build --release --locked -p voelin-gateway && cp target/release/tsgw /tsgw && mkdir /data
RUN --mount=type=ssh,required=true \
cargo build --release --locked -p voelin-gateway && cp target/release/tsgw /tsgw && mkdir /data
FROM gcr.io/distroless/cc-debian12:nonroot
COPY --from=build /tsgw /usr/local/bin/tsgw
+36 -19
View File
@@ -1180,19 +1180,32 @@ mod tests {
scenes
}
/// The first preview frame that `wanted` takes. The preview keeps the latest
/// frame only, so few older ones are waiting or on their way: the number of
/// frames looked at is the bound (the work), and the wait for each, which a
/// busy machine can stretch, only ends a hang.
fn preview_until(
preview: &Handoff<VideoFrame>,
wanted: impl Fn(&VideoFrame) -> bool,
) -> Arc<VideoFrame> {
for _ in 0..20 {
let frame = preview.wait_timeout(Duration::from_secs(30)).expect("a preview frame");
if wanted(&frame) {
return frame;
}
}
panic!("the preview never showed what was asked for");
}
#[tokio::test]
async fn it_composes_into_the_preview_and_follows_commands() {
let studio = Studio::start(one_colour_scene()).await.unwrap();
let preview = studio.preview();
studio.apply(Command::SetPreview { width: 32, height: 24, fps: 60 }).await.unwrap();
let started = Instant::now();
let frame = loop {
if let Some(frame) = preview.wait_timeout(Duration::from_millis(200)) {
break frame;
}
assert!(started.elapsed() < Duration::from_secs(5), "no preview frame");
};
assert_eq!((frame.width, frame.height), (32, 24));
// The studio composes from the moment it starts, at the size and rate the
// preview has then (480x270, 15 fps): a frame of that size can be the
// first one there is.
let frame = preview_until(&preview, |f| (f.width, f.height) == (32, 24));
let crate::frame::FrameData::Rgba(p) = &frame.data else { panic!("not RGBA") };
assert_eq!(&p.data[..4], &[9, 8, 7, 255]);
@@ -1211,15 +1224,12 @@ mod tests {
.unwrap();
studio.apply(Command::SetActiveScene { scene: break_id }).await.unwrap();
assert_eq!(studio.status().active_scene, break_id);
// The new scene's source draws.
let frame = loop {
let frame = preview.wait_timeout(Duration::from_secs(2)).expect("a preview frame");
let crate::frame::FrameData::Rgba(p) = &frame.data else { panic!() };
if p.data[..3] == [1, 2, 3] {
break frame;
}
assert!(started.elapsed() < Duration::from_secs(10), "the scene never switched");
};
// The new scene's source draws, from the first frame composed after the
// command.
let frame = preview_until(
&preview,
|f| matches!(&f.data, crate::frame::FrameData::Rgba(p) if p.data[..3] == [1, 2, 3]),
);
drop(frame);
studio.apply(Command::RemoveScene { scene: break_id }).await.unwrap();
@@ -1402,9 +1412,16 @@ mod tests {
assert_eq!((listed[0].width, listed[0].height), (64, 48));
let frames = capture.start(&SourceId::Studio, &CaptureOptions::default()).await.unwrap();
let mut frames = frames;
let frame = frames.recv_timeout(Duration::from_secs(5)).expect("a composed frame");
// (The wait only ends a hang.)
let frame = frames.recv_timeout(Duration::from_secs(30)).expect("a composed frame");
assert_eq!((frame.width, frame.height), (64, 48));
assert!(studio.shared.delivered.load(Ordering::Relaxed) > 0);
// A frame is counted once it has been handed over, so the count can still be
// behind when the frame is in the hands of the test.
let deadline = Instant::now() + Duration::from_secs(30);
while studio.shared.delivered.load(Ordering::Relaxed) == 0 {
assert!(Instant::now() < deadline, "the frame handed over was never counted");
std::thread::sleep(Duration::from_millis(5));
}
capture.stop();
std::fs::remove_dir_all(&dir).ok();
}
@@ -350,7 +350,22 @@ mod tests {
#[test]
fn an_unwritable_path_fails_at_once() {
assert!(Recorder::start("/nonexistent-root-dir/x/clip.webm", 0, 2).is_err());
assert!(Recorder::start("clip.mp4", 0, 2).is_err());
let dir = dir("unwritable");
// A path below a regular file fails for every user, root included
// (ENOTDIR). A directory that is merely missing would be created, and
// a read-only one is written to by root.
let file = dir.join("not-a-directory");
std::fs::write(&file, b"x").unwrap();
assert!(Recorder::start(file.join("x").join("clip.webm"), 0, 2).is_err());
// The directory is there and the file cannot be created because the
// path names a directory (EISDIR, again for every user).
let named_like_a_file = dir.join("clip.webm");
std::fs::create_dir(&named_like_a_file).unwrap();
assert!(Recorder::start(&named_like_a_file, 0, 2).is_err());
// A name that asks for no known container is refused before any file
// is created.
assert!(Recorder::start(dir.join("clip.mp4"), 0, 2).is_err());
assert!(!dir.join("clip.mp4").exists());
std::fs::remove_dir_all(&dir).ok();
}
}
+5
View File
@@ -85,6 +85,11 @@ fn on_a_bus_of_its_own() {
let text =
format!("{}{}", String::from_utf8_lossy(&run.stdout), String::from_utf8_lossy(&run.stderr));
if run.status.success() {
// A child that ran no test (its filter matched nothing) exits 0 as well.
assert!(
text.contains("test result: ok. 1 passed;"),
"the run on its own bus exited 0 without reporting `1 passed`:\n{text}"
);
return;
}
// The test ran and failed, or the bus never came up.
+7
View File
@@ -7,6 +7,13 @@ all-features = false
# Unmaintained crates are reported but only fail for direct dependencies.
unmaintained = "workspace"
ignore = [
# TIME-LIMITED, remove by 2026-12-20 (entered 2026-10-25). `crypto-bigint` 0.5.5
# (through `elliptic-curve` 0.13 / `p256` 0.13 of `tsproto-types`) and 0.6.1
# (`tsproto` directly) have no fixed release on their lines; the fix is to move
# the tsclientlib fork to the `p256` 0.14 / `crypto-bigint` 0.7 line. The affected
# arithmetic serves the TeamSpeak identity (ECDH, ECDSA) in a client that holds
# only its own key, so the timing variability is a local concern.
{ id = "RUSTSEC-2026-0387", reason = "tsproto and tsproto-types pin crypto-bigint 0.5/0.6; fork upgrade to p256 0.14 is the follow-up" },
# Marvin attack: timing side channel in RSA *private-key* operations of the
# `rsa` crate, pulled in by russh. TeamSpeak SSH query servers use RSA host
# keys, so russh needs RSA to verify the server's signature (a public-key
+20 -8
View File
@@ -3,13 +3,15 @@
# Android APKs (docs/building.md, docs/android.md): a debug APK, installable
# as is, for arm64-v8a and x86_64 (emulators).
#
# docker build -f docker/android.Dockerfile -o dist/android .
# docker build -f docker/android.Dockerfile --build-arg ABIS=arm64-v8a -o dist/android .
# docker build --ssh default -f docker/android.Dockerfile -o dist/android .
# docker build --ssh default -f docker/android.Dockerfile --build-arg ABIS=arm64-v8a -o dist/android .
#
# or scripts/docker-build.sh android. A signed release APK needs your keystore
# (docs/release.md), passed as build secrets:
# or scripts/docker-build.sh android. --ssh default hands the build your
# ssh-agent, which must hold a key that can read the private VoelinProtocol
# repository (docs/building.md, "Depending on VoelinProtocol"). A signed
# release APK needs your keystore (docs/release.md), passed as build secrets:
#
# docker build -f docker/android.Dockerfile --build-arg APK=release \
# docker build --ssh default -f docker/android.Dockerfile --build-arg APK=release \
# --secret id=keystore,src=release.jks --secret id=signing,src=signing.env \
# -o dist/android .
#
@@ -21,8 +23,8 @@ FROM ubuntu:24.04 AS toolchain
ARG DEBIAN_FRONTEND=noninteractive
# JDK 17 (Gradle, the Android Gradle plugin), CMake + Ninja (the bundled libopus).
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential ca-certificates cmake curl ninja-build openjdk-17-jdk-headless \
pkg-config python3 unzip \
build-essential ca-certificates cmake curl git ninja-build openjdk-17-jdk-headless \
openssh-client pkg-config python3 unzip \
&& rm -rf /var/lib/apt/lists/*
# Extra CA certificates (PEM, one or more), for building behind a
@@ -83,8 +85,18 @@ ARG APK=debug
# supplies a fresh non-secret nonce so a rotated key cannot reuse an old APK.
ARG SIGNING_CACHE_BUST=unsigned
WORKDIR /src
# voelin-identity comes from the private VoelinProtocol repository, fetched
# over SSH by Cargo through the system git, with the agent that
# `docker build --ssh default` forwards (scripts/docker-build.sh passes it):
# the key stays in the agent and never reaches a layer. The host key is the
# reviewed line from .gitea/known_hosts. Cargo resolves the whole workspace, so
# every cargo command needs this (Gradle's cargo-ndk inherits the agent and the
# variable below).
COPY .gitea/known_hosts /etc/ssh/ssh_known_hosts
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
COPY . .
RUN --mount=type=cache,id=voelin-cargo-registry,target=/usr/local/cargo/registry \
RUN --mount=type=ssh,required=true \
--mount=type=cache,id=voelin-cargo-registry,target=/usr/local/cargo/registry \
--mount=type=cache,id=voelin-target-android,target=/src/target \
--mount=type=cache,id=voelin-gradle,target=/root/.gradle \
--mount=type=secret,id=keystore,required=false \
+17 -5
View File
@@ -5,17 +5,20 @@
# gateway (servers) as tsgw-<version>-linux-x86_64.tar.gz and
# tsgw_<version>_amd64.deb.
#
# docker build -f docker/linux.Dockerfile -o dist/linux .
# docker build --ssh default -f docker/linux.Dockerfile -o dist/linux .
#
# or scripts/docker-build.sh linux. The cargo registry and target directory
# live in cache mounts, so rebuilds are incremental.
# or scripts/docker-build.sh linux. --ssh default hands the build your
# ssh-agent, which must hold a key that can read the private VoelinProtocol
# repository (docs/building.md, "Depending on VoelinProtocol"). The cargo
# registry and target directory live in cache mounts, so rebuilds are
# incremental.
FROM ubuntu:24.04 AS toolchain
ARG DEBIAN_FRONTEND=noninteractive
# The same libraries as CI (.github/actions/system-deps), plus dpkg-dev for
# the .deb's dependencies and patchelf for the .tar.gz's bundled libraries.
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential ca-certificates cmake curl dpkg-dev patchelf pkg-config \
build-essential ca-certificates cmake curl dpkg-dev git openssh-client patchelf pkg-config \
libasound2-dev libfontconfig1-dev libxkbcommon-dev \
libvpx-dev libdav1d-dev libpipewire-0.3-dev libspa-0.2-dev libclang-dev \
&& rm -rf /var/lib/apt/lists/*
@@ -37,8 +40,17 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
FROM toolchain AS build
WORKDIR /src
# voelin-identity comes from the private VoelinProtocol repository, fetched
# over SSH by Cargo through the system git, with the agent that
# `docker build --ssh default` forwards (scripts/docker-build.sh passes it):
# the key stays in the agent and never reaches a layer. The host key is the
# reviewed line from .gitea/known_hosts. Cargo resolves the whole workspace, so
# every cargo command needs this.
COPY .gitea/known_hosts /etc/ssh/ssh_known_hosts
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
COPY . .
RUN --mount=type=cache,id=voelin-cargo-registry,target=/usr/local/cargo/registry \
RUN --mount=type=ssh,required=true \
--mount=type=cache,id=voelin-cargo-registry,target=/usr/local/cargo/registry \
--mount=type=cache,id=voelin-target-linux,target=/src/target \
cargo build --release --locked -p voelin-ui -p voelin-gateway \
&& scripts/package.sh linux /out
+20 -7
View File
@@ -4,11 +4,15 @@
# voelin-<version>-windows-x86_64.zip with voelin.exe, and the NSIS installer
# voelin-<version>-setup.exe.
#
# docker build -f docker/windows.Dockerfile -o dist/windows .
# docker build --ssh default -f docker/windows.Dockerfile -o dist/windows .
#
# or scripts/docker-build.sh windows. This builds for x86_64-pc-windows-gnu
# with mingw-w64; CI's Windows jobs build the MSVC target on Windows. Both run
# on Windows 10 and 11. Unsigned, like CI's (signing: docs/release.md).
# or scripts/docker-build.sh windows. --ssh default hands the build your
# ssh-agent, which must hold a key that can read the private VoelinProtocol
# repository (docs/building.md, "Depending on VoelinProtocol").
#
# This builds for x86_64-pc-windows-gnu with mingw-w64; CI's Windows jobs build
# the MSVC target on Windows. Both run on Windows 10 and 11. Unsigned, like
# CI's (signing: docs/release.md).
FROM ubuntu:24.04 AS toolchain
ARG DEBIAN_FRONTEND=noninteractive
@@ -16,8 +20,8 @@ ARG DEBIAN_FRONTEND=noninteractive
# assembly), CMake (the bundled libopus, aws-lc), Meson and Ninja (dav1d),
# NSIS (the installer), zip and unzip.
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential ca-certificates cmake curl git meson mingw-w64 nasm ninja-build nsis perl \
pkg-config unzip zip \
build-essential ca-certificates cmake curl git meson mingw-w64 nasm ninja-build nsis \
openssh-client perl pkg-config unzip zip \
&& rm -rf /var/lib/apt/lists/* \
&& update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix \
&& update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
@@ -89,9 +93,18 @@ ENV VPX_LIB_DIR=/opt/libvpx/lib VPX_INCLUDE_DIR=/opt/libvpx/include \
SYSTEM_DEPS_DAV1D_NO_PKG_CONFIG=1 SYSTEM_DEPS_DAV1D_SEARCH_NATIVE=/opt/dav1d/lib \
SYSTEM_DEPS_DAV1D_LIB=dav1d SYSTEM_DEPS_DAV1D_LINK=static
WORKDIR /src
# voelin-identity comes from the private VoelinProtocol repository, fetched
# over SSH by Cargo through the system git, with the agent that
# `docker build --ssh default` forwards (scripts/docker-build.sh passes it):
# the key stays in the agent and never reaches a layer. The host key is the
# reviewed line from .gitea/known_hosts. Cargo resolves the whole workspace, so
# every cargo command needs this.
COPY .gitea/known_hosts /etc/ssh/ssh_known_hosts
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
COPY . .
# FFmpeg's LGPL DLLs go into the packages (scripts/fetch-ffmpeg-windows.sh).
RUN --mount=type=cache,id=voelin-cargo-registry,target=/usr/local/cargo/registry \
RUN --mount=type=ssh,required=true \
--mount=type=cache,id=voelin-cargo-registry,target=/usr/local/cargo/registry \
--mount=type=cache,id=voelin-target-windows,target=/src/target \
cargo build --release --locked --target x86_64-pc-windows-gnu -p voelin-ui \
&& scripts/fetch-ffmpeg-windows.sh /tmp/ffmpeg \
+27 -8
View File
@@ -28,7 +28,8 @@ yet: Windows SmartScreen warns about the installer, and the debug APK is
signed with a debug key (fine for testing, not for the Play Store).
The gateway's image can also be built directly:
`docker build -f crates/voelin-gateway/Dockerfile -t tsgw .`.
`docker build --ssh default -f crates/voelin-gateway/Dockerfile -t tsgw .`
(`--ssh default`: see [Locally with Docker](#locally-with-docker)).
Gitea at [git.faumaray.ru](https://git.faumaray.ru) builds the same package
types through `.gitea/workflows/release.yml`: manual runs produce one
@@ -80,7 +81,16 @@ scripts/docker-build.sh android # → dist/android/
scripts/docker-build.sh # all three
```
The same with plain Docker, e.g. `docker build -f docker/linux.Dockerfile -o dist/linux .`
The same with plain Docker, e.g. `docker build --ssh default -f docker/linux.Dockerfile -o dist/linux .`.
**The builds need an ssh-agent that holds a key able to read the private
VoelinProtocol repository** ([below](#depending-on-voelinprotocol)): Cargo
fetches it inside the image, through the agent that `--ssh default` hands to the
build. The key stays in the agent; it is not copied into the image or the build
cache. `scripts/docker-build.sh` passes `--ssh default` itself and stops with a
message when `ssh-add -l` shows no agent or no key (`eval "$(ssh-agent -s)"`,
then `ssh-add` your key). The server's host key comes from
`.gitea/known_hosts` ([ci.md](ci.md#voelinprotocol-access)).
Rebuilds are incremental: the cargo registry, `target/` and Gradle live in
BuildKit cache mounts (`docker builder prune` frees them).
@@ -153,13 +163,22 @@ set `net.git-fetch-with-cli = true` in `~/.cargo/config.toml`.
compiler (gcc or clang) and cmake.
`deny.toml` allows this one git source.
**CI and the Docker builds need read access to that repository too**: an SSH
deploy key (a repository secret written to `~/.ssh`, with the server's host key
in `known_hosts`) or an access token (rewrite the SSH URL to HTTPS with
**CI and the Docker builds read it with a read-only SSH deploy key.** The key
is registered on VoelinProtocol and stored as the repository secret
`VOELIN_PROTOCOL_DEPLOY_KEY`; the Gitea workflows write it to `~/.ssh` (CI) or
load it into an ssh-agent (release builds), the server's host key comes from the
committed `.gitea/known_hosts`, and Cargo is told to fetch with the system git
(`CARGO_NET_GIT_FETCH_WITH_CLI=true`) because its built-in git client ignores
`~/.ssh/config`. The Docker builds use the same key through
`docker build --ssh default` (see above). What was set up, how to re-check the
host key's fingerprint and what each failure means:
[ci.md](ci.md#voelinprotocol-access). A runner of your own gets the same setup
from the workflows; the alternative to a deploy key is an access token (rewrite
the SSH URL to HTTPS with
`git config --global url."https://<token>@git.faumaray.com/".insteadOf ssh://gitea@git.faumaray.com/`
and set `CARGO_NET_GIT_FETCH_WITH_CLI=true`). Without it `cargo` cannot fetch
the dependency and a fresh checkout does not build; the details are in
VoelinProtocol's `docs/development.md` ("Depending on VoelinProtocol").
and set `CARGO_NET_GIT_FETCH_WITH_CLI=true`), which these workflows do not
use. More in VoelinProtocol's `docs/development.md` ("Depending on
VoelinProtocol").
### Working with a sibling VoelinProtocol checkout
+198 -16
View File
@@ -46,21 +46,25 @@ the separate `release.yml` workflow below.
this label (the left side must match the workflow's `runs-on`):
```text
ubuntu-24.04:docker://ghcr.io/catthehacker/ubuntu:act-24.04
ubuntu-24.04:docker://docker.gitea.com/runner-images:ubuntu-24.04
```
Configure this in the runner's labels when registering/configuring it;
an `ubuntu-latest` label alone does not match. The job image must provide
Bash, Git, Node.js for checkout v4, and root or passwordless sudo for apt.
an `ubuntu-latest` label alone does not match. This is the image of the
runner that runs this repository's CI, and the one the tests are checked
against ([Tests under the job image](#tests-under-the-job-image)). The job
image must provide Bash, Git, the OpenSSH client, Node.js for checkout v4,
and root or passwordless sudo for apt.
3. Allow network access from the runner and job container to the Gitea
instance, GitHub (checkout action, dependencies and RustSec advisories),
GHCR (runner image), Ubuntu apt mirrors, rustup distribution servers,
crates.io and dependency/license sources used by cargo-about. The
`docker.gitea.com` (runner image), Ubuntu apt mirrors, rustup
distribution servers, crates.io and dependency/license sources used by
cargo-about. The
workspace also depends on the **private** VoelinProtocol repository
(`voelin-identity`, over SSH), so the job needs read access to it: an SSH
deploy key or an access token, set up as in
[building.md](building.md#depending-on-voelinprotocol). Until a runner has
it, a fresh checkout does not build there.
(`voelin-identity`, over SSH), so the job needs read access to it and the
server's SSH port. The workflows set that up themselves from a repository
secret: [VoelinProtocol access](#voelinprotocol-access). A runner needs
nothing for it beyond the network access and the image tools above.
4. Provision enough RAM, swap and free disk for a full Slint workspace build
plus cargo-deny/cargo-about compilation. These are large builds; monitor
the first run and size the runner accordingly. The workflow limits Cargo
@@ -93,14 +97,190 @@ No GitHub cache/artifact service or reusable-workflow support is required.
The job does not need a Docker socket mounted inside its container; the
runner itself still needs Docker access to start that container. Keep this
runner isolated from production services and credentials, particularly when
accepting untrusted pull requests. No release signing or publishing secrets
are needed.
accepting untrusted pull requests. CI needs one secret, the VoelinProtocol
deploy key below; it needs no release signing or publishing secrets.
After registering the runner, dispatch **CI** in Gitea Actions and inspect
all step results. Local YAML/shell checks do not prove that a particular
Gitea instance, runner registration, network policy or resource allocation
can complete this job.
### Tests under the job image
The test step runs as **root** in an Ubuntu 24.04 container of the
`ubuntu-24.04` label ([Runner setup](#runner-setup):
`docker.gitea.com/runner-images:ubuntu-24.04`, `HOME=/root`) to which only
the apt packages of the system-dependencies action are added. A test that
assumes a developer machine fails there, and a run takes about an hour, so
check a change to the tests the way CI runs them, with every failing test of
every crate listed in one go (`--no-fail-fast`):
```sh
# A bare clone of the private VoelinProtocol repository (see below the block):
# git clone --bare ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git <dir>
: "${PROTOCOL_GIT:?path of a bare clone of VoelinProtocol}"
# Root owns what the container writes: keep it in a directory of its own
# (.scratch/ is in .gitignore; see below the block for its removal).
mkdir -p .scratch
docker run --rm --init -v "$PWD":/src -w /src -e HOME=/root \
-v "$PROTOCOL_GIT":/protocol.git:ro -e CARGO_NET_GIT_FETCH_WITH_CLI=true \
-e CARGO_HOME=/src/.scratch/cargo -e RUSTUP_HOME=/src/.scratch/rustup \
-e CARGO_TARGET_DIR=/src/.scratch/target \
docker.gitea.com/runner-images:ubuntu-24.04 bash -c '
git -C / config --global url."file:///protocol.git".insteadOf \
ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git
apt-get update && apt-get install -y --no-install-recommends \
build-essential ca-certificates cmake curl git jq pkg-config python3 \
libasound2-dev libfontconfig1-dev libxkbcommon-dev libvpx-dev \
libdav1d-dev libpipewire-0.3-dev libspa-0.2-dev libclang-dev xvfb xauth
curl --proto =https --tlsv1.2 -sSf https://sh.rustup.rs | \
sh -s -- -y --profile minimal --default-toolchain none
. "$CARGO_HOME/env" && rustup toolchain install
xvfb-run -a bash -c "VOELIN_X11_TEST_DISPLAY=\$DISPLAY \
cargo test --workspace --locked --no-fail-fast"'
```
`--init` is required: `bash -c` runs its last command, `xvfb-run`, as the
container's process 1, and that never gets to start `cargo` (the command
hangs). The runner starts its steps with `docker exec` in a container whose
process 1 is something else, so CI itself is not affected.
The private VoelinProtocol dependency needs the deploy key
([below](#voelinprotocol-access)). The block reads it from a local bare clone
instead: `PROTOCOL_GIT` is mounted at `/protocol.git` and git is told to use
it in place of the SSH URL (with `CARGO_NET_GIT_FETCH_WITH_CLI=true`, as in CI,
so that cargo runs the `git` command), which leaves `Cargo.lock` as it is.
The `git config` is run with `-C /` because a git worktree's `.git` file points
outside the mount, and `git config` in `/src` then fails with `fatal: not a git
repository: (null)` (exit 128). To use the deploy key instead, set it up as
described below and leave out the `PROTOCOL_GIT` lines and the `git config`
command. What the container wrote under `.scratch/` belongs to root; remove it
from a container as well:
```sh
docker run --rm -v "$PWD/.scratch":/s alpine:3.20 rm -rf /s/target /s/cargo /s/rustup
```
What the image lacks, and what the tests do about it. A test that is about
the missing piece returns without testing it, in most cases after printing a
line that says it skipped and names the piece (the wording differs from test
to test), or is `#[ignore]`d with the reason, and passes; any other test does
not need the piece.
| A test cannot count on | What the tests do |
|---|---|
| Regular user (root writes anywhere and creates missing directories) | Nothing relies on a permission bit or a missing directory failing. A path that cannot be written is built from something that fails for root too: below a regular file (`ENOTDIR`) or naming a directory (`EISDIR`), as `an_unwritable_path_fails_at_once` of the recorder does. |
| Sound card (`/dev/snd`), PipeWire and WirePlumber daemons | `libpipewire` and ALSA are there to build against only. `tests/pipewire_apps.rs` needs `pipewire`, `wireplumber` and `dbus-daemon` and, without them, prints a skipped line that names them. The camera tests are `#[ignore]`d (a camera and PipeWire). |
| D-Bus session bus | `voelin-platform`'s portal proxy test runs itself again under `dbus-run-session` on a bus of its own and, where that cannot be run, prints `skipped, nothing was checked: dbus-run-session cannot be run`; the notification and capture-portal tests run only where no bus is configured, and check that talking to a missing service fails cleanly. |
| GPU, `/dev/dri`, VA-API, `/dev/udmabuf` | The VA-API and DMA-BUF tests print a skipped line that names what is missing: a usable `h264_vaapi`, `/dev/udmabuf` or VA-API surfaces to export. |
| FFmpeg libraries, `ffmpeg` and `ffprobe` | The FFmpeg tests of `voelin-media` and `voelin-core` print a skipped line that names what is missing (the libraries, `ffmpeg`, `ffprobe`). The studio tests that read a recording back with `ffprobe` write and check the file themselves and skip only the `ffprobe` check; the RTMP tests need all three and skip. |
| H.264 encoder (no FFmpeg, no GPU, no OpenH264 library: `VOELIN_OPENH264_LIB` is unset and the download test is `#[ignore]`d) | Tests that need an H.264 encoder print a skipped line that says no H.264 encoder is there. Tests of codec choice state what `preferred_codec` promises with whatever the machine can encode. VP8 and VP9 (libvpx) are built in, so their round trips run. |
| X11 or Wayland display | `xvfb-run` supplies one X11 display and the step hands it over as `VOELIN_X11_TEST_DISPLAY` to the X11 capture and hotkey tests. `VOELIN_WLROOTS_TEST_DISPLAY` is unset, so the wlroots capture test prints `skipped`. |
| Playwright and Chromium (the image has Node) | The browser interop tests print `skipped: set VOELIN_INTEROP=1 (needs node, Playwright and Chromium)`. |
| TeamSpeak dev servers | Without `VOELIN_LIVE=1` the live tests return at once (some print `skipped: set VOELIN_LIVE=1 with the dev servers running`); the gateway's live test is `#[ignore]`d (`needs a running tsgw and TeamSpeak server`). |
| DNS and internet while the tests run (the job needs the network for apt, rustup and crates before they start) | The tests use no DNS or internet; those that would are `#[ignore]`d with the reason: four resolver tests of `tsclientlib` (`needs DNS and the internet`) and the OpenH264 download test. |
`localhost` resolves to `::1` first in this image (it also has `127.0.0.1`).
The tests that reach a server of their own go to `127.0.0.1` by name, not
through `localhost`, so a machine where connections to `::1` hang (a
development machine with a VPN does that) changes nothing for them.
A test that passes in the image and fails now and then on a busy runner or
development machine is another kind of failure, a test of the machine's load:
[testing/load.md](testing/load.md) says how to make a machine busy to
reproduce one, what the tests that failed that way assert now, and which are
known and left alone.
### VoelinProtocol access
The workspace depends on `voelin-identity` from the **private** repository
`Voelin/VoelinProtocol`, as a git dependency over SSH
([building.md](building.md#depending-on-voelinprotocol)). Cargo resolves the
whole workspace before it builds anything, so *every* cargo command needs
that access: all of CI, all three package images and the gateway image (whose
crate does not use `voelin-identity` itself). Without it the first cargo
command fails with `unknown SSH host key` (runs 1037 and 1050 did).
What is set up:
- **The deploy key.** A read-only SSH deploy key is registered on
`Voelin/VoelinProtocol` (Settings → Deploy Keys, write access off). It has
no other use and no access to any other repository. Its private half is the
repository secret **`VOELIN_PROTOCOL_DEPLOY_KEY`** of `Voelin/VoelinClient`
(Settings → Actions → Secrets): the whole OpenSSH private key file, BEGIN
and END lines included, without a passphrase. To rotate it, make a new pair
(`ssh-keygen -t ed25519 -N '' -C voelin-client-ci -f key`), register
`key.pub` on VoelinProtocol, replace the secret with the contents of
`key`, run CI, then delete the old deploy key and `key`.
- **CI** (`ci.yml`). The workflow hands the secret to the checks action as its
input `protocol-deploy-key` (a repository secret is not visible inside a
composite action). The action's first step fails at once, naming the secret,
if the input is empty or is not a private key. Otherwise it writes the key to
`~/.ssh/voelin_protocol` (mode 0600, `~/.ssh` 0700), appends the host key
line to `~/.ssh/known_hosts`, writes a `Host git.faumaray.com` block to
`~/.ssh/config` (`User gitea`, that `IdentityFile`, `IdentitiesOnly yes`,
`StrictHostKeyChecking yes`) and exports `CARGO_NET_GIT_FETCH_WITH_CLI=true`
and `GIT_SSH_COMMAND` for the rest of the job (`ci.yml` sets the first one
in its own `env` as well). It prints only the key's
public fingerprint; the key is never echoed. After the system packages a
second step runs `git ls-remote` on VoelinProtocol, so a wrong key or host
key fails there, with the reason, and not inside a cargo command. The key
lives in the job container and goes with it.
- **Release** (`release.yml`). A step after checkout starts an `ssh-agent` on
the release host, loads the key into it from stdin (it is never written to
disk) and exports `SSH_AUTH_SOCK`; the agent forgets the key after nine
hours, and a last step, which also runs after a failure, stops it. The
builds pass the agent on with `docker build --ssh default`
(`scripts/docker-build.sh` does it for the three packages; the gateway image
step does it itself).
- **The images.** Each cargo `RUN` of `docker/*.Dockerfile` and
`crates/voelin-gateway/Dockerfile` has `--mount=type=ssh,required=true`, so
the key exists only inside that step, through the agent socket, and never
reaches a layer, a build argument or the cache; a build without `--ssh`
stops there with `unset ssh forward key default`. The build stage copies
`.gitea/known_hosts` to `/etc/ssh/ssh_known_hosts` and sets the same
`CARGO_NET_GIT_FETCH_WITH_CLI=true`; the toolchain stages install `git` and
`openssh-client`.
- **Cargo uses the system git** (`CARGO_NET_GIT_FETCH_WITH_CLI=true`) because
Cargo's built-in git client does not read `~/.ssh/config` (so it cannot use
an `IdentityFile`), authenticates with an ssh-agent and checks the host
against `~/.ssh/known_hosts` and its own `net.ssh.known-hosts` setting. The
system git runs `ssh`, which reads the config above (and
`/etc/ssh/ssh_known_hosts` in the images), so the same files serve a plain
`git` call, Cargo and the access check.
- **The host key** is committed in [`.gitea/known_hosts`](../.gitea/known_hosts),
never fetched while a job runs. Gitea's built-in SSH server (`SSH-2.0-Go`)
offers an RSA host key only (`ssh-keyscan -t ed25519 git.faumaray.com`
prints nothing), so the line is `ssh-rsa`; its fingerprint is
`SHA256:fugBYnqAnqmTLsGpafVgQF9gPQzJqps7uHvs48blg2A`. Re-check it:
```sh
ssh-keygen -lf .gitea/known_hosts # the committed line
ssh-keyscan -t rsa git.faumaray.com | ssh-keygen -lf - # what the server offers now
```
Both print the fingerprint above. If the server's key is ever replaced on
purpose, confirm the new fingerprint with the server's administrator, put the
new `ssh-keyscan -t rsa` line and the date in `.gitea/known_hosts` and the
fingerprint here, and commit all of it in one change. Until then a changed key
makes every job stop with `Host key verification failed`, which is the point.
Pull requests from forks get no secrets: their CI run stops at the first step
with the message about the empty deploy key. Anyone who can change a workflow of
this repository, or run code in one of its jobs, can read the key; it can only
read VoelinProtocol, and it is replaced as above. That is one more reason to
keep the CI runner isolated, as said above.
If a run fails here:
| Message | Cause |
|---|---|
| `The VoelinProtocol deploy key is empty` | the secret is missing, empty or not visible (a fork's pull request) |
| `… is not an unencrypted OpenSSH or PEM private key` | the secret holds something else, or a key with a passphrase |
| `Permission denied (publickey)` in "Check read access to VoelinProtocol" | the key is valid but is not a deploy key of VoelinProtocol: compare the fingerprint "Deploy key installed" printed with the one in VoelinProtocol's deploy key settings |
| `Host key verification failed` | `.gitea/known_hosts` does not match the server: check as above before changing anything |
| `unset ssh forward key default` | a Docker build ran without `--ssh default`: a plain `docker build` (`scripts/docker-build.sh` passes it itself and stops earlier when the agent has no key) |
### Gitea release runner
The instance at `https://git.faumaray.ru` reported Gitea **1.25.4** on
@@ -114,9 +294,10 @@ host** runner with the label:
voelin-release:host
```
Provision Bash, Git, Node.js 20+, Python 3.11+, curl, tar, gzip and rootful
Docker 23+ with BuildKit. Use **act_runner 0.2.7 or newer** (prefer the latest
maintained release), or gitea-runner 2+. Older act_runner does not provide
Provision Bash, Git, the OpenSSH client (`ssh-agent` and `ssh-add`), Node.js
20+, Python 3.11+, curl, tar, gzip and rootful Docker 23+ with BuildKit. Use
**act_runner 0.2.7 or newer** (prefer the latest maintained release), or
gitea-runner 2+. Older act_runner does not provide
`ACTIONS_RESULTS_URL`, which the pinned artifact action needs. Register the
runner against `https://git.faumaray.ru`, reachable from both the host and
build containers. Gitea 1.25.4 provides the required artifact-v4 API.
@@ -158,8 +339,9 @@ ENDLESS_TASK_TIMEOUT = 9h
Keep sufficient RAM/swap and free disk for all package builds and their
Docker caches. The package builds run one after another, each with as many
Cargo jobs as the host has CPUs. The workflow never prunes shared Docker
state or creates host swap. The token and optional Android signing secrets
are documented in
state or creates host swap. The secrets are the VoelinProtocol deploy key
([below](#voelinprotocol-access)), `RELEASE_TOKEN` and the optional Android
signing secrets, both documented in
[Gitea releases](release.md#gitea-releases).
The Gitea release job builds packages only: it runs no formatting, Clippy,
+1 -1
View File
@@ -240,7 +240,7 @@ the unit to `/etc/systemd/system/`.
**Container** (`tsgw-image.tar.gz`, or build it):
```sh
docker load -i tsgw-image.tar.gz # or: docker build -f crates/voelin-gateway/Dockerfile -t tsgw .
docker load -i tsgw-image.tar.gz # or: docker build --ssh default -f crates/voelin-gateway/Dockerfile -t tsgw .
docker run -d --name tsgw --init --restart unless-stopped \
-v $PWD/tsgw.toml:/etc/tsgw/tsgw.toml:ro -v tsgw-data:/var/lib/tsgw \
-e TSGW_QUERY_PASSWORD=… -p 7788:7788 tsgw
+261
View File
@@ -0,0 +1,261 @@
# Tests under load
A test that passes alone and fails one run in a hundred when the machine is
busy is a test of the machine. The runner shares its CPUs with other jobs, and
a developer's machine with whatever else runs on it, so the suite has to give
the same answer on a busy machine as on an idle one. This page says how to
make a machine busy, what the fixes of `phase5/test-hygiene` did about the
tests that failed only then, and what is known and left alone.
## The round of `phase5/test-hygiene`
The branch is `phase5/test-hygiene`, from `2ffe5ff` (main with the session
seam, its follow-ups, the CI deploy key and `phase5/tests-under-runner`). It
settles the left-overs of the review of the seam follow-ups and of the
tests-under-runner round. The `mao-*` agents were not registered in the
session, so a general-purpose agent played `mao-implementer` (Sonnet 5.5),
attempt 1; an earlier run of the same task was cut off by a restart of the
orchestrator, left four commits and an uncommitted tree, and this attempt
judged those, kept what was right and finished the rest. No history was
rewritten; `THIRD_PARTY_NOTICES.md` is untouched (`Cargo.lock` did not change).
| Commit | What | Whose |
|---|---|---|
| `e465a55` | Item 2: the fallback gateway test keeps its "closed" port bound | cut-off run, kept |
| `ac957a0` | Item 1: the history test of `gateway.rs` waits for the `-wal` file before it reopens (`tests/common/mod.rs`) | cut-off run, kept |
| `35408a3` | Item 5: the portal proxy test requires `1 passed` of its child | cut-off run, kept |
| `7e63092` | Item 4: `from_json`'s doc names voelin-core (voelin-store parses the text too: `keystore.rs` `check_teamspeak` and `level`, `store.rs` `list`) | cut-off run, kept |
| `0bc6aba` | Item 3: the account-change test names the step it timed out in | this attempt |
| `f9bfd5d` | Item 6: `rectangle_span` checks the pattern's structure | cut-off run's tree, committed |
| `25be433` | Item 6: the preview test checks its rates against its own timing | cut-off run's tree, committed |
| `81c40a4` | Item 6: `audio_sources_change_live` | cut-off run's tree, committed |
| `c5bb74f` | Item 6: the server-features test asks one question at a time | cut-off run's tree, committed |
| `7730460` | Item 6: the layer-format test waits for the stream task's answer | cut-off run's tree, committed |
| `9d04e01` | Item 6: the studio compose test waits for the frame it asks for | cut-off run's tree, committed |
| `92d02b0` | Beyond the list: the studio capture-backend test waits for the delivered count | cut-off run's tree, committed |
| `661a607` | Beyond the list: the scope test and `streamer_sends_opus` | cut-off run's tree, committed |
| `069fd2a` | Item 7: `ts6_banners` runs with the TeamSpeak 6 server to itself | cut-off run's tree, committed |
| `5c029a9` | Item 7: the smoke's `roundtrip` waits for its listener | cut-off run's tree, committed |
| `94195db` | rustfmt of four spots of the commits above | this attempt |
| `f508e5b` | Beyond the list: the automatic-bitrate test counts frames | this attempt |
| `ad80660` | The smoke script says which of its checks still flake | this attempt |
| `d4ccb8c`, `376925a` | `docs/testing/load.md` and the pointer in `docs/ci.md`; the record of the round, with the table of the checks | this attempt |
Two hunks of the cut-off run's tree were dropped: the timing instrumentation of
the account-change test (`Instant`s and an `eprintln!` of the steps, replaced
by the named `expect`s of `0bc6aba`; its numbers are below) and a
`#[cfg(test)] FIRST_SNAPSHOT` of 5 s in `ts_session` (it keeps the lib tests
from running the 250 ms the engine really has; see "Seen and left alone"). The
commits "beyond the list" are fixes of tests that failed in this round's own
runs, each in a commit of its own, and can be dropped without touching the
others.
What ran, on the final tree (the dev shell `dev rust-nightly -p cmake -p clang
-p pkg-config -p jq -p alsa-lib -p openssl -p libvpx -p dav1d -p pipewire -p
fontconfig -p freetype -p libxkbcommon -p expat -p dbus -p procps -p gnumake`
with the pinned 1.94 or the nightly of 2026-10-21 in front of `PATH`, and
`LIBCLANG_PATH`):
| Check | Result |
|---|---|
| `cargo fmt $(scripts/own-crates.sh) -- --check`, `cargo clippy $(scripts/own-crates.sh) --all-targets --locked --no-deps -- -D warnings` | 1.94: clean at the head |
| The same on nightly | clippy is blocked at sites of the baseline (none in a line of this branch): `chunks_exact_to_as_chunks` (voelin-core `audio.rs` and `media.rs:4057`, voelin-media), `manual_checked_ops`, `unnecessary_sort_by` (voelin-media), `result_large_err` (`ts/voice.rs:476`); with those four allowed the three touched crates are clean with all targets. voelin-platform is clean. `rustfmt` differs at `history.rs`, `ffmpeg/encoder.rs`, `discovery.rs`, `chat.rs` and `voelinctl/src/engine.rs`, none changed here |
| Clippy alone, at each of the 16 commits above that touch Rust, checked out detached | 1.94, `voelin-core`, `voelin-media`, `voelin-platform`, all targets, `media-desktop`: clean at each. `rustfmt` was not clean at seven commits from `c5bb74f` to `069fd2a` (the commits that wrote the four spots `94195db` formats, and the shell-only `5c029a9` that sits on that tree); per-commit rustfmt waived by the orchestrator, fixed forward, no history rewrite |
| `cargo test -p voelin-core -p voelin-platform -p voelin-media --locked --no-fail-fast`, ten times in a row | 516 tests passed and 13 ignored in each of ten runs, 33 test binaries each; load average 89 to 29 from other jobs |
| The same with `--features voelin-core/media-desktop` (the tests of this round's `media` fixes only exist there; `cargo test --workspace` has it on through `voelin-ui`) | 551 passed and 14 ignored in each of ten runs; load average 21 to 25 |
| `cargo check --workspace --all-targets --locked` | passes (1.94) |
| The tests of the tables below, 100 runs each of the binary of `2ffe5ff` and of the final tree, and the whole lib binaries | The tables below |
| `scripts/it-smoke.sh ts3 ts6` | Below, "The live smoke" |
## Making the machine busy
The recipe of that round: 32 busy loops beside the run (the machine had 32
threads), and the test binary started many times, a few at a time, so that
the tests of one binary also meet each other's load:
```sh
# 1. Build the test binaries once and note their paths (the "executable" of
# the lib and of each integration test); run those, not `cargo test`.
cargo test -p voelin-core --features media-desktop --lib --no-run --message-format=json
# 2. The busy loops, and 300 runs of one test, 8 at a time. (The
# whole binary, without --exact, is the better test of "under full
# load": every test of it runs at once.)
for _ in $(seq 32); do sh -c 'while :; do :; done' & done
trap 'kill $(jobs -p)' EXIT
seq 300 | xargs -P 8 -I{} sh -c '<executable> --exact <test> >/dev/null 2>&1 || echo FAIL' | sort | uniq -c
```
Compare a binary built before a change with one built after it, started
alternately in the same loop, so that both meet the same load. Write the load
average (`/proc/loadavg`) down with the result: other jobs on the shared
machine took it from the 32 loops' 32 to over 100 and, for minutes, to 250,
and some tests fail only above 150 (see below). A failure rate of one in a
hundred tests needs a few hundred runs to show; the whole binary shows its
flaky tests faster than each test alone, since its 275 tests compete.
## What the fixes assert
The rules the fixes of this round followed, in the order of preference:
1. **Wait for the state or event the test is about.** A deadline only ends a
hang (30 s), it never decides the result. A pause (`sleep`) is never what a
test waits for, and a "nothing happened" check waits for something that
comes after it (a command the same task answers in order, a count of
frames), not for time to pass.
2. **Derive a time from the work.** Where a rate is checked, the bounds come
from timestamps taken by the test around the calls, not from a constant.
3. **Check structure, not values within a tolerance**, where a lossy or
adaptive component is involved: an encoder that falls behind lowers its
quality, and a tolerance only moves the load at which the test fails.
4. **Keep what you reserved.** A port that is "free" because a listener was
bound and dropped can be handed to another test of the process at once;
a socket that stays bound and never listens refuses connections for the
whole test.
5. **A test that changes the state of a shared server runs with the server to
itself** (a lock in the test binary), however the harness schedules it.
## The load-only tests of the round
100 runs of each test alone, the binary of the commit before the round
(`2ffe5ff`) and the one after it, started alternately 8 at a time beside 32
busy loops (load average 34 to 81 during the runs), and 150 / 100 runs of the
whole lib binaries of `voelin-core` / `voelin-media`, 4 at a time beside the
same loops (load average 69 to 123). Failed runs, of the runs:
| Test | Why it failed | It checks now | Alone, before / after | Notes |
|---|---|---|---|---|
| `media::tests::local_preview_decodes_the_pattern`, `stream::tests::test_pattern_through_stream_tasks` (`media::rectangle_span`) | The VP8 speed control lowers the quality when the encoder falls behind; flat colours moved by 30 and more per channel and failed the tolerance of 24 (one of 40 was tried and reverted) | Each pixel is the nearer of the pattern's two colours; the middle row is background, one run of the rectangle, background; the span's width and movement as before. The preview's `fps` and `bitrate` are the counters' change over the time between the two stats calls, which the test timed | 1 / 0 and 1 / 0 of 100 | In the whole lib binary, before: 6 and 4 failures in 150 runs; after: 0 |
| `media::tests::audio_sources_change_live` | The state, mix and limiter were asserted when the meters showed, not waited for; the microphone thread published for one second, which a busy machine delayed past | Waits for the state, the mix and the limiter with the meters; the microphone is fed until the test has heard it | 0 / 0 of 100 | In the whole lib binary, before: 2 failures in 150 runs |
| `link::tests::the_features_of_a_server_are_the_hosts_narrowed_by_the_servers_list` | The file list was asked for every 20 ms and the answers fell behind the 16 events of the bus | One question at a time, the next after the answer (`ask_files_until`) | 0 / 0 of 100 | In the whole lib binary, before: 1 failure in 150 runs |
| `stream::tests::layer_formats_reach_the_live_stream` | "Nothing changed" was a 200 ms sleep, short of the stream task on a busy machine | A command the task answers with an event, sent after the format, and waited for: the task takes its commands in order | 0 / 0 of 100 | The "late streamer-side keyframe request" of the runner round was never seen and is not proven; a request the viewer's side makes late is not covered |
| `studio::tests::it_composes_into_the_preview_and_follows_commands` | The first frame after `SetPreview` can be one composed at the studio's start size (480x270) before the command applied | `preview_until`: the first frame of the size and scene asked for, out of at most 20 | 0 / 0 of 100 | In the whole lib binary of `voelin-media`, before: 0 of 100 runs; seen 2 in 150 earlier in the round |
| `gateway.rs`: `the_next_published_gateway_is_used_when_one_fails` | The "closed" port was bound and dropped; another test of the binary could be given it | A socket kept bound without listening, checked to refuse | 0 / 0 of 100 | |
| `gateway.rs`: `history_on_open_paging_and_offline_messages` | Dropping an `Engine` does not close its database; reopening waited 5 s for the exclusive lock of the closing connection (`DatabaseBusy`) | Waits for the `-wal` file to go (`tests/common/mod.rs`, shared with `voice_features.rs`) | 0 / 0 of 100 | The same as `contacts_are_kept_in_the_database`, fixed in `0d67dd7`. Beside the busy loops it did not fail; with every fsync of the process delayed by 6 s (`strace -f -qq -e trace=fsync,fdatasync -e inject=fsync,fdatasync:delay_enter=6s`) the old test fails every time at the reopen with `DatabaseBusy` (`gateway.rs:536`), the new one passes |
| `voelin-platform` `proxy.rs`: `the_portal_names_the_proxy` | A child that ran no test (its `--exact` name matches none) exits 0 | The wrapper requires `test result: ok. 1 passed;` in the child's output | 0 / 0 of 100 | |
Found by the same runs, beyond the list, and fixed in their own commits:
| Test | Why it failed | It checks now | Alone, before / after | Notes |
|---|---|---|---|---|
| `studio::tests::packets_reach_the_outputs_and_the_studio_is_a_capture_backend` | The studio counts a frame as delivered after handing it over, so the count could still be 0 | Waits for the count | 2 / 0 of 100 | Whole `voelin-media` binary, before: 11 of 150 runs (9 of them this test), then 2 of 100; after: 0 of 100 |
| `link::tests::a_scope_bigger_than_the_channel_is_sent_in_bigger_chunks` | 5,000 channels were made after the connector's 250 ms wait for a first snapshot began; the scope was sent before the presence was in | The channels are made first; a voice packet through the link shows the presence is in | 0 / 0 of 100 | 3 failures of about 500 whole-binary runs before, 7 of 300 at a load average of 150 to 250 with the first half of the fix only (the channels first, no voice packet); too rare to count a rate after |
| `media::tests::streamer_sends_opus` | Ten frames of audio came before the first frame of video, which a busy machine delays | Waits for ten of audio and one of video | 0 / 0 of 100 | 2 failures of about 500 whole-binary runs before |
| `media::tests::an_automatic_bitrate_follows_the_stream` | The sink is told the format at `attach` and again by the encoder before its first frame; the test counted in between after a 200 ms pause | Counts after a frame has come and compares after five more | 2 of 900 before; 0 of 600 after | 1 of 150 in the final whole-binary run of the old test |
The whole `voelin-core` lib binary failed 12 of 150 runs before and 1 of 150
after (the last test of the table, fixed since), the `voelin-media` binary 2
of 100 before and 0 of 100 after.
## `ts::voice::account_tests::account_change_cancels_pending_handshake`
Seen once in about 130 runs of the whole suite under load by the review of the
seam follow-ups; the failure was not kept. It did not fail again in this round
(it does not touch the test's code or the code it drives), neither alone nor
in the whole lib binary:
- 600 runs alone, 8 at a time beside 32 busy loops (300 of the unchanged
binary, 300 of the timed one): 600 passed; 100 more before and 100 after
in the table above, 200 passed.
- It is in each whole-binary run of `voelin-core`: about 1,300 runs under
the busy loops in this round (150 of them of the final tree), in none of
which it failed (load average up to 250), and in the ten full runs of
`cargo test -p voelin-core -p voelin-platform -p voelin-media` of each kind
(with and without `media-desktop`) of the final tree.
- The test, timed (a throw-away build): the first handshake packet after
12.5 ms (median; 34 ms at most), the packet of the new socket after an
account change 6.9 ms (33 ms at most), the end of the connection after the
account source closed 0.2 ms (9 ms at most), in the 300 runs beside the 32
loops. Its deadlines are 5 s, 5 s and 2 s: 60 times or more the longest
step seen.
The test and the code were read for a race and none was found: the account
watch has seen its version before the connection is made, so a change after
the first packet always restarts the connection; the restart opens a socket of
its own, so a packet from another port is the new connection's; and dropping
the sender makes `changed()` fail, which ends the loop with the reason the test
expects. The only ways the test can fail are its three deadlines. That is the
evidence for "only load": a failure needs a stall of seconds in one step, and
the machine's, not the test's, is the likelier source. The three timeouts now
say which step it was, so the next failure is attributable; if it is seen
again, keep the output and the load average (`/proc/loadavg`) and see which
of the three it names.
## Seen and left alone
These failed in the runs of an intermediate tree of this round at load
averages of 150 to 250 (other jobs on the machine as well as the 32 loops),
and not in the runs of the final tree at 35 to 120. None of them is among the
tests this round changed.
- `link::tests::the_welcome_names_the_host_the_user_and_what_the_link_can_do`:
the test tells the connection that it is connected and, in the next
statement, gives it the snapshot; the session waits 250 ms for the snapshot
(`FIRST_SNAPSHOT` in `ts_session`), and at a load average of 250 the gap was
longer: the welcome had the user made up from the uid. Raising that constant
in test builds was tried and dropped: it stops the lib tests from running the
250 ms the engine really has.
- `link::tests::what_the_link_reports_comes_back_as_events` (3 of 300 runs of
the whole lib binary), `link::tests::the_stream_tasks_reports_are_not_held_for_ever`
(2 of 300) and `stream::tests::layers_through_stream_tasks` (3 of 500): timing
of reports against the machine, not looked into further. None failed in the
500 runs of the tree before the round, which ran at load averages up to 150.
- `media::tests::undecodable_video_is_noticed_through_the_pipeline` (1 of 100
runs of the whole `voelin-core` lib binary of the final tree, four at a time
beside 32 busy loops, load average 106 to 146; the review's run):
`DecodeWatch` called a real VP8 stream undecodable because no picture was
decoded within 400 ms and 10 frames. Untouched by this round; it did not fail
in 150 before or 150 after runs of the interleaved A/B.
`stream::tests::layers_through_stream_tasks` failed again in the same 100.
## The live smoke (`scripts/it-smoke.sh`)
The engine stage (`voelin-core`'s `tests/live.rs`, with `stream_live` and
`media_live`) failed on `disabled policy must prevent HTTP requests`
(`ts6_banners`) in every run that reached it, while the six tests passed
one after the other. The cause was the test: it sets the TeamSpeak 6 server's
banners and counts the requests that reach its own HTTP server for them, and
the other tests of the file, which cargo runs side by side, connect engines to
the same server; the server tells each of them the banners' addresses and an
engine fetches what it is told, so their requests were counted. With the tests
in pairs against the development servers: `ts6_banners` alone passes (62 s),
with `ts6_avatars`, `ts6_engine` or `ts6_channel_joins` it fails. It is not
the engine (it should fetch what the server announces) and not the order of the
script's stages (the tests of one binary run side by side whatever the stage
before). The tests that connect to the TeamSpeak 6 server now hold a lock of
the binary shared, and `ts6_banners` holds it exclusively.
Before the change, on `2ffe5ff`'s tests and script (the TeamSpeak 3 and 6
dev servers of `dev/docker-compose.yml`, as a compose project of their own):
the `live` binary failed `ts6_banners` in each run that reached it, with the
six tests side by side (5 passed, 1 failed); the smoke
stopped at `FAIL: private message: the action failed` in its TeamSpeak 3 stage
(`the client is not on the server`) and, in its TeamSpeak 6 stage, at
`FAIL: gateway request {"config_set":...} was not answered`. After it, at the
head of the branch: `scripts/it-smoke.sh ts3 ts6`, three times in a row, the
`live` binary passing 6 of 6 (66 s) in each run that reached the engine stage:
two runs passed every stage (`all smoke tests passed`), one failed in its
TeamSpeak 6 stage at `FAIL: the directory did not list the stream`, below.
What the smoke still does not do reliably, and was not changed for:
- Each step that starts a background client and then a second one
(`roundtrip`) used to wait a fixed 3 s; a dev server that takes 4 s to
13 s to let a client in made the action run before the listener was on the
server (`the client is not on the server`). It now waits for the listener's
`connected:` line. The server's own slowness is not removed.
- The stream directory check (step 10, TeamSpeak 6): the late viewer ends as
soon as it has 30 frames, and the `"title"` line the script looks for is
printed only if the viewer's own gateway session had connected and been
told of the directory by then. In the run that failed it had not (the
viewer's state stayed `observe=Connecting`): the stream was watched, 30
frames came, and the stream was listed through TeamSpeak 6's own listing
(`streams: ...`), which says nothing about the gateway's directory. A fix is
in `voelinctl engine` (end the viewer when it has both) and was left out of a
round about tests.
- The gateway stage (`voelinctl gateway --engine`, step 8) has failed in a run
with `expected output did not appear` while the engine was still
`observe=Connecting`, before the change as well. That may be the same wait
for a gateway session; it was not looked into.
- `ts6_banners` alone takes 62 s, so the engine stage takes more than a
minute longer than the sum of the others.
+18 -1
View File
@@ -7,6 +7,11 @@
# docker buildx). Extra arguments go to `docker build`, e.g.
# scripts/docker-build.sh android --build-arg ABIS=arm64-v8a
#
# The workspace depends on the private VoelinProtocol repository, which the
# build fetches over SSH with your ssh-agent (`docker build --ssh default`):
# the agent must hold a key that can read it (docs/building.md, "Depending on
# VoelinProtocol"). The key stays in the agent, never in the image.
#
# Behind an HTTPS proxy, HTTPS_PROXY/HTTP_PROXY/NO_PROXY are passed on to the
# build; a proxy on this machine's loopback is reached with host networking.
# If the proxy inspects TLS, point BUILD_CA_CERT at its CA certificate (PEM):
@@ -23,7 +28,19 @@ case "$platform" in
*) echo "usage: $0 [linux|windows|android|all] [docker build args…]" >&2; exit 2 ;;
esac
args=()
# The build's cargo needs VoelinProtocol; fail here, not after the toolchain
# stage, when the agent is missing or empty.
if ! ssh-add -l > /dev/null 2>&1; then
cat >&2 <<'MSG'
docker-build.sh: no ssh-agent with a key that can read Voelin/VoelinProtocol.
Start one and add the key, then run this again:
eval "$(ssh-agent -s)" && ssh-add ~/.ssh/<key>
docs/building.md ("Depending on VoelinProtocol") has the details.
MSG
exit 1
fi
args=(--ssh default)
for var in HTTPS_PROXY https_proxy HTTP_PROXY http_proxy NO_PROXY no_proxy; do
if [[ -n ${!var:-} ]]; then
args+=(--build-arg "$var=${!var}")
+31 -2
View File
@@ -379,6 +379,19 @@ features_check() {
# TeamSpeak 6: an engine session streams; its stream registers in the
# gateway's directory; a viewer that connects later finds it and watches it.
#
# Known to flake, not fixed: voelinctl engine ends the viewer as soon as it has
# the 30 frames (--expect-frames), and the `"title":"..."` line this checks is
# printed only when the viewer's own gateway session got connected and told
# of the directory before that. When the gateway session is still
# `observe=Connecting` at the 30th frame (seen once in three runs of the
# smoke, with the stream watched and the stream listed through TeamSpeak 6's
# own listing, `streams: ...`), the check fails with "the directory did not
# list the stream". The config_set of the gateway stage once failed ("expected
# output did not appear") with its engine still `observe=Connecting` too;
# that was not looked into. A fix for this one
# belongs in voelinctl (end the viewer on both), not here; see
# docs/testing/load.md.
directory_check() {
local svc=$1 addr=$2 url=$3 user=$4 streamer="dir-$$-$RANDOM" title="directory-$RANDOM"
local out="$STATE_DIR/directory-stream.log" viewer_out="$STATE_DIR/directory-watch.log"
@@ -413,12 +426,22 @@ server_uid() {
"$VOELINCTL" identity show --identity "$id" | awk -v f="$field:" '$1 == f { print $2 }'
}
# Run a background listener, then the action; both must succeed.
# Run a background listener, then the action; both must succeed. The action
# starts once the listener says it is on the server ("connected: N clients",
# which voelinctl engine prints for every action): a fixed pause of 3 s sent
# the poke, the private message or the avatar request to a client that was not
# on the server yet whenever the dev server was slow to let one in ("the
# client is not on the server"; a loaded dev server takes 4 to 13 s).
roundtrip() {
local what=$1 listen_log=$2 listener_cmd=$3 action_cmd=$4
eval "$listener_cmd" >"$listen_log" 2>&1 &
local listener=$!
sleep 3
for _ in $(seq 1 240); do
grep -q '^connected:' "$listen_log" 2>/dev/null && break
kill -0 "$listener" 2>/dev/null || break
sleep 0.25
done
sleep 1
if ! eval "$action_cmd" >"$STATE_DIR/action.log" 2>&1; then
cat "$STATE_DIR/action.log" "$listen_log"
fail "$what: the action failed"
@@ -536,6 +559,12 @@ done
log "TeamSpeak session (voelin-core ts_session) against both servers: link conformance subset, chat, refused moves, poke, voice, files"
VOELIN_LIVE=1 cargo test --quiet -p voelin-core --lib ts_session::live_tests -- --test-threads=1 2>&1 | grep -E "test result|panicked|timed out" || fail "TeamSpeak session tests failed"
# The engine tests of one binary run side by side and share the TeamSpeak 6
# server: ts6_banners sets the server's banners, which every other engine that
# connects meanwhile fetches, so crates/voelin-core/tests/live.rs lets it run
# alone (a lock the TS6 tests hold, ts6_banners exclusively). It used to fail
# on `disabled policy must prevent HTTP requests` in every run of this stage.
# Not run with --test-threads=1: that hid the problem, it did not remove it.
log "engine (voelin-core) against both servers, media pipeline through TS6"
VOELIN_LIVE=1 cargo test --quiet -p voelin-core --features media-desktop --test live --test stream_live --test media_live 2>&1 | grep -E "test result|panicked|timed out" || fail "engine tests failed"