-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/nested/manual/remodel-offline: use the fakestore
- Loading branch information
1 parent
39dc92b
commit f874793
Showing
6 changed files
with
311 additions
and
28 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
tests/lib/assertions/developer1-test-snapd-core22-required-vset.json
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,17 @@ | ||
{ | ||
"type": "validation-set", | ||
"series": "16", | ||
"account-id": "developer1", | ||
"authority-id": "developer1", | ||
"name": "test-snapd-core22-required-vset", | ||
"sequence": "1", | ||
"timestamp": "2023-10-24T19:55:00+00:00", | ||
"snaps": [ | ||
{ | ||
"id": "buPKUD3TKqCOgLEjjHx5kSiCpIs5cMuQ", | ||
"name": "hello-world", | ||
"revision": "28", | ||
"presence": "required" | ||
} | ||
] | ||
} |
39 changes: 39 additions & 0 deletions
39
tests/lib/assertions/developer1-test-snapd-remodel-offline-rev0.json
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,39 @@ | ||
{ | ||
"type": "model", | ||
"series": "16", | ||
"authority-id": "developer1", | ||
"brand-id": "developer1", | ||
"model": "test-snapd-remodel-pc", | ||
"serial-authority": ["generic"], | ||
"system-user-authority": "*", | ||
"architecture": "amd64", | ||
"timestamp": "2023-10-30T11:01:45+00:00", | ||
"grade": "dangerous", | ||
"base": "core20", | ||
"snaps": [ | ||
{ | ||
"default-channel": "20/edge", | ||
"id": "UqFziVZDHLSyO3TqSWgNBoAdHbLI4dAH", | ||
"name": "pc", | ||
"type": "gadget" | ||
}, | ||
{ | ||
"default-channel": "20/edge", | ||
"id": "pYVQrBcKmBa0mZ4CCN7ExT6jH8rY1hza", | ||
"name": "pc-kernel", | ||
"type": "kernel" | ||
}, | ||
{ | ||
"default-channel": "latest/edge", | ||
"id": "DLqre5XGLbDqg9jPtiAhRRjDuPVa5X1q", | ||
"name": "core20", | ||
"type": "base" | ||
}, | ||
{ | ||
"default-channel": "latest/edge", | ||
"id": "PMrrV4ml8uWuEUDBT8dSGnKUYbevVhc4", | ||
"name": "snapd", | ||
"type": "snapd" | ||
} | ||
] | ||
} |
58 changes: 58 additions & 0 deletions
58
tests/lib/assertions/developer1-test-snapd-remodel-offline-rev1.json
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,58 @@ | ||
{ | ||
"type": "model", | ||
"series": "16", | ||
"revision": "1", | ||
"authority-id": "developer1", | ||
"brand-id": "developer1", | ||
"model": "test-snapd-remodel-pc", | ||
"serial-authority": ["generic"], | ||
"system-user-authority": "*", | ||
"architecture": "amd64", | ||
"timestamp": "2023-10-30T11:01:45+00:00", | ||
"grade": "dangerous", | ||
"base": "core22", | ||
"validation-sets": [ | ||
{ | ||
"name": "test-snapd-core22-required-vset", | ||
"mode": "enforce" | ||
} | ||
], | ||
"snaps": [ | ||
{ | ||
"default-channel": "22/edge", | ||
"id": "UqFziVZDHLSyO3TqSWgNBoAdHbLI4dAH", | ||
"name": "pc", | ||
"type": "gadget" | ||
}, | ||
{ | ||
"default-channel": "22/edge", | ||
"id": "pYVQrBcKmBa0mZ4CCN7ExT6jH8rY1hza", | ||
"name": "pc-kernel", | ||
"type": "kernel" | ||
}, | ||
{ | ||
"default-channel": "latest/edge", | ||
"id": "amcUKQILKXHHTlmSa7NMdnXSx02dNeeT", | ||
"name": "core22", | ||
"type": "base" | ||
}, | ||
{ | ||
"default-channel": "latest/stable", | ||
"id": "buPKUD3TKqCOgLEjjHx5kSiCpIs5cMuQ", | ||
"name": "hello-world", | ||
"type": "app" | ||
}, | ||
{ | ||
"default-channel": "latest/stable", | ||
"id": "99T7MUlRhtI3U0QFgl5mXXESAiSwt776", | ||
"name": "core", | ||
"type": "core" | ||
}, | ||
{ | ||
"default-channel": "latest/edge", | ||
"id": "PMrrV4ml8uWuEUDBT8dSGnKUYbevVhc4", | ||
"name": "snapd", | ||
"type": "snapd" | ||
} | ||
] | ||
} |
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,3 @@ | ||
#!/bin/sh | ||
# 10.0.2.2 is the host from a nested VM | ||
snapctl set device-service.url=http://10.0.2.2:11029 |
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,59 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
version=$1 | ||
branch=$2 | ||
|
||
tmpd=$(mktemp -d) | ||
cleanup() { | ||
rm -rf "${tmpd}" | ||
} | ||
trap cleanup EXIT | ||
|
||
waited=0 | ||
while ! resolvectl query api.launchpad.net; do | ||
waited=$((waited+1)) | ||
if [ "${waited}" -gt 120 ]; then | ||
break | ||
fi | ||
sleep 1 | ||
done | ||
|
||
add-apt-repository ppa:snappy-dev/image -y | ||
apt-get install -y golang ubuntu-core-initramfs | ||
|
||
snap download pc-kernel --channel="${version}/${branch}" --basename=pc-kernel --target-directory="${tmpd}" | ||
unsquashfs -d "${tmpd}/pc-kernel" "${tmpd}/pc-kernel.snap" | ||
|
||
objcopy -O binary -j .initrd "${tmpd}/pc-kernel/kernel.efi" "${tmpd}/initrd" | ||
objcopy -O binary -j .linux "${tmpd}/pc-kernel/kernel.efi" "${tmpd}/linux" | ||
objcopy -O binary -j .uname "${tmpd}/pc-kernel/kernel.efi" "${tmpd}/kver" | ||
|
||
mkdir "${tmpd}/early" | ||
mkdir "${tmpd}/main" | ||
( (cd "${tmpd}/early"; cpio -id) ; (cd "${tmpd}/main"; zstdcat | cpio -id) ) <"${tmpd}/initrd" | ||
|
||
if [ "${BUILD_FDE_HOOK-}" = 1 ]; then | ||
go build -o "${tmpd}/main/usr/bin/fde-reveal-key" /project/tests/lib/fde-setup-hook | ||
fi | ||
|
||
go build -tags 'nomanagers withtestkeys faultinject' -o "${tmpd}/main/usr/lib/snapd/snap-bootstrap" /project/cmd/snap-bootstrap | ||
|
||
(cd "${tmpd}/early"; find . | cpio --create --quiet --format=newc --owner=0:0) >"${tmpd}/new-initrd" | ||
(cd "${tmpd}/main"; find . | cpio --create --quiet --format=newc --owner=0:0 | zstd -1 -T0) >>"${tmpd}/new-initrd" | ||
|
||
ubuntu-core-initramfs create-efi \ | ||
--kernelver "" \ | ||
--initrd "${tmpd}/new-initrd" \ | ||
--kernel "${tmpd}/linux" \ | ||
--key "${SNAKEOIL_KEY}" \ | ||
--cert "${SNAKEOIL_CERT}" \ | ||
--output "${tmpd}/pc-kernel/kernel.efi" | ||
|
||
|
||
if [ "${BUILD_FDE_HOOK-}" = 1 ]; then | ||
go build -o "${tmpd}/pc-kernel/meta/hooks/fde-setup" /project/tests/lib/fde-setup-hook | ||
fi | ||
|
||
snap pack "${tmpd}/pc-kernel" --filename="pc-kernel-modified.snap" |
Oops, something went wrong.