Skip to content

Commit 066301f

Browse files
Merge pull request #134 from kate-goldenring/conformance-tests
Conformance Testing Setup for Shim
2 parents 1018a17 + 5e4ac59 commit 066301f

File tree

5 files changed

+436
-2
lines changed

5 files changed

+436
-2
lines changed

Cargo.lock

Lines changed: 94 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ homepage = "https://github.com/spinkube/containerd-shim-spin"
1111
resolver = "2"
1212
members = [
1313
"tests",
14-
"containerd-shim-spin"
15-
]
14+
"containerd-shim-spin",
15+
"conformance-tests"
16+
]

conformance-tests/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "conformance-tests"
3+
version.workspace = true
4+
edition.workspace = true
5+
license.workspace = true
6+
readme.workspace = true
7+
repository.workspace = true
8+
homepage.workspace = true
9+
10+
[dependencies]
11+
anyhow = "1.0"
12+
conformance-tests = { git = "https://github.com/fermyon/conformance-tests", ref = "db0ee32a825561d35f884a246e1d390134d78823" }
13+
log = "0.4"
14+
nix = "0.26"
15+
test-environment = { git = "https://github.com/fermyon/conformance-tests", ref = "db0ee32a825561d35f884a246e1d390134d78823" }

conformance-tests/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Spin Conformance Tests
2+
3+
A set of Spin [conformance tests](https://github.com/fermyon/conformance-tests) that ensures that this shim is a compliant runtime.
4+
5+
## Prerequisites
6+
The following must be installed:
7+
- `containerd`
8+
- `ctr`
9+
- `containerd-shim-spin`
10+
11+
Containerd must be configured to access the `containerd-shim-spin`:
12+
13+
1. Build the shim and add it to `$PATH`:
14+
```sh
15+
cargo build --release
16+
sudo cp target/release/containerd-shim-spin-v2 /usr/bin/
17+
```
18+
2. Configure containerd to add the Spin shim as a runtime by adding the following to `/etc/containerd/config.toml`:
19+
```toml
20+
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.spin]
21+
runtime_type = "/usr/bin/containerd-shim-spin-v2"
22+
```
23+
3. Restart containerd if it is running as a service
24+
```sh
25+
systemctl restart containerd
26+
```
27+
28+
## Running tests
29+
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.
30+
1. Build the `conformance-tests` bin and excute it as sudo user:
31+
```sh
32+
cargo build
33+
sudo ../target/debug/conformance-tests /path/to/spin /path/to/ctr
34+
```
35+
2. Run cargo as root by passing in the environment from the user's context and full path to cargo:
36+
```sh
37+
sudo -E $HOME/.cargo/bin/cargo run /path/to/spin /path/to/ctr
38+
```
39+
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

0 commit comments

Comments
 (0)