Skip to content

Commit

Permalink
Exit container if homebridge process finishes (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
oznu authored Jul 8, 2017
1 parent 0ed0a1e commit 6c7f5c2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
13 changes: 10 additions & 3 deletions ci/test-homebridge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup() {
docker run --name homebridge -d -p 51826:51826 homebridge
sleep 20
sleep 15
}

teardown() {
Expand All @@ -23,15 +23,22 @@ testCmd() {

@test "test homebridge starts after a graceful restart" {
docker restart homebridge
sleep 20
sleep 15
run testCmd
[ "$status" -eq 0 ]
}

@test "test homebridge starts after being killed" {
docker kill homebridge
docker start homebridge
sleep 20
sleep 15
run testCmd
[ "$status" -eq 0 ]
}

@test "test container exits when homebridge process stops" {
docker exec homebridge pkill homebridge
sleep 10
run docker exec homebridge echo "This should fail."
[ "$status" -ne 0 ]
}
3 changes: 3 additions & 0 deletions root/etc/services.d/homebridge/finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/execlineb -S0

s6-svscanctl -t /var/run/s6/services
2 changes: 1 addition & 1 deletion root/etc/services.d/homebridge/run
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/with-contenv sh
sleep 5
sleep 7
s6-setuidgid abc homebridge -U /homebridge -P /homebridge/node_modules

0 comments on commit 6c7f5c2

Please sign in to comment.