diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2a4a6dd..16063ae 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -174,12 +174,8 @@ jobs: cd sfunnel/test/cni/ make VERBOSE=1 _check_perf - #Create the markdown report (TODO improve txt) - echo "# Performance report" >> $GITHUB_STEP_SUMMARY - echo "CNI: ${CNI}" >> $GITHUB_STEP_SUMMARY - echo "Number of nodes: ${NODES}" >> $GITHUB_STEP_SUMMARY - echo "## Results" >> $GITHUB_STEP_SUMMARY - cat .last_perf_report.txt >> $GITHUB_STEP_SUMMARY + #Create the markdown report + python3 perf/gen_report.py >> $GITHUB_STEP_SUMMARY docker_build_test_publish: needs: [check_unit, check_cni_example] diff --git a/test/cni/Makefile b/test/cni/Makefile index b295be3..ee18eac 100644 --- a/test/cni/Makefile +++ b/test/cni/Makefile @@ -113,11 +113,12 @@ _check_perf: _wait_up _wait_running $(QUIET) echo "Workaround lingering old conntrack (metallb/kubeproxy bug?)..." $(QUIET) for NODE in $$(minikube node list | awk '{print $$1}'); do minikube ssh -n $${NODE} "sudo conntrack -F"; done; $(QUIET) echo "Launching iperf tests..." - $(QUIET) python3 perf/gen_report.py + DEBUG=1 NETNS=client python3 perf/check_perf.py $(QUIET) echo "Unloading NDEBUG sfunnel in NS..." $(QUIET) $(MAKE) _unload $(QUIET) echo "Loading DEBUG sfunnel in NS..." $(QUIET) $(MAKE) _load $(QUIET) echo "Restoring nginx..." $(QUIET) $(MAKE) _deploy - DEBUG=1 NETNS=client python3 perf/check_perf.py + $(QUIET) echo "Print report..." + $(QUIET) python3 perf/gen_report.py diff --git a/test/cni/perf/gen_report.py b/test/cni/perf/gen_report.py index 98e960f..8296ec7 100644 --- a/test/cni/perf/gen_report.py +++ b/test/cni/perf/gen_report.py @@ -1,19 +1,33 @@ import re import json import platform +import os with open('.last_perf_report.json', 'r') as file: data = json.load(file) -md_report = "# Test reports\n" +md_report = "# Performance report\n" +md_report += f"\n" + +md_report += f"## General information \n" +md_report += f"\n" +md_report += f"Number of K8s nodes: {os.getenv('NODES', 'unknown')}\n" +md_report += f"CNI: {os.getenv('CNI', 'unknown')}\n" +md_report += f"\n" + +md_report += f"## Runner info\n" +md_report += f"\n" +md_report += f"Architecture: {platform.machine()}\n" md_report += f"Architecture: {platform.machine()}\n" md_report += f"Kernel: {platform.release()}\n" md_report += f"OS: {platform.system()}\n" md_report += f"Hostname: {platform.node()}\n" md_report += f"\n" +md_report += f"## Results\n" +md_report += f"\n" for key, elem in data.items(): - md_report += f"## Test: {key}\n" + md_report += f"### Fixture: {key}\n" md_report += f"\n" md_report += f"Number of workers: {elem['number_of_workers']}\n" md_report += f"\n"