Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overlord/snapstate: do a minimal sanity check on containers #4464

Merged
merged 6 commits into from
Jan 18, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: test-snapd-validate-container-failures
version: "1"
apps:
foo:
command: bin/foo
completer: comp.sh
stop-command: bin/wat
bard:
command: bin/bar --daemon
daemon: simple
stop-command: bin/stahp
Empty file.
22 changes: 22 additions & 0 deletions tests/main/validate-container-failures/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
summary: check the container validator logs on error

environment:
SNAP: test-snapd-validate-container-failures

execute: |
echo "Snap refuses to install"
snap try $TESTSLIB/snaps/$SNAP 2>error.log && exit 1 || true
echo "The error tells you to ask the dev"
tr -s "\n " " " < error.log | MATCH 'contact developer'

# give things time to reach the journal
sleep 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nitpick) you could write a for i in $(seq 120); do if jounralctl -u snapd | grep check_snap; then break; fi; sleep 0.2; done here but probably not worth it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, I see this was already removed.


echo "And the journal counts the ways"
journalctl -u snapd | grep check_snap > journal.log
MATCH '"comp.sh" should be world-readable' < journal.log
MATCH '"bin/bar" should be executable' < journal.log
MATCH '"bin/foo" should be world-readable and -executable' < journal.log
MATCH '"meta/unreadable" should be world-readable' < journal.log
MATCH '"meta/hooks/what" should be executable' < journal.log
MATCH '"bin/stahp" does not exist' < journal.log