Skip to content

Commit

Permalink
tests/main/interfaces-process-control: retry check for process being …
Browse files Browse the repository at this point in the history
…terminated

We are sending a SIGTERM to the test process, and so its handling and test
process termination is asynchronous and there is no guarantee the test process
exits immediately. Retry the check a couple of times to account for this.

The problem was often seen to happen on openSUSE:

Error: 2024-01-17 21:36:40 Error executing google:opensuse-tumbleweed-64:tests/main/interfaces-process-control (jan172104-345478) :
-----
+ echo 'The interface is disconnected by default'
The interface is disconnected by default
+ snap interfaces -i process-control
+ MATCH -- '- +process-control-consumer:process-control'

'snap interfaces' is deprecated; use 'snap connections'.
+ echo 'When the plug is connected'
When the plug is connected
+ snap connect process-control-consumer:process-control
+ echo 'Then the snap is able to kill an existing process'
Then the snap is able to kill an existing process
+ pid=31252
+ sleep 5m
+ kill -s 0 31252
+ process-control-consumer.signal SIGTERM 31252
+ not kill -s 0 31252
-----

Signed-off-by: Maciej Borzecki <[email protected]>
  • Loading branch information
bboozzoo committed Jan 19, 2024
1 parent 8076d70 commit e3ab724
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/main/interfaces-process-control/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ execute: |
pid=$!
kill -s 0 "$pid"
process-control-consumer.signal SIGTERM "$pid"
not kill -s 0 "$pid"
retry -n 10 not kill -s 0 "$pid"
if [ "$(snap debug confinement)" = partial ] ; then
exit
Expand Down

0 comments on commit e3ab724

Please sign in to comment.