fix: se tshark from the container #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: E2E Tests | |
on: | |
push: | |
branches: | |
- master | |
concurrency: | |
group: e2e-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
e2e: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-20.04 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build Docker image | |
run: | | |
docker build -t tls-traffic-analyzer:latest --no-cache --build-arg BASE_IMAGE=$(echo ${{ matrix.os }} | sed s/-/:/) -f docker/Dockerfile . | |
- name: Start container | |
run: | | |
docker run \ | |
--privileged \ | |
-it --rm -d \ | |
-v $(pwd)/dumps:/dumps \ | |
--network host \ | |
--pid host \ | |
tls-traffic-analyzer:latest \ | |
-i $(ip -4 route | awk '/default/{print $5}') -o /dumps --chown-traffic-dumps $UID --commands curl --verbose | |
- name: Sleep and show logs | |
run: sleep 5 && docker logs $(docker ps -q) | |
- name: Run curl to www.google.com | |
run: curl -v -o /dev/null https://www.google.com | |
- name: Sleep and show logs | |
run: sleep 5 && docker logs $(docker ps -q) | |
- name: Save container logs | |
run: docker logs $(docker ps -q) > dumps/container.log | |
- name: List dumps directory | |
run: | | |
ls -lh dumps/ | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dumps-${{ github.run_id }} | |
path: dumps/ | |
retention-days: 5 | |
- name: Ensure at least one pcap file exists | |
run: | | |
if [ -z "$(find dumps -name '*.pcap' -print -quit)" ]; then | |
echo "No pcap files found" | |
exit 1 | |
fi | |
- name: Print stats.json | |
run: | | |
cat dumps/stats.json | jq | |
- name: Print pcap file | |
run: | | |
for file in dumps/*.pcap; do | |
echo "Dump file: $file" | |
docker exec -it $(docker ps -q) tshark -r /dumps/$file -V | |
done | |
- name: Stop container | |
run: | | |
docker stop $(docker ps -q) |