diff options
| author | Michael Vogt <mvo@ubuntu.com> | 2016-09-02 21:11:12 +0200 |
|---|---|---|
| committer | Michael Vogt <mvo@ubuntu.com> | 2016-09-02 21:11:12 +0200 |
| commit | 7b4812933c26abf41c58a95ad2d71ec25657f2f0 (patch) | |
| tree | fd62fb1d99cc3b288c282bfbc9c348e35e6ec1d5 /tests | |
| parent | 5ca2cf5776a6a071cbaa9b18e802c20b265251fb (diff) | |
use symlinks instead of wrappers for binaries and services
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/main/interfaces-locale-control/task.yaml | 4 | ||||
| -rw-r--r-- | tests/main/interfaces-mount-observe/task.yaml | 6 | ||||
| -rw-r--r-- | tests/main/interfaces-system-observe/task.yaml | 4 | ||||
| -rw-r--r-- | tests/main/security-devpts/pts.exp | 2 | ||||
| -rw-r--r-- | tests/main/security-private-tmp/tmp-create.exp | 2 | ||||
| -rw-r--r-- | tests/main/ubuntu-core-service/task.yaml | 21 |
6 files changed, 9 insertions, 30 deletions
diff --git a/tests/main/interfaces-locale-control/task.yaml b/tests/main/interfaces-locale-control/task.yaml index 3ce020e875..662fa06060 100644 --- a/tests/main/interfaces-locale-control/task.yaml +++ b/tests/main/interfaces-locale-control/task.yaml @@ -35,7 +35,7 @@ execute: | snap connect locale-control-consumer:locale-control ubuntu-core:locale-control echo "Then the snap is able to read the locale configuration" - [ "$(sudo -i -u test /bin/sh -c 'locale-control-consumer.get LANG')" = "$LANG" ] + [ "$(su -l -c 'locale-control-consumer.get LANG' test)" = "$LANG" ] echo "===================================" @@ -43,7 +43,7 @@ execute: | snap disconnect locale-control-consumer:locale-control ubuntu-core:locale-control echo "Then the snap is not able to read the locale configuration" - if sudo -i -u test /bin/sh -c "locale-control-consumer.get LANG 2>${PWD}/locale-read.error"; then + if su -l -c "locale-control-consumer.get LANG 2>${PWD}/locale-read.error" test; then echo "Expected permission error accessing locale configuration with disconnected plug" exit 1 fi diff --git a/tests/main/interfaces-mount-observe/task.yaml b/tests/main/interfaces-mount-observe/task.yaml index 951615566d..7d0cc011ca 100644 --- a/tests/main/interfaces-mount-observe/task.yaml +++ b/tests/main/interfaces-mount-observe/task.yaml @@ -34,7 +34,7 @@ execute: | echo "Then the mount info is reachable" expected="/snap/mount-observe-consumer" - sudo -i -u test /bin/sh -c "mount-observe-consumer" | grep -Pq "$expected" + su -l -c "mount-observe-consumer" test | grep -Pq "$expected" echo "=========================================" @@ -43,7 +43,7 @@ execute: | snap interfaces | grep -Pzq "$DISCONNECTED_PATTERN" echo "Then the mount info is not reachable" - if sudo -i -u test /bin/sh -c "mount-observe-consumer"; then + if su -l -c "mount-observe-consumer" test; then echo "Expected error accessing mount info with disconnected plug" exit 1 fi @@ -59,4 +59,4 @@ execute: | echo "Then the new mount info is reachable" expected="/snap/test-snapd-tools" - sudo -i -u test /bin/sh -c "mount-observe-consumer" | grep -Pq "$expected" + su -l -c "mount-observe-consumer" test | grep -Pq "$expected" diff --git a/tests/main/interfaces-system-observe/task.yaml b/tests/main/interfaces-system-observe/task.yaml index 8c3b668aee..48b16e4073 100644 --- a/tests/main/interfaces-system-observe/task.yaml +++ b/tests/main/interfaces-system-observe/task.yaml @@ -33,7 +33,7 @@ execute: | echo "Then the snap is able to get system information" expected="(?s)/dev/tty.*?serial" - sudo -i -u test /bin/sh -c "system-observe-consumer" | grep -Pq "$expected" + su -l -c "system-observe-consumer" test | grep -Pq "$expected" echo "===========================================" @@ -42,7 +42,7 @@ execute: | snap interfaces | grep -Pzq "$DISCONNECTED_PATTERN" echo "Then the snap is not able to get system information" - if sudo -i -u test /bin/sh -c "system-observe-consumer"; then + if su -l -c "system-observe-consumer" test; then echo "Expected error with plug disconnected" exit 1 fi diff --git a/tests/main/security-devpts/pts.exp b/tests/main/security-devpts/pts.exp index 95b931a1e6..f019435227 100644 --- a/tests/main/security-devpts/pts.exp +++ b/tests/main/security-devpts/pts.exp @@ -7,7 +7,7 @@ send "ls /dev/pts\n" expect "\[0-9]*ptmx" {} timeout { exit 1 } # Launch app and checks contents of /dev/pts, should have only ptmx -spawn sudo -i -u test /bin/sh -c /snap/bin/test-snapd-tools.sh +spawn su -l -c "/snap/bin/test-snapd-tools.sh" test expect "bash-4.3\\$" {} timeout { exit 1 } send "ls /dev/pts\n" expect { diff --git a/tests/main/security-private-tmp/tmp-create.exp b/tests/main/security-private-tmp/tmp-create.exp index 209ab5cc0d..d7eba45ce3 100644 --- a/tests/main/security-private-tmp/tmp-create.exp +++ b/tests/main/security-private-tmp/tmp-create.exp @@ -5,7 +5,7 @@ set timeout 2 spawn bash # Test private /tmp, allowed access -spawn sudo -i -u test /bin/sh -c /snap/bin/test-snapd-tools.sh +spawn su -l -c "/snap/bin/test-snapd-tools.sh" test expect "bash-4.3\\$" {} timeout { exit 1 } send "touch /tmp/foo\n" send "stat /tmp/foo\n" diff --git a/tests/main/ubuntu-core-service/task.yaml b/tests/main/ubuntu-core-service/task.yaml deleted file mode 100644 index 3c12a94fc2..0000000000 --- a/tests/main/ubuntu-core-service/task.yaml +++ /dev/null @@ -1,21 +0,0 @@ -summary: Ensure that service keep working after a reboot -systems: [ubuntu-core-16-64] -environment: - # FIXME: use test-snapd-tools once it has a service - SNAP: network-bind-consumer - SERVICE: network-consumer -prepare: | - snapbuild $TESTSLIB/snaps/network-bind-consumer . - snap install --force-dangerous network-bind-consumer_1.0_all.snap -execute: | - echo "Ensure the snap is there" - snap list|grep $SNAP - echo "Ensure the service is running" - systemctl status snap.$SNAP.$SERVICE.service|grep 'Active: active (running)' - - # this triggers the reboot and after the reboot the above checks - # ensure that the snap is still there and the service is still running - if [ "$SPREAD_REBOOT" = "0" ]; then - REBOOT - fi - \ No newline at end of file |
