Skip to content

End-to-end tests using aktualizr-lite - #231

Draft
detsch wants to merge 3 commits into
foundriesio:mainfrom
detsch:aklite-e2e
Draft

End-to-end tests using aktualizr-lite#231
detsch wants to merge 3 commits into
foundriesio:mainfrom
detsch:aklite-e2e

Conversation

@detsch

@detsch detsch commented Aug 20, 2026

Copy link
Copy Markdown
Member

Also implement ostree/download-urls, required by fiopull

detsch and others added 3 commits August 20, 2026 10:27
Previously the endpoint returned 204 No Content, which caused
aktualizr-lite to always fall back to libostree pull via the mTLS
gateway remote, never invoking fiopull.

Now it returns a JSON array with the gateway's ostree base URL and a
short-lived Bearer token (same token generation pattern as app-proxy-url).
A shared lookupTokenDevice helper validates token-cache -> DeviceGet ->
context for both authToken (registry/docker, query-param) and the new
authDeviceOrBearer (ostree, Bearer header), avoiding duplication.

authDeviceOrBearer on the /ostree/* route accepts either an mTLS client
certificate (libostree path, unchanged) or an Authorization: Bearer
header (fiopull path), so both pull methods share a single route.

Signed-off-by: Andre Detsch <andre.detsch@foundries.io>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds a test environment that exercises a real aktualizr-lite device client
against a locally-run fioserver, with no Foundries factory backend dependency.

The new test (test_e2e_aklite_update_flow.py) drives the full online update
flow: device mTLS registration, ostree+compose-app update upload, check/pull/
install, simulated reboot, run, and verification of installed version, running
shellhttpd app, and server-side EcuInstallationCompleted events.

New files:
- Dockerfile.aklite: ubuntu-based aklite-dev runtime; stages the aktualizr-lite
  binary (built via the aklite repo's own containerized flow), composectl,
  make_sys_rootfs.sh, and the entrypoint. Adds glib-networking for libostree's
  libsoup3/GnuTLS HTTPS support (libostree 2025.1 uses libsoup3, not libcurl).
- entrypoint.aklite.sh: initializes an ostree sysroot with a base commit,
  writes sota conf.d snippets, creates the reboot-sentinel dir, starts dockerd.
- test_e2e_aklite_update_flow.py: the smoke test module.

Modified files:
- add_device.sh: fix device cert signing to use client auth extensions
  (digitalSignature + clientAuth) instead of CA extensions. GnuTLS strictly
  enforces key usage for mTLS client certificates.
- conftest.py: add aklite_device, aklite_docker, aklite_registered_device, and
  aklite_update fixtures; refactor shared container-launch and credential-copy
  helpers; install the factory root CA via update-ca-certificates (required for
  GnuTLS/libsoup3 to trust the server's TLS cert during ostree pulls).
- Makefile: add AKLITE_REPO var, staged binary targets, and aklite-e2e image
  build; pin AKLITE_DEV_IMAGE and pass PKCS11_ENGINE_PATH unquoted to avoid
  CMake path detection failure.

Signed-off-by: Andre Detsch <andre.detsch@foundries.io>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds test_aklite_update_flow_fiopull which exercises the fiopull ostree
pull path against update-server directly, using the Bearer token issued
by the now-implemented /ostree/download-urls endpoint.

fiopull is enabled via ostree_pull_tool = "fiopull" in a conf.d snippet.
No local HTTP server workaround is needed: update-server returns a
download URL pointing at its own /ostree endpoint together with a
short-lived token, so fiopull can fetch objects over HTTPS without
presenting an mTLS client certificate.

A second ostree commit (AKLITE_FIOPULL_TARGET_VERSION = 3) is built as a
self-contained update so the fiopull test runs after the libostree test on
the same device.

Infrastructure changes:
- Makefile/Dockerfile.aklite: add fiopull binary (built from
  foundriesio/ostreeuploader via a throwaway golang container) to the
  aklite-e2e image at /usr/bin/fiopull (the default FioPullBin path).
- conftest.py: add AKLITE_FIOPULL_TARGET_VERSION constant and
  aklite_fiopull_update fixture.

Signed-off-by: Andre Detsch <andre.detsch@foundries.io>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant