Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions tests/test_client_mss.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,29 @@ 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"
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"
Expand Down