Skip to content

Commit 6bc3cbd

Browse files
committed
feat: save network perf tests data
Save logs and json files for network perf tests. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
1 parent 6fbda9e commit 6bc3cbd

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

tests/integration_tests/performance/test_network_ab.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"""Tests the network latency of a Firecracker guest."""
44

55
import re
6+
import json
7+
from pathlib import Path
68

79
import pytest
810

@@ -55,7 +57,7 @@ def network_microvm(request, microvm_factory, guest_kernel_acpi, rootfs):
5557

5658
@pytest.mark.nonci
5759
@pytest.mark.parametrize("network_microvm", [1], indirect=True)
58-
def test_network_latency(network_microvm, metrics):
60+
def test_network_latency(network_microvm, metrics, test_output_dir):
5961
"""
6062
Test network latency by sending pings from the guest to the host.
6163
"""
@@ -84,6 +86,11 @@ def test_network_latency(network_microvm, metrics):
8486
for sample in samples:
8587
metrics.put_metric("ping_latency", sample, "Milliseconds")
8688

89+
data = {"samples": samples}
90+
metrics_path = Path(test_output_dir / "metrics.json")
91+
with open(metrics_path, "w") as f:
92+
json.dump(data, f)
93+
8794

8895
@pytest.mark.nonci
8996
@pytest.mark.timeout(120)
@@ -95,6 +102,7 @@ def test_network_tcp_throughput(
95102
payload_length,
96103
mode,
97104
metrics,
105+
test_output_dir,
98106
):
99107
"""
100108
Iperf between guest and host in both directions for TCP workload.
@@ -133,4 +141,16 @@ def test_network_tcp_throughput(
133141
)
134142
data = test.run_test(network_microvm.vcpus_count + 2)
135143

144+
cpu_load_path = Path(test_output_dir / "cpu_load.json")
145+
with open(cpu_load_path, "w") as f:
146+
json.dump(data["cpu_load_raw"], f)
147+
for i, g2h in enumerate(data["g2h"]):
148+
path = Path(test_output_dir / f"g2h_{i}.json")
149+
with open(path, "w") as f:
150+
json.dump(g2h, f)
151+
for i, h2g in enumerate(data["h2g"]):
152+
path = Path(test_output_dir / f"h2g_{i}.json")
153+
with open(path, "w") as f:
154+
json.dump(h2g, f)
155+
136156
emit_iperf3_metrics(metrics, data, warmup_sec)

0 commit comments

Comments
 (0)