mirror of
https://github.com/esphome/esphome.git
synced 2026-08-22 22:26:21 +00:00
Make timing total the sum of its named windows
This commit is contained in:
+3
-3
@@ -542,11 +542,11 @@ def perform_ota(
|
||||
raise _committed_error(err) from err
|
||||
commit_duration = time.perf_counter() - commit_start
|
||||
|
||||
# Spans the binary size send through the commit ack; connect, handshake,
|
||||
# and auth are not included
|
||||
# Sum of the named windows so the breakdown is self consistent; connect,
|
||||
# handshake, auth, and the one MD5 round trip are not included
|
||||
_LOGGER.info(
|
||||
"Update took %.2f seconds (prepare %.2f, upload %.2f, commit %.2f)",
|
||||
time.perf_counter() - prepare_start,
|
||||
prepare_duration + duration + commit_duration,
|
||||
prepare_duration,
|
||||
duration,
|
||||
commit_duration,
|
||||
|
||||
@@ -392,9 +392,9 @@ def test_perform_ota_no_auth(
|
||||
|
||||
mock_socket.recv.side_effect = recv_responses
|
||||
|
||||
# Distinct window lengths pin each duration to its label; exactly the 7
|
||||
# Distinct window lengths pin each duration to its label; exactly the 6
|
||||
# expected perf_counter calls, so an unaccounted timing window raises
|
||||
timings = [0.0, 2.0, 10.0, 15.0, 20.0, 27.0, 30.0]
|
||||
timings = [0.0, 2.0, 10.0, 15.0, 20.0, 27.0]
|
||||
with (
|
||||
patch("time.perf_counter", side_effect=timings),
|
||||
caplog.at_level(logging.INFO),
|
||||
@@ -413,7 +413,7 @@ def test_perform_ota_no_auth(
|
||||
# pin each duration to its label
|
||||
assert "Preparing for upload took 2.00 seconds" in caplog.text
|
||||
assert (
|
||||
"Update took 30.00 seconds (prepare 2.00, upload 5.00, commit 7.00)"
|
||||
"Update took 14.00 seconds (prepare 2.00, upload 5.00, commit 7.00)"
|
||||
in caplog.text
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user