tests/lib: handle distro specific grub-editenv naming #4201

Merged
merged 5 commits into from Nov 13, 2017

Conversation

Projects
None yet
3 participants
Contributor

bboozzoo commented Nov 10, 2017

Fedora and OpenSUSE use grub2-editenv while Ubuntu and Debian seem to settle on grub-editenv. A workaround was already implemented in d0098ba but the tests started failing on linode:fedora-25-64:project only now.

bboozzoo added some commits Nov 10, 2017

tests/lib/boot: handle distribution specific grub-editenv naming
Fedora and OpenSUSE use grub2-editenv instead of grub-editenv

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
tests/lib/prepare: use lib/boot.sh helpers for poking bootloade envir…
…onment

Use helpers from tests/lib/boot.sh instead of calling grub tools directly.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
tests/lib/prepare.sh
echo "Ensure that the grub-editenv list output does not contain any of the snap_* variables on classic"
- output=$($GRUB_EDITENV list)
+ output="$(bootenv list)"
@zyga

zyga Nov 10, 2017

Contributor

Hmm, is this the same thing as before?

bboozzoo added some commits Nov 10, 2017

tests/lib/prepare: bootenv without arguments dumps the environment
Calling `bootenv` provides the desired output of all bootloader environment
variables. `bootenv list` would try to print the value of 'list' variable, which
is not something that is needed in this case.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
tests/lib/prepare: update debug message around bootenv calls
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
tests/lib/prepare: disable shellcheck SC2119 when calling bootenv
Shellcheck was incorrectly raising this issue:

In tests/lib/prepare.sh line 211:
        output=$(bootenv)
                 ^-- SC2119: Use bootenv "$@" if function's $1 should mean script's $1.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

zyga approved these changes Nov 10, 2017

+1

if echo "$output" | MATCH snap_ ; then
- echo "Expected grub environment without snap_*, got:"
+ echo "Expected bootloader environment without snap_*, got:"
@zyga

zyga Nov 10, 2017

Contributor

:-)

Collaborator

mvo5 commented Nov 13, 2017

Test failed with 502 in downloading something from a suse server (so unrelated to the PR). I restarted the test.

mvo5 approved these changes Nov 13, 2017

@mvo5 mvo5 merged commit 7d06636 into snapcore:master Nov 13, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment