Skip to content

Commit 9dea122

Browse files
authored
Merge pull request #2415 from reubenmiller/issue-2087-restart-service
tests: use stop/start over restart for service to improve flaky system test
2 parents efd5d33 + bcdb01d commit 9dea122

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/RobotFramework/tests/configuration/lock_file.robot

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Check PID number in lock file
2828
Check PID number in lock file after restarting the services
2929
[Documentation] Include the new pid generated after service restart
3030
... inside the existing lock files under /run/lock/
31-
Restart Service tedge-agent
32-
Restart Service tedge-mapper-c8y
31+
Stop/Start Service tedge-agent
32+
Stop/Start Service tedge-mapper-c8y
3333
${pid_agent2}= Execute Command pgrep -f '^/usr/bin/tedge-agent' strip=True
3434
${pid_mapper2}= Execute Command pgrep -f '^/usr/bin/tedge-mapper c8y' strip=${True}
3535
${pid_agent_lock2}= Execute Command cat /run/lock/tedge-agent.lock
@@ -61,3 +61,13 @@ Switch off lock file creation
6161
#Check that no lock file is created
6262
File Should Not Exist /run/lock/tedge-agent.lock
6363
File Should Not Exist /run/lock/tedge-mapper-c8y.lock
64+
65+
*** Keywords ***
66+
67+
Stop/Start Service
68+
[Arguments] ${name}
69+
# Note: Use stop/start service rather than restart as 'systemctl restart <service>'
70+
# does not wait for all file descriptors to be flushed before returning, https://man7.org/linux/man-pages/man1/systemctl.1.html
71+
# See https://github.com/thin-edge/thin-edge.io/issues/2087 for more details
72+
Stop Service ${name}
73+
Start Service ${name}

0 commit comments

Comments
 (0)