tests: add whoami check #3459

Merged
merged 3 commits into from Jun 9, 2017
Jump to file or symbol
Failed to load files and symbols.
+32 −1
Split
@@ -19,7 +19,7 @@ execute: |
exit 1
fi
- if [[ $SPREAD_STORE_USER && $SPREAD_STORE_PASSWORD ]]; then
+ if [ -n "$SPREAD_STORE_USER" ] && [ -n "$SPREAD_STORE_PASSWORD" ]; then
echo "Checking successful login"
expect -d -f successful_login.exp
@@ -0,0 +1,13 @@
+log_user 0
+spawn snap login $env(SPREAD_STORE_USER)
+
+expect "Password of "
+send "$env(SPREAD_STORE_PASSWORD)\n"
+
+expect {
+ "Login successful" {
+ exit 0
+ } default {
+ exit 1
+ }
+}
@@ -0,0 +1,18 @@
+summary: Checks for snap whoami
+
+# ppc64el disabled because of https://bugs.launchpad.net/snappy/+bug/1655594
+systems: [-ubuntu-core-16-*, -ubuntu-*-ppc64el]
+
+restore: |
+ snap logout || true
+
+execute: |
+ echo "whoami before login"
+ snap whoami | MATCH "email: -"
+
+ if [ -n "$SPREAD_STORE_USER" ] && [ -n "$SPREAD_STORE_PASSWORD" ]; then
+ expect -d -f successful_login.exp
+
+ echo "whoami after login"
+ snap whoami | MATCH "email: $SPREAD_STORE_USER"
+ fi