-
Notifications
You must be signed in to change notification settings - Fork 587
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
daemon,tests: support forgetting device serial via API (#11135)
this is done by posting {"action":"forget"} to /v2/model/serial a flag no-registration-until-reboot is also supported
- Loading branch information
Showing
4 changed files
with
165 additions
and
6 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
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
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
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,45 @@ | ||
summary: | | ||
Ensure that unregistration API works. | ||
# ubuntu-14.04: curl does not have --unix-socket option | ||
systems: [-ubuntu-core-*, -ubuntu-14.04-*] | ||
|
||
prepare: | | ||
systemctl stop snapd.service snapd.socket | ||
cp /var/lib/snapd/state.json state.json.bak | ||
mkdir key | ||
cp /var/lib/snapd/device/private-keys-v1/* key | ||
systemctl start snapd.service snapd.socket | ||
restore: | | ||
systemctl stop snapd.service snapd.socket | ||
cp key/* /var/lib/snapd/device/private-keys-v1/ | ||
cp state.json.bak /var/lib/snapd/state.json | ||
rm -f /run/snapd/noregister | ||
systemctl start snapd.service snapd.socket | ||
execute: | | ||
#shellcheck source=tests/lib/core-config.sh | ||
. "$TESTSLIB"/core-config.sh | ||
wait_for_device_initialized_change | ||
snap model --assertion | MATCH "series: 16" | ||
if snap model --verbose | NOMATCH "brand-id:\s* generic" ; then | ||
echo "Not a generic model. Skipping." | ||
exit 0 | ||
fi | ||
curl --data '{"action":"forget","no-registration-until-reboot":true}' --unix-socket /run/snapd.socket http://localhost/v2/model/serial | ||
test -f /run/snapd/noregister | ||
snap model --serial 2>&1|MATCH "error: device not registered yet" | ||
systemctl restart snapd.service | ||
snap model --serial 2>&1|MATCH "error: device not registered yet" | ||
snap find pc | ||
NOMATCH '"session-macaroon":"[^"]' < /var/lib/snapd/state.json | ||