mirror of
https://github.com/troglobit/finit.git
synced 2026-10-25 12:04:36 +00:00
test: New test: test_start_stop_service
Add a new test that verifies that Finit will: - Start a service that's been added to the config - Stop the service once it's removed from the config The second step is currently failing. Signed-off-by: Jacques de Laval <jacques@de-laval.se>
This commit is contained in:
1 parent
4f82cb8261
commit
4224c2e8fe
7 files changed
+98
-6
No files matched your search
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
while [ 1 ]; do
|
||||
sleep 5
|
||||
done
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
# Test
|
||||
say 'Set up a service'
|
||||
cp "$TEST_DIR"/service.sh test_root/bin
|
||||
texec sh -c 'echo "service [2345] kill:20 log /bin/service.sh" > /etc/finit.conf'
|
||||
|
||||
say 'Reload Finit'
|
||||
texec kill -SIGHUP 1
|
||||
sleep 1
|
||||
|
||||
service_pids=( $(texec pgrep -P 1) )
|
||||
assert 'One service is running' ${#service_pids[@]} -eq 1
|
||||
|
||||
say 'Remove the service'
|
||||
texec sh -c 'echo > /etc/finit.conf'
|
||||
|
||||
say 'Reload Finit'
|
||||
texec kill -SIGHUP 1
|
||||
sleep 1
|
||||
|
||||
service_pids=( $(texec pgrep -P 1) )
|
||||
assert 'Zero services are running' ${#service_pids[@]} -eq 0
|
||||
|
||||
# Teardown
|
||||
rm -f test_root/bin/service.sh
|
||||
Reference in new issue
Block a user