Collect netstat info while running tests

This commit is contained in:
Arthur Petukhovsky
2021-10-15 13:21:41 +03:00
parent 4ade0bb41c
commit 0907fe638d
2 changed files with 12 additions and 0 deletions

View File

@@ -241,6 +241,8 @@ jobs:
if << parameters.run_in_parallel >>; then
EXTRA_PARAMS="-n4 $EXTRA_PARAMS"
fi;
./netstat-script.sh &
NS_PID=$!
# Run the tests.
#
# The junit.xml file allows CircleCI to display more fine-grained test information
@@ -252,6 +254,8 @@ jobs:
# -s is not used to prevent pytest from capturing output, because tests are running
# in parallel and logs are mixed between different tests
pipenv run pytest --junitxml=$TEST_OUTPUT/junit.xml --tb=short --verbose -rA $TEST_SELECTION $EXTRA_PARAMS
kill $NS_PID
awk '/===/ {if (count) print count; print; count=0; next} {count++} END {print count}' $TEST_OUTPUT/netstat.stdout > $TEST_OUTPUT/netstat_stats.stdout
- run:
# CircleCI artifacts are preserved one file at a time, so skipping
# this step isn't a good idea. If you want to extract the

8
test_runner/netstat-script.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
while true; do
echo -n "==== CURRENT TIME:" >> /tmp/test_output/netstat.stdout
date +"%T.%N" >> /tmp/test_output/netstat.stdout
netstat -vpno | grep tcp | sort >> /tmp/test_output/netstat.stdout
sleep 0.5
done