Merge lp:~mvo/snappy/selftest-docker-robustness into lp:snappy/selftest

Proposed by Michael Vogt on 2015-05-21
Status: Merged
Approved by: Michael Vogt on 2015-05-21
Approved revision: 43
Merged at revision: 44
Proposed branch: lp:~mvo/snappy/selftest-docker-robustness
Merge into: lp:snappy/selftest
Diff against target: 26 lines (+15/-3)
1 file modified
tests/07_test_install_framework (+15/-3)
To merge this branch: bzr merge lp:~mvo/snappy/selftest-docker-robustness
Reviewer Review Type Date Requested Status
John Lenton 2015-05-21 Approve on 2015-05-21
Review via email: mp+259734@code.launchpad.net

Commit Message

Wait for "framework" service to come up in the tests.

Description of the Change

I had some errors that docker did not come after the reboot that look
a lot like a race condition in the 07_test_install_framework. It seems
like sometimes ssh is ready when docker is not (yet). This is why the
test adds a loop waiting for the service (up to 60s).

To post a comment you must log in.
John Lenton (chipaca) wrote :

Thank you for this. Feel free to make the changes I mentioned on IRC, or not, as you wish. It didn't feel like bikeshedding when I thought of them, but when I spelled it all out it did :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/07_test_install_framework'
2--- tests/07_test_install_framework 2015-04-20 18:20:04 +0000
3+++ tests/07_test_install_framework 2015-05-21 09:32:02 +0000
4@@ -1,8 +1,20 @@
5 test() {
6 if after_reboot; then
7- # ensure the service comes up after a reboot
8- services=$(systemctl | grep "${framework}_.*.service")
9- [ -n "$services" ] || fail "$framework provided no services"
10+ # ensure the service comes up after a reboot, give it time
11+ # to start (i.e. avoid race between framework and ssh)
12+ TIMEOUT=60
13+ for i in $(seq $TIMEOUT); do
14+ services=$(systemctl | grep "${framework}_.*.service")
15+ if [ -n "$services" ]; then
16+ echo "Service $framework ready"
17+ break
18+ fi
19+ echo "Waiting for $framework to come up ($i)"
20+ sleep 1
21+ done
22+ if [ $i = $TIMEOUT ]; then
23+ fail "$framework provided no services"
24+ fi
25 return
26 fi
27

Subscribers

People subscribed via source and target branches