Skip to content

Commit 8a001f8

Browse files
committed
chore(test): wait for mender-connect to exit before restarting in set_limits
The set_limits() helper kills mender-connect and immediately starts a new instance without waiting for the old process to exit. This creates a race condition: the old process may still be running (and its WebSocket still registered as "connected" in deviceconnect) when the new one starts. wait_for_connect() can then pass on the stale "connected" state from the old connection, and the subsequent file transfer request hits an inconsistent state timing out with HTTP 408. Signed-off-by: pasinskim <marcin.pasinski@northern.tech>
1 parent 1f5bdbf commit 8a001f8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

tests/tests/test_filetransfer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ def set_limits(docker_env, mender_device, limits, auth, devid):
107107
)
108108
finally:
109109
shutil.rmtree(tmpdir)
110-
mender_device.run("kill -TERM `pidof %s`" % connect_service_name)
110+
mender_device.run(
111+
"kill -TERM `pidof %s` 2>/dev/null; "
112+
"while pidof %s >/dev/null 2>&1; do sleep 0.1; done"
113+
% (connect_service_name, connect_service_name)
114+
)
111115
docker_env._docker_compose_cmd(
112116
"exec -d mender-client %s daemon" % connect_service_name
113117
)

0 commit comments

Comments
 (0)