diff options
| author | Gustavo Niemeyer <gustavo@niemeyer.net> | 2016-09-20 19:31:27 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-20 19:31:27 -0300 |
| commit | 98c8e937625ce3134cf17025d8f0eb3e1016259a (patch) | |
| tree | 30b4168c2e3875c9c58ea8826abefb9986c8853a | |
| parent | eff257c12b87047c85c4a64114576c18c362e90a (diff) | |
| parent | 342e0f638730228c6a0a2bf56bb16acea569926b (diff) | |
Merge pull request #1862 from mvo5/feature/spread-classic-tests2
tests: add tests for the classic dimension
| -rw-r--r-- | tests/main/ubuntu-core-classic/task.yaml | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/main/ubuntu-core-classic/task.yaml b/tests/main/ubuntu-core-classic/task.yaml new file mode 100644 index 0000000000..4918b5e9e4 --- /dev/null +++ b/tests/main/ubuntu-core-classic/task.yaml @@ -0,0 +1,48 @@ +summary: Ensure classic dimension works correctly +systems: [ubuntu-core-16-64] +environment: + # We need to set the SUDO_USER here to simulate the real + # behavior. I.e. when entering classic it happens via + # `sudo classic` and the user gets a user shell inside + # the classic environment that has sudo support. + SUDO_USER: test +prepare: | + echo "test ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/create-test +restore: | + rm -f /etc/sudoers.d/create-test +execute: | + echo "Ensure classic can be installed" + snap install --devmode --beta classic + snap list|grep classic + + echo "Check that classic can run commands inside classic" + classic test -f /var/lib/dpkg/status + + echo "Ensure that after classic exits no processes are left behind" + classic "sleep 133713371337&" + if ps afx|grep 133713371337|grep -v grep; then + echo "The sleep process was not killed when classic exited" + echo "Something is wrong with the cleanup" + exit 1 + fi + + echo "Ensure sudo works without a password inside classic" + # classic uses "script" to work around the issue that + # tty reports "no tty" inside snaps (LP: #1611493) + # + # "script" adds extra \r into the output that we need to filter here + if [ "$(classic sudo id -u|tr -d "\r")" != "0" ]; then + echo "sudo inside classic did not work as expected" + exit 1 + fi + + for d in /proc /run /sys /dev /snappy; do + if ! classic test -d $d; then + echo "Expected dir $d is missing inside classic" + exit 1 + fi + if ! classic mount | grep "$d"; then + echo "Expected bind mount for $d in classic missing" + exit 1 + fi + done |
