Skip to content

Commit 8b7e701

Browse files
committed
fix(tests/startup): measure test time from spawn instead of start
The process startup time is included in spawn, not start. Measuring the time it takes to start is incorrect. However, let's keep the API calls in the measurement as this is used as an upper bound to validate the reported startup time is meaningful. Also, remove the 400ms sleep as start already waits for the vm to be up. Signed-off-by: Riccardo Mancini <mancio@amazon.com>
1 parent a8f5d78 commit 8b7e701

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/integration_tests/performance/test_process_startup_time.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,17 @@ def test_startup_time_custom_seccomp(
4444

4545

4646
def _test_startup_time(microvm, metrics, test_suffix: str):
47+
test_start_time = time.time()
4748
microvm.spawn()
4849
microvm.basic_config(vcpu_count=2, mem_size_mib=1024)
4950
metrics.set_dimensions(
5051
{**microvm.dimensions, "performance_test": f"test_startup_time_{test_suffix}"}
5152
)
52-
test_start_time = time.time()
5353
microvm.start()
54-
time.sleep(0.4)
54+
datapoints = microvm.get_all_metrics()
5555

56-
# The metrics should be at index 1.
56+
# The metrics should be at index 0.
5757
# Since metrics are flushed at InstanceStart, the first line will suffice.
58-
datapoints = microvm.get_all_metrics()
5958
test_end_time = time.time()
6059
fc_metrics = datapoints[0]
6160
startup_time_us = fc_metrics["api_server"]["process_startup_time_us"]
@@ -68,7 +67,7 @@ def _test_startup_time(microvm, metrics, test_suffix: str):
6867
)
6968

7069
assert cpu_startup_time_us > 0
71-
# Check that startup time is not a huge value
70+
# Check that startup time is not a huge value (overflow)
7271
# This is to catch issues like the ones introduced in PR
7372
# https://github.com/firecracker-microvm/firecracker/pull/4305
7473
test_time_delta_us = (test_end_time - test_start_time) * 1000 * 1000

0 commit comments

Comments
 (0)