Skip to content

fix(test): make the client_mss config assertions actually test something - #145

Open
rvalitov wants to merge 1 commit into
SamNet-dev:mainfrom
rvalitov:fix/client-mss-test
Open

rvalitov wants to merge 1 commit into
SamNet-dev:mainfrom
rvalitov:fix/client-mss-test

Conversation

@rvalitov

Copy link
Copy Markdown
Contributor

Fixes #144

Problem

generate_telemt_config() takes a destination path and writes the TOML there — it does not print it. This test captured its stdout instead:

cfg=$(generate_telemt_config)
if echo "$cfg" | grep -q 'client_mss = "tspu"'; then ...

cfg is therefore always empty, so both config assertions were decided by that emptiness rather than by the generated config:

  • "client_mss omitted when off" passed vacuously. grep found nothing in an empty string, so it reported absent regardless of what the product did — including when client_mss was emitted unconditionally.
  • "client_mss emitted when set to tspu" could never pass, on any platform.

Demonstrated

Against a product mutated to always emit client_mss = "tspu", this test produced byte-identical output to the unmutated product:

8 tests, 1 failures     <- mutated product
8 tests, 1 failures     <- unmutated product

It had no signal at all.

Fix

Write to a temp destination and grep that file. An explicit "config is written" assertion is included so that if generation ever fails, the test fails loudly instead of passing vacuously again.

Testing

  • Passes on Debian 12, Ubuntu 22.04/24.04, Alpine 3.20 and Fedora 41.
  • Now fails correctly under both mutations — emission removed, and emission made unconditional — where the old test caught neither.

Found by running the existing suite across a distro matrix; this was the one failure common to every platform, which is what pointed at the test rather than at the product.

generate_telemt_config() takes a destination path and writes the TOML
there — it does not print it. This test captured its stdout instead, so
`cfg` was always empty and both config assertions were decided by that
emptiness rather than by the generated config:

- "client_mss omitted when off" passed *vacuously*: grep found nothing in
  an empty string, so it reported "absent" no matter what the product
  did, including when client_mss was emitted unconditionally.
- "client_mss emitted when set to tspu" could never pass on any platform.

Demonstration: against a product mutated to always emit
`client_mss = "tspu"`, the old test produced byte-identical output to the
unmutated product (8 tests, 1 failure both times). It had no signal.

Write to a temp destination and grep that file, and add an explicit
"config is written" assertion so that if generation ever fails the test
fails loudly instead of passing vacuously again.

Verified: the repaired test passes on Debian 12, Ubuntu 22.04/24.04,
Alpine 3.20 and Fedora 41, and now fails correctly under both mutations
(emission removed, and emission made unconditional) where the old test
caught neither.
@rvalitov
rvalitov marked this pull request as ready for review September 17, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests/test_client_mss.sh never validates the generated config — both config assertions are decided by an empty string

1 participant