Merge lp:~mterry/snappy/selftest-reboot-notice into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by Michael Terry on 2015-06-17
Status: Rejected
Rejected by: Leo Arias on 2015-07-24
Proposed branch: lp:~mterry/snappy/selftest-reboot-notice
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Diff against target: 29 lines (+25/-0)
1 file modified
integration-tests/run-in-image/tests/12_test_reboot_notice (+25/-0)
To merge this branch: bzr merge lp:~mterry/snappy/selftest-reboot-notice
Reviewer Review Type Date Requested Status
Leo Arias 2015-06-17 Needs Fixing on 2015-07-24
Review via email: mp+262265@code.launchpad.net

Commit Message

Add a test to make sure we print reboot notices after update and rollback, if needed.

Description of the Change

Add a test to make sure we print reboot notices after update and rollback, if needed.

A while back, I added a reboot notification to 'snappy rollback' [1]. It didn't have any tests though. It seemed like a better candidate for integration tests than unit tests, but selftests weren't integrated at the time.

I've been sitting on this test and realized I should propose it! So here it is.

[1] https://code.launchpad.net/~mterry/snappy/rollback-reboot/+merge/261114

To post a comment you must log in.
Sergio Schvezov (sergiusens) wrote :

this looks good, but would need a conditional skip if the "device" (kernel/os) has been sideloaded.

Leo Arias (elopio) wrote :

I've finally been able to test it. I'm ok with this as is because the test script controls how the kvm is provisioned and it has nothing sideloaded. Once we start making the tests without fakes, this one needs to be part of the suite that sets up an available update. And maybe we should add another to the suite with that prepares a sideloaded image.

****** Running ./tests/12_test_reboot_notice
current version: 84
available version: 84
Rebooting testbed...
[...]
****** Resuming ./tests/12_test_reboot_notice after reboot
****** Running ./tests/80_test_failover

[...]
echo "All good, what could possibly go wrong"
All good, what could possibly go wrong

review: Approve
Snappy Tarmac (snappydevtarmac) wrote :

Attempt to merge into lp:snappy failed due to conflicts:

missing parent in _integration-tests/run-in-image
unversioned parent in _integration-tests/run-in-image
missing parent in _integration-tests/run-in-image/tests
unversioned parent in _integration-tests/run-in-image/tests

Leo Arias (elopio) wrote :

stop, hammertime!

this needs to be translated into go, we no longer have the shell test suite. It's esasy, I'll get to it tomorrow.

review: Needs Fixing

Unmerged revisions

513. By Michael Terry on 2015-06-17

Add an integration test to make sure we print reboot notices

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'integration-tests/run-in-image/tests/12_test_reboot_notice'
2--- integration-tests/run-in-image/tests/12_test_reboot_notice 1970-01-01 00:00:00 +0000
3+++ integration-tests/run-in-image/tests/12_test_reboot_notice 2015-06-17 19:41:22 +0000
4@@ -0,0 +1,25 @@
5+# Test that we notify the user to reboot after operations that need it.
6+# Test will be skipped the testbed does not offer reboot (needs autopkgtest
7+# with a supporting runner).
8+
9+test() {
10+ can_reboot || { echo "SKIP: cannot reboot testbed"; return; }
11+
12+ # Could be either "the new ubuntu-core" or "ubuntu-core version XX".
13+ # Either is fine, we just want the user notified.
14+ T="Reboot to use.*ubuntu-core"
15+
16+ if after_reboot; then
17+ test_regexp "$T" sudo $SNAPPY rollback ubuntu-core
18+ test_regexp "$T" sudo $SNAPPY list
19+ return
20+ fi
21+
22+ # fake new available version by doing a current--
23+ version_info
24+ switch_channel "s/build_number: $current/build_number: $((current-1))/"
25+
26+ test_regexp "$T" sudo $SNAPPY update ubuntu-core
27+ test_regexp "$T" sudo $SNAPPY list
28+ reboot
29+}

Subscribers

People subscribed via source and target branches