summaryrefslogtreecommitdiff
path: root/tests
diff options
authorGustavo Niemeyer <gustavo@niemeyer.net>2016-09-20 17:07:26 -0300
committerGitHub <noreply@github.com>2016-09-20 17:07:26 -0300
commite20187cf9feea4f98c7b95bb1e718d815afa472d (patch)
treee99d1e8743a7f6d4c1554100889479b4eccd05d4 /tests
parent408eaf034e924f3b8af42adf366a9cdb881925d6 (diff)
parent0759d761fa2b31462f739f822c8fb7dd77b28a38 (diff)
Merge pull request #1930 from kyrofa/feature/snapctl_help
many: support snapctl -h
Diffstat (limited to 'tests')
-rw-r--r--tests/main/snapctl/task.yaml17
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/main/snapctl/task.yaml b/tests/main/snapctl/task.yaml
index c68f7ff1dd..483af14b2d 100644
--- a/tests/main/snapctl/task.yaml
+++ b/tests/main/snapctl/task.yaml
@@ -52,19 +52,24 @@ restore: |
systemctl start snapd.service
execute: |
+ echo "Verify that snapctl -h runs without a context"
+
+ if ! snapctl -h; then
+ echo "Expected snapctl -h to be successful"
+ fi
+
echo "Run the hook that calls snapctl"
- # This context is enough to hit the API, but the hook will fail since this
- # context is obviously invalid. That failure still means we're correctly
- # hitting the API, though, which is all we care about here.
- export SNAP_CONTEXT="foo"
+ # The snapctl usage in the hook is invalid and will cause a failure. That
+ # failure still means we're correctly hitting the API, though, which is all
+ # we care about here.
if output="$(snap run --hook=apply-config snapctl-hooks 2>&1 >/dev/null)"; then
echo "Expected the hook to fail"
exit 1
fi
- if [[ ! "$output" =~ .*"no context for ID: \"foo\"".* ]]; then
- echo "Expected failure to be due to missing context, but it was \"$output\""
+ if [[ ! "$output" =~ .*"unknown flag".*bar.* ]]; then
+ echo "Expected failure to be due to unknown flag, but it was \"$output\""
exit 1
fi