Files
firezone/scripts/tests/download.sh
Thomas Eizinger ce297999c9 feat(gateway): capture domain name of flow (#10692)
Whenever we route a packet from the Client to a DNS resource, we now
also capture the domain name. If this is the first packet and we are
thus creating a new flow, we'll save that domain in it. Later packets
for the same IP are rolled up under the same flow and thus don't need to
re-set the domain.

Resolves: #10691
2025-10-23 04:25:37 +00:00

31 lines
835 B
Bash
Executable File

#!/usr/bin/env bash
source "./scripts/tests/lib.sh"
client sh -c "curl --fail --max-time 5 --output download.file http://download.httpbin/bytes?num=10000000" &
DOWNLOAD_PID=$!
wait $DOWNLOAD_PID || {
echo "Download process failed"
exit 1
}
known_checksum="f5e02aa71e67f41d79023a128ca35bad86cf7b6656967bfe0884b3a3c4325eaf"
computed_checksum=$(client sha256sum download.file | awk '{ print $1 }')
if [[ "$computed_checksum" != "$known_checksum" ]]; then
echo "Checksum of downloaded file does not match"
exit 1
fi
sleep 3
readarray -t flows < <(get_flow_logs "tcp")
assert_eq "${#flows[@]}" 1
flow="${flows[0]}"
assert_eq "$(get_flow_field "$flow" "inner_dst_ip")" "172.21.0.101"
assert_eq "$(get_flow_field "$flow" "inner_domain")" "download.httpbin"
assert_gteq "$(get_flow_field "$flow" "rx_bytes")" 10000000