Files
firezone/scripts/tests/download-concurrent.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

43 lines
973 B
Bash
Executable File

#!/usr/bin/env bash
source "./scripts/tests/lib.sh"
client sh -c "curl --fail --max-time 10 --output /tmp/download1.file http://download.httpbin/bytes?num=5000000" &
PID1=$!
client sh -c "curl --fail --max-time 10 --output /tmp/download2.file http://download.httpbin/bytes?num=5000000" &
PID2=$!
client sh -c "curl --fail --max-time 10 --output /tmp/download3.file http://download.httpbin/bytes?num=5000000" &
PID3=$!
wait $PID1 || {
echo "Download 1 failed"
exit 1
}
wait $PID2 || {
echo "Download 2 failed"
exit 1
}
wait $PID3 || {
echo "Download 3 failed"
exit 1
}
sleep 3
readarray -t flows < <(get_flow_logs "tcp")
assert_gteq "${#flows[@]}" 3
rx_bytes=0
for flow in "${flows[@]}"; do
assert_eq "$(get_flow_field "$flow" "inner_dst_ip")" "172.21.0.101"
assert_eq "$(get_flow_field "$flow" "inner_domain")" "download.httpbin"
rx_bytes+="$(get_flow_field "$flow" "rx_bytes")"
done
assert_gteq "$rx_bytes" $((3 * 5000000))