-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1984f1
commit 6b9f536
Showing
4 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello, from component one (version 1.2) |
24 changes: 24 additions & 0 deletions
24
tests/lib/snaps/test-snap-component-refreshes/snapcraft.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: test-snap-component-refreshes | ||
summary: A snap with components | ||
description: | | ||
A snap with components used for testing snapd. Uploaded under the | ||
[email protected] account. | ||
version: 1.2 | ||
grade: stable | ||
confinement: strict | ||
base: core24 | ||
components: | ||
one: | ||
summary: Component 1 | ||
description: First component for test-snap-component-refreshes | ||
version: 1.2 | ||
type: test | ||
apps: | ||
test-snap-component-refreshes: | ||
command: test | ||
parts: | ||
copy: | ||
plugin: dump | ||
source: . | ||
organize: | ||
one: (component/one)/hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh -e | ||
|
||
if [ $# -ne 1 ]; then | ||
echo "pass in a component name to check if it is installed" | ||
exit 1 | ||
fi | ||
|
||
if [ ! -f "/snap/${SNAP_NAME}/components/${SNAP_REVISION}/${1}/meta/component.yaml" ]; then | ||
echo "component ${1} is not installed!" | ||
exit 1 | ||
fi | ||
|
||
comp_rev=$(basename $(readlink -f "/snap/${SNAP_NAME}/components/${SNAP_REVISION}/${1}")) | ||
|
||
echo "component ${1} is installed at revision ${comp_rev}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
summary: Test refreshing a component from the store | ||
|
||
details: | | ||
Verifies that we can install a snap and components from the store, refresh the | ||
snap+components, and revert the snap+components. | ||
systems: [ubuntu-16.04-64, ubuntu-18.04-64, ubuntu-2*, ubuntu-core-*, fedora-*] | ||
|
||
restore: | | ||
snap refresh --unhold | ||
snap remove test-snap-component-refreshes | ||
execute: | | ||
snap refresh --hold | ||
snap install test-snap-component-refreshes+one+two --revision=3 --edge | ||
# this snap uses a default track "custom", so we should be tracking | ||
# custom/edge | ||
snap list test-snap-component-refreshes | awk 'NR != 1 { print $4 }' | MATCH 'custom/edge' | ||
# verify that the components are installed with the correct revisions (these | ||
# are component revisions, not snap revisions) | ||
test-snap-component-refreshes one | MATCH '.*revision 3$' | ||
test-snap-component-refreshes two | MATCH '.*revision 3$' | ||
# test refreshing while providing a revision | ||
snap refresh test-snap-component-refreshes --revision=4 | ||
test-snap-component-refreshes one | MATCH '.*revision 4$' | ||
test-snap-component-refreshes two | MATCH '.*revision 4$' | ||
# test just a normal refresh | ||
snap refresh test-snap-component-refreshes | ||
test-snap-component-refreshes one | MATCH '.*revision 5$' | ||
test-snap-component-refreshes two | MATCH '.*revision 5$' | ||
# candidate has the same snap revision as edge, but it contains a different | ||
# set of component revisions | ||
snap refresh test-snap-component-refreshes --candidate | ||
test-snap-component-refreshes one | MATCH '.*revision 7$' | ||
test-snap-component-refreshes two | MATCH '.*revision 6$' | ||
# go back to a revision we've already installed | ||
snap refresh test-snap-component-refreshes --revision=4 | ||
test-snap-component-refreshes one | MATCH '.*revision 4$' | ||
test-snap-component-refreshes two | MATCH '.*revision 4$' | ||
# snap revision in beta is missing the "two" component, so it shouldn't be | ||
# linked | ||
snap refresh test-snap-component-refreshes --beta | ||
test-snap-component-refreshes one | MATCH '.*revision 6$' | ||
not test-snap-component-refreshes two | ||
# although revision 4 does have the "two" component available, it doesn't get | ||
# linked since it is not installed for the current revision | ||
snap refresh test-snap-component-refreshes --revision=4 | ||
test-snap-component-refreshes one | MATCH '.*revision 4$' | ||
not test-snap-component-refreshes two | ||
# since revision 4 of the "two" component is not referenced by anything else | ||
# in the sequence, it should be unlinked and discarded | ||
snap tasks --last=refresh-snap | MATCH 'Unlink.*test-snap-component-refreshes+two' | ||
snap tasks --last=refresh-snap | MATCH 'Discard.*test-snap-component-refreshes+two' | ||
# note that a revert does bring back the "two" component, since it was | ||
# installed when revision 5 was last installed | ||
snap revert test-snap-component-refreshes --revision=5 | ||
test-snap-component-refreshes one | MATCH '.*revision 7$' | ||
test-snap-component-refreshes two | MATCH '.*revision 6$' |