Files
snapd/tests/main/refresh-devmode/task.yaml
Sergio Cazzolato 7ce005366d tests: update the tests to start using the new store-state tool (#12649)
* New store-state tool to replace the store.sh helper

This is the new store tool inclusing a new test.
Also it is included a network took

* Fix store-state test and tool

Based on errors found in test results

* Fix refresh test

That part of the restore was missing

* Testing missing functions for store-state

Commands included:
 make-snap-installable command with snap-id
 make-snap-installable command without snap-id
 init-fake-refreshes command

* Skip test in ubuntu 14.04
2023-03-15 10:27:07 -03:00

77 lines
2.4 KiB
YAML

summary: Check that the refresh command works.
details: |
These tests exercise the refresh command using different store backends.
The concrete store to be used is controlled with the STORE_TYPE variant,
the defined values are fake, for a local store, or remote, for the currently
configured remote store.
When executing against the remote stores the tests rely in the existence of
a given snap with an updatable version (version string like 2.0+fake1) in the
edge channel.
# ubuntu-14.04: systemd-run not supported
systems: [-ubuntu-14.04*]
environment:
SNAP_NAME: test-snapd-tools
SNAP_VERSION_PATTERN: \d+\.\d+\+fake1
BLOB_DIR: $(pwd)/fake-store-blobdir
STORE_TYPE/fake: fake
STORE_TYPE/remote: ${REMOTE_STORE}
prepare: |
if [ "$STORE_TYPE" = "fake" ]; then
if os.query is-core; then
exit
fi
if [ "$TRUST_TEST_KEYS" = "false" ]; then
echo "This test needs test keys to be trusted"
exit
fi
fi
echo "Given a snap is installed"
snap install --devmode test-snapd-tools
if [ "$STORE_TYPE" = "fake" ]; then
"$TESTSTOOLS"/store-state setup-fake-store "$BLOB_DIR"
echo "And a new version of that snap put in the controlled store"
"$TESTSTOOLS"/store-state init-fake-refreshes "$BLOB_DIR" test-snapd-tools
fi
restore: |
if [ "$STORE_TYPE" = "fake" ]; then
if os.query is-core; then
exit
fi
if [ "$TRUST_TEST_KEYS" = "false" ]; then
echo "This test needs test keys to be trusted"
exit
fi
"$TESTSTOOLS"/store-state teardown-fake-store "$BLOB_DIR"
fi
execute: |
if [ "$STORE_TYPE" = "fake" ]; then
if os.query is-core; then
exit
fi
if [ "$TRUST_TEST_KEYS" = "false" ]; then
echo "This test needs test keys to be trusted"
exit
fi
fi
# FIXME: currently the --list from channel doesn't work
# echo "Then the new version is available for the snap to be refreshed"
# expected="$SNAP_NAME +$SNAP_VERSION_PATTERN"
# snap refresh --list | grep -Pzq "$expected"
echo "When the snap is refreshed"
snap refresh --devmode --channel=edge "$SNAP_NAME"
echo "Then the new version is listed"
expected="$SNAP_NAME +$SNAP_VERSION_PATTERN .*devmode"
snap list | grep -Pzq "$expected"