Skip to content

Commit 7cacbc5

Browse files
rylevkate-goldenring
authored andcommitted
Use local registry
Signed-off-by: Ryan Levick <[email protected]>
1 parent 70cad6e commit 7cacbc5

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

conformance-tests/src/main.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn main() {
2323

2424
'test: for test in conformance_tests::tests(&tests_dir).unwrap() {
2525
println!("running test: {}", test.name);
26-
let mut services = Vec::new();
26+
let mut services = vec!["registry".into()];
2727
for precondition in &test.config.preconditions {
2828
match precondition {
2929
conformance_tests::config::Precondition::HttpEcho => {
@@ -36,12 +36,10 @@ fn main() {
3636
}
3737
}
3838
}
39-
// Just using TTL.sh until we decide where to host these (local registry, ghcr, etc)
40-
let oci_image = format!("ttl.sh/{}:72h", test.name);
4139
let env_config = SpinShim::config(
4240
ctr_binary.into(),
4341
spin_binary.into(),
44-
oci_image.clone(),
42+
test.name.clone(),
4543
test_environment::services::ServicesConfig::new(services).unwrap(),
4644
);
4745
let mut env = TestEnvironment::up(env_config, move |e| {
@@ -94,6 +92,12 @@ impl SpinShim {
9492
TestEnvironmentConfig {
9593
services_config,
9694
create_runtime: Box::new(move |env| {
95+
let oci_image = format!(
96+
"localhost:{port}/{oci_image}:latest",
97+
port = env
98+
.get_port(5000)?
99+
.context("environment doesn't expose port for OCI registry")?
100+
);
97101
SpinShim::regisry_push(&spin_binary, &oci_image, env)?;
98102
SpinShim::image_pull(&ctr_binary, &oci_image)?;
99103
SpinShim::start(&ctr_binary, env, &oci_image, CTR_RUN_ID)
@@ -108,7 +112,7 @@ impl SpinShim {
108112
) -> anyhow::Result<()> {
109113
// TODO: consider enabling configuring a port
110114
let mut cmd = Command::new(spin_binary_path);
111-
cmd.args(["registry", "push"]).arg(image);
115+
cmd.args(["registry", "push", "-k"]).arg(image);
112116
env.run_in(&mut cmd)
113117
.context("failed to push spin app to registry with 'spin'")?;
114118
Ok(())
@@ -126,7 +130,6 @@ impl SpinShim {
126130
}
127131

128132
/// Start the Spin app using `ctr run`
129-
/// Equivalent of `sudo ctr run --rm --net-host --runtime io.containerd.spin.v2 ttl.sh/myapp:48h ctr-run-id bogus-arg` for image `ttl.sh/myapp:48h` and run id `ctr-run-id`
130133
pub fn start<R>(
131134
ctr_binary_path: &Path,
132135
env: &mut TestEnvironment<R>,

0 commit comments

Comments
 (0)