-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from kate-goldenring/conformance-tests
Conformance Testing Setup for Shim
- Loading branch information
Showing
5 changed files
with
436 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.