From 0907fe638dc5590c0c8f47439626d7556e07261f Mon Sep 17 00:00:00 2001 From: Arthur Petukhovsky Date: Fri, 15 Oct 2021 13:21:41 +0300 Subject: [PATCH] Collect netstat info while running tests --- .circleci/config.yml | 4 ++++ test_runner/netstat-script.sh | 8 ++++++++ 2 files changed, 12 insertions(+) create mode 100755 test_runner/netstat-script.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index bd3564c71c..2f92095a83 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 diff --git a/test_runner/netstat-script.sh b/test_runner/netstat-script.sh new file mode 100755 index 0000000000..3a3f195975 --- /dev/null +++ b/test_runner/netstat-script.sh @@ -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