summaryrefslogtreecommitdiff
path: root/tests
diff options
authorMichael Vogt <mvo@ubuntu.com>2018-05-28 17:46:17 +0200
committerMichael Vogt <mvo@ubuntu.com>2018-05-28 17:46:17 +0200
commit7680303adbd804feaccaa423462758a8bcd349a3 (patch)
tree5584973add8eab0bd94cda7bb70c6ebc69b355e3 /tests
parenta715aee45cf5a22e5dfc3e3cff1c727dc3e0d0ba (diff)
parentd54cceed6f67e578b2407f905ac4ca152df00bd1 (diff)
Merge remote-tracking branch 'upstream/master' into prepare-image-core18
Diffstat (limited to 'tests')
-rwxr-xr-xtests/lib/snaps/test-snapd-appstreamid/bin/run3
-rw-r--r--tests/lib/snaps/test-snapd-appstreamid/snapcraft.yaml25
-rw-r--r--tests/main/appstream-id/task.yaml31
-rw-r--r--tests/unit/spread-shellcheck/must1
4 files changed, 60 insertions, 0 deletions
diff --git a/tests/lib/snaps/test-snapd-appstreamid/bin/run b/tests/lib/snaps/test-snapd-appstreamid/bin/run
new file mode 100755
index 0000000000..5ae1c70628
--- /dev/null
+++ b/tests/lib/snaps/test-snapd-appstreamid/bin/run
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+exec "$@" \ No newline at end of file
diff --git a/tests/lib/snaps/test-snapd-appstreamid/snapcraft.yaml b/tests/lib/snaps/test-snapd-appstreamid/snapcraft.yaml
new file mode 100644
index 0000000000..e9ecf0c4ab
--- /dev/null
+++ b/tests/lib/snaps/test-snapd-appstreamid/snapcraft.yaml
@@ -0,0 +1,25 @@
+name: test-snapd-appstreamid
+version: 1.0
+summary: Snap for testing snapd AppStream ID support
+description: |
+ Snap for testing snapd AppStream ID support
+confinement: strict
+
+apps:
+ foo:
+ command: bin/run
+ common-id: io.snapcraft.test-snapd-appstreamid.foo
+
+ bar:
+ command: bin/run
+ common-id: io.snapcraft.test-snapd-appstreamid.bar
+
+ baz:
+ command: bin/run
+
+parts:
+ bash:
+ plugin: dump
+ source: .
+ prime:
+ - bin/
diff --git a/tests/main/appstream-id/task.yaml b/tests/main/appstream-id/task.yaml
new file mode 100644
index 0000000000..3a3a477df9
--- /dev/null
+++ b/tests/main/appstream-id/task.yaml
@@ -0,0 +1,31 @@
+summary: Verify AppStream ID integration
+# ubuntu-*-32: the snap used in the test was published only for amd64
+# fedora: uses GNU netcat by default
+systems: [-ubuntu-16.04-32, -fedora-*]
+
+prepare: |
+ snap install jq
+
+restore: |
+ snap remove jq
+
+execute: |
+ echo "Verify that search results contain common-ids"
+ printf 'GET /v2/find?name=test-snapd-appstreamid HTTP/1.0\r\n\r\n' | \
+ nc -U -q 1 /run/snapd.socket| grep '{'| \
+ jq -r ' .result[0]["common-ids"] | sort | join (",")' | \
+ MATCH 'io.snapcraft.test-snapd-appstreamid.bar,io.snapcraft.test-snapd-appstreamid.foo'
+
+ snap install --edge test-snapd-appstreamid
+
+ echo "Verify that installed snap info contains common-ids"
+ printf 'GET /v2/snaps/test-snapd-appstreamid HTTP/1.0\r\n\r\n' | \
+ nc -U -q 1 /run/snapd.socket| grep '{'| \
+ jq -r ' .result["common-ids"] | sort | join(",")' | \
+ MATCH 'io.snapcraft.test-snapd-appstreamid.bar,io.snapcraft.test-snapd-appstreamid.foo'
+
+ echo "Verify that apps have their common-id set"
+ printf 'GET /v2/apps?names=test-snapd-appstreamid HTTP/1.0\r\n\r\n' | \
+ nc -U -q 1 /run/snapd.socket| grep '{'| \
+ jq -r ' .result | sort_by(.name) | [.[]."common-id"] | join(",")' | \
+ MATCH 'io.snapcraft.test-snapd-appstreamid.bar,,io.snapcraft.test-snapd-appstreamid.foo'
diff --git a/tests/unit/spread-shellcheck/must b/tests/unit/spread-shellcheck/must
index 0d6c98dcb4..d7e28618e5 100644
--- a/tests/unit/spread-shellcheck/must
+++ b/tests/unit/spread-shellcheck/must
@@ -44,4 +44,5 @@ tests/main/install-cache/task.yaml
tests/main/install-errors/task.yaml
tests/main/install-refresh-private/task.yaml
tests/main/install-refresh-remove-hooks/task.yaml
+tests/main/appstream-id/task.yaml
tests/main/prepare-image-grub-core18/task.yaml