-
Notifications
You must be signed in to change notification settings - Fork 733
test(snap): add spread integration tests #1465
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| default_sandbox_image=ghcr.io/nvidia/openshell-community/sandboxes/base:latest | ||
|
|
||
| define install_and_setup_docker | ||
| - addgroup --system docker | ||
| - snap install docker | ||
| - while [ ! -S /run/docker.sock ]; do sleep 3; done | ||
| - "snap run docker pull $(default_sandbox_image)" | ||
| endef | ||
|
|
||
| define UBUNTU_CLOUD_INIT_USER_DATA_TEMPLATE | ||
| $(CLOUD_INIT_USER_DATA_TEMPLATE) | ||
| - snap wait system seed.loaded | ||
| $(install_and_setup_docker) | ||
| endef | ||
|
|
||
| define DEBIAN_CLOUD_INIT_USER_DATA_TEMPLATE | ||
| $(CLOUD_INIT_USER_DATA_TEMPLATE) | ||
| - systemctl enable --now snapd.socket snapd.service snapd.apparmor.service | ||
| - snap wait system seed.loaded | ||
| $(install_and_setup_docker) | ||
| packages: | ||
| - snapd | ||
| endef | ||
|
|
||
| define FEDORA_CLOUD_INIT_USER_DATA_TEMPLATE | ||
| $(CLOUD_INIT_USER_DATA_TEMPLATE) | ||
| - dnf install -y snapd | ||
| - systemctl enable --now snapd.socket | ||
| - snap wait system seed.loaded | ||
| - sudo ln -s /var/lib/snapd/snap /snap | ||
| $(install_and_setup_docker) | ||
| endef | ||
|
|
||
| define CENTOS_CLOUD_INIT_USER_DATA_TEMPLATE | ||
| $(CLOUD_INIT_USER_DATA_TEMPLATE) | ||
| - yum install -y epel-release | ||
| - yum install -y snapd | ||
| - systemctl enable --now snapd.socket snapd.service | ||
| - snap wait system seed.loaded | ||
| - sudo ln -s /var/lib/snapd/snap /snap | ||
| $(install_and_setup_docker) | ||
| endef |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we instead add |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| *.img | ||
| *.iso | ||
| *.lock | ||
| *.log | ||
| *.meta-data | ||
| *.qcow2 | ||
| *.run | ||
| *.user-data |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| project: openshell | ||
|
|
||
| backends: | ||
| garden: | ||
| type: adhoc | ||
| allocate: | | ||
| if [ -n "${SPREAD_HOST_PATH-}" ]; then | ||
| PATH="${SPREAD_HOST_PATH}" | ||
| fi | ||
| exec image-garden allocate --spread "$SPREAD_SYSTEM"."$(uname -m)" | ||
| discard: | | ||
| if [ -n "${SPREAD_HOST_PATH-}" ]; then | ||
| PATH="${SPREAD_HOST_PATH}" | ||
| fi | ||
| image-garden discard "$SPREAD_SYSTEM_ADDRESS" | ||
| systems: | ||
| - ubuntu-cloud-24.04: | ||
| username: ubuntu | ||
| password: ubuntu | ||
| - ubuntu-cloud-26.04: | ||
| username: ubuntu | ||
| password: ubuntu | ||
| - debian-cloud-13: | ||
| username: debian | ||
| password: debian | ||
| - fedora-cloud-44: | ||
| username: fedora | ||
| password: fedora | ||
|
|
||
| exclude: | ||
| - ".cache/*" | ||
| - ".image-garden/*" | ||
| - "target/*" | ||
|
|
||
| path: /root/openshell | ||
|
|
||
| prepare: | | ||
| # Install the openshell snap that was copied into the test environment. | ||
| snap install $(ls ./openshell_*.snap | sort -r | head -n 1) --dangerous | ||
|
|
||
| # Connect snap interfaces. When installing from the store this | ||
| # is auto-connected by the snap declaration assertion, but locally | ||
| # we need to do it manually. | ||
| snap connect openshell:docker docker:docker-daemon | ||
| snap connect openshell:log-observe | ||
| snap connect openshell:system-observe | ||
| snap connect openshell:ssh-keys | ||
|
|
||
| # Add the local gateway to user configuration. | ||
| openshell gateway add http://127.0.0.1:17670 --local --name snap-docker | ||
| openshell gateway select snap-docker | ||
| openshell status | ||
|
|
||
| debug-each: | | ||
| echo "Kernel and architecture:" | ||
| uname -a | ||
|
|
||
| echo "OS release info:" | ||
| cat /etc/os-release | ||
|
|
||
| echo "Installed snaps:" | ||
| snap list | ||
|
|
||
| set +e | ||
|
|
||
| echo "Snap connections of the openshell snap:" | ||
| snap connections openshell | ||
|
|
||
| echo "Openshell version:" | ||
| snap run openshell --version | ||
|
|
||
| suites: | ||
| tests/: | ||
| summary: Smoke tests for OpenShell snap |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how is this used? do you see this getting expandded for non snap use cases? i'd prefer to keep snap specific infra in |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| summary: Smoke test for creating a sandbox | ||
| details: | | ||
| This test verifies that the openshell snap is properly installed | ||
| and that the openshell command is available and functional. | ||
| A test sandbox is created on the selected gateway. A hello world program is | ||
| then invoked in the sandbox. | ||
|
|
||
| prepare: | | ||
| snap run openshell sandbox list | MATCH "No sandboxes found." | ||
|
|
||
| execute: | | ||
| snap run openshell sandbox create -- echo "Hello, OpenShell!" | MATCH "Hello, OpenShell!" | ||
| snap run openshell sandbox list | MATCH ".*Ready" | ||
|
|
||
| restore: | | ||
| snap run openshell sandbox delete --all | MATCH ".*Deleted.*" | ||
| snap run openshell sandbox list | MATCH "No sandboxes found." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is this used?