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

Conformance Testing Setup for Shim #134

Merged
merged 9 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
94 changes: 94 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ homepage = "https://github.com/spinkube/containerd-shim-spin"
resolver = "2"
members = [
"tests",
"containerd-shim-spin"
]
"containerd-shim-spin",
"conformance-tests"
]
15 changes: 15 additions & 0 deletions conformance-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "conformance-tests"
version.workspace = true
edition.workspace = true
license.workspace = true
readme.workspace = true
repository.workspace = true
homepage.workspace = true

[dependencies]
anyhow = "1.0"
conformance-tests = { git = "https://github.com/fermyon/conformance-tests", ref = "db0ee32a825561d35f884a246e1d390134d78823" }
log = "0.4"
nix = "0.26"
test-environment = { git = "https://github.com/fermyon/conformance-tests", ref = "db0ee32a825561d35f884a246e1d390134d78823" }
39 changes: 39 additions & 0 deletions conformance-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Spin Conformance Tests

A set of Spin [conformance tests](https://github.com/fermyon/conformance-tests) that ensures that this shim is a compliant runtime.

## Prerequisites
The following must be installed:
- `containerd`
- `ctr`
- `containerd-shim-spin`

Containerd must be configured to access the `containerd-shim-spin`:

1. Build the shim and add it to `$PATH`:
```sh
cargo build --release
sudo cp target/release/containerd-shim-spin-v2 /usr/bin/
```
2. Configure containerd to add the Spin shim as a runtime by adding the following to `/etc/containerd/config.toml`:
```toml
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.spin]
runtime_type = "/usr/bin/containerd-shim-spin-v2"
```
3. Restart containerd if it is running as a service
```sh
systemctl restart containerd
```

## Running tests
Containerd can only be executed as a root user. Choose one of the following option, being sure to pass the path to the Spin and `ctr` binaries as arguments.
1. Build the `conformance-tests` bin and excute it as sudo user:
```sh
cargo build
sudo ../target/debug/conformance-tests /path/to/spin /path/to/ctr
```
2. Run cargo as root by passing in the environment from the user's context and full path to cargo:
```sh
sudo -E $HOME/.cargo/bin/cargo run /path/to/spin /path/to/ctr
```
3. Follow the [containerd instructions](https://github.com/containerd/containerd/blob/main/docs/rootless.md) to configure it to be runnable as a non-root user
Loading