Skip to content

Commit

Permalink
Merge pull request #134 from kate-goldenring/conformance-tests
Browse files Browse the repository at this point in the history
Conformance Testing Setup for Shim
  • Loading branch information
kate-goldenring authored Jun 27, 2024
2 parents 1018a17 + 5e4ac59 commit 066301f
Show file tree
Hide file tree
Showing 5 changed files with 436 additions and 2 deletions.
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

0 comments on commit 066301f

Please sign in to comment.