diff --git a/tests/test_client_mss.sh b/tests/test_client_mss.sh index fddd5c1..8f8a09e 100644 --- a/tests/test_client_mss.sh +++ b/tests/test_client_mss.sh @@ -41,9 +41,17 @@ echo "Telemt client_mss tests" assert_eq "out-of-the-box default CLIENT_MSS is empty" "" "$CLIENT_MSS" # 2. Config generation when CLIENT_MSS is empty (off) +# generate_telemt_config writes the TOML to a destination path — it does not print it. +# Capturing its stdout (as this test used to) yields an empty string, so `grep` on it +# found nothing and every assertion below was decided by that emptiness rather than by +# the generated config. The file-exists assertion exists so that if generation ever +# breaks, this test fails outright instead of passing vacuously again. CLIENT_MSS="" -cfg=$(generate_telemt_config) -if echo "$cfg" | grep -q 'client_mss'; then +dest_off="$TEST_TMPDIR/config-off.toml" +generate_telemt_config "$dest_off" >/dev/null 2>&1 +assert_eq "config is written when client_mss is off" "written" \ + "$([ -f "$dest_off" ] && echo written || echo missing)" +if grep -q 'client_mss' "$dest_off" 2>/dev/null; then assert_eq "client_mss omitted when off" "absent" "present" else assert_eq "client_mss omitted when off" "absent" "absent" @@ -51,8 +59,11 @@ fi # 3. Config generation when CLIENT_MSS="tspu" CLIENT_MSS="tspu" -cfg=$(generate_telemt_config) -if echo "$cfg" | grep -q 'client_mss = "tspu"'; then +dest_tspu="$TEST_TMPDIR/config-tspu.toml" +generate_telemt_config "$dest_tspu" >/dev/null 2>&1 +assert_eq "config is written when client_mss is tspu" "written" \ + "$([ -f "$dest_tspu" ] && echo written || echo missing)" +if grep -q 'client_mss = "tspu"' "$dest_tspu" 2>/dev/null; then assert_eq "client_mss emitted when set to tspu" "present" "present" else assert_eq "client_mss emitted when set to tspu" "present" "absent"