Skip to content

Commit

Permalink
Use latest conformance tests structure and tests
Browse files Browse the repository at this point in the history
Signed-off-by: Kate Goldenring <[email protected]>
  • Loading branch information
kate-goldenring committed Jun 25, 2024
1 parent 0a67bbb commit cecce6c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions conformance-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ homepage.workspace = true

[dependencies]
anyhow = "1.0"
conformance-tests = { git = "https://github.com/fermyon/conformance-tests" }
conformance-tests = { git = "https://github.com/fermyon/conformance-tests", ref = "c19e5cf54b7586829e923bd2091314e4d473f4f5" }
log = "0.4"
nix = "0.26"
test-environment = { git = "https://github.com/fermyon/conformance-tests" }
test-environment = { git = "https://github.com/fermyon/conformance-tests", ref = "c19e5cf54b7586829e923bd2091314e4d473f4f5" }
6 changes: 3 additions & 3 deletions conformance-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Containerd must be configured to access the `containerd-shim-spin`:
```

## Running tests
Containerd can only be executed as a root user. Choose one of the following options
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
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
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
13 changes: 10 additions & 3 deletions conformance-tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ fn main() {
.next()
.expect("expected second arg to be path to ctr binary");

'test: for test in conformance_tests::tests(&tests_dir).unwrap() {
'test: for test in conformance_tests::tests_iter(&tests_dir).unwrap() {
if test.name.starts_with("tcp") {
// Skip TCP tests for now as shim cannot create sockets
continue;
}
println!("running test: {}", test.name);
let mut services = vec!["registry".into()];
for precondition in &test.config.preconditions {
Expand All @@ -34,6 +38,9 @@ fn main() {
panic!("unsupported label: {}", k.label);
}
}
conformance_tests::config::Precondition::TcpEcho => {
services.push("tcp-echo".into());
}
}
}
let env_config = SpinShim::config(
Expand Down Expand Up @@ -98,14 +105,14 @@ impl SpinShim {
.get_port(5000)?
.context("environment doesn't expose port for OCI registry")?
);
SpinShim::regisry_push(&spin_binary, &oci_image, env)?;
SpinShim::registry_push(&spin_binary, &oci_image, env)?;
SpinShim::image_pull(&ctr_binary, &oci_image)?;
SpinShim::start(&ctr_binary, env, &oci_image, CTR_RUN_ID)
}),
}
}

pub fn regisry_push<R>(
pub fn registry_push<R>(
spin_binary_path: &Path,
image: &str,
env: &mut TestEnvironment<R>,
Expand Down

0 comments on commit cecce6c

Please sign in to comment.