Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/lib/tools/store-state: exit on errors, update relevant tests #14725

Merged
merged 5 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/lib/tools/store-state
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch!


STORE_CONFIG=/etc/systemd/system/snapd.service.d/store.conf

show_help() {
Expand Down
13 changes: 13 additions & 0 deletions tests/main/interfaces-custom-device-app-slot/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,22 @@ prepare: |
snap install core
fi

# Install store-state dependencies
echo "Ensure jq is installed"
if ! command -v jq; then
snap install --devmode jq
fi

echo "Ensure yaml2json is installed"
if ! command -v yaml2json; then
snap install --devmode remarshal
fi

snap debug can-manage-refreshes | MATCH false

snap ack "$TESTSLIB/assertions/testrootorg-store.account-key"
snap ack "$TESTSLIB/assertions/developer1.account"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this ack work when we are running non-test keys build (aka a vanilla build)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's if [ "$TRUST_TEST_KEYS" = "false" ]; then above

snap ack "$TESTSLIB/assertions/developer1.account-key"

"$TESTSTOOLS"/store-state setup-fake-store "$BLOB_DIR"

Expand Down
1 change: 1 addition & 0 deletions tests/main/store-state/snap/meta/snap.yaml.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: SNAPNAME
summary: generic snap
version: '1.0'
base: core22

apps:
test-app:
Expand Down
4 changes: 4 additions & 0 deletions tests/main/store-state/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ execute: |
snap info core | MATCH "store-url:.*https://snapcraft.io"
fi

# install test snap dependency before switching to fake store
# TODO: extract base name when switching to gojq
snap install core22

# Setup fakestore
STORE_DIR="$(pwd)/fake-store-blobdir"
snap ack "$TESTSLIB/assertions/testrootorg-store.account-key"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: SNAPNAME
summary: Snap requesting snap-scoped system users
version: '1.0'
base: core22

apps:
test-app:
Expand Down
4 changes: 4 additions & 0 deletions tests/main/system-usernames-snap-scoped/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ prepare: |
snap debug can-manage-refreshes | MATCH false
# install dependencies before switching to fake store
# TODO extract base from snap metadata when swithing to gojq
snap install core22
snap ack "$TESTSLIB/assertions/testrootorg-store.account-key"
"$TESTSTOOLS"/store-state setup-fake-store "$STORE_DIR"
Expand Down
Loading