Skip to content

Commit ad6f4e0

Browse files
committed
fix wrong edf image formatting
1 parent 4d0a7f0 commit ad6f4e0

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coman/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "coman"
3-
version = "0.2.3"
3+
version = "0.2.4"
44
edition = "2024"
55
description = "Compute Manager for managing HPC compute"
66
authors = ["Ralf Grubenmann <ralf.grubenmann@sdsc.ethz.ch>"]

coman/src/util/types.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl DockerImageUrl {
5555
pub fn to_edf(&self) -> String {
5656
format!(
5757
"{}{}{}{}",
58-
self.registry.clone().map(|r| format!("{r}/")).unwrap_or_default(),
58+
self.registry.clone().map(|r| format!("{r}#")).unwrap_or_default(),
5959
self.image,
6060
self.tag.clone().map(|t| format!(":{}", t)).unwrap_or_default(),
6161
self.digest
@@ -213,4 +213,17 @@ mod tests {
213213
assert_eq!(image.tag, expected.2.map(|s| s.to_owned()));
214214
assert_eq!(image.digest, expected.3.map(|s| s.to_owned()));
215215
}
216+
217+
#[rstest]
218+
#[case((None, "ubuntu", None, None), "ubuntu")]
219+
#[case((Some("ghcr.io"), "test/ubuntu",Some("latest"),Some("deadbeef")), "ghcr.io#test/ubuntu:latest@sha256:deadbeef")]
220+
fn test_edf(#[case] values: (Option<&str>, &str, Option<&str>, Option<&str>), #[case] expected_edf: &str) {
221+
let image = DockerImageUrl {
222+
registry: values.0.map(|s| s.to_owned()),
223+
image: values.1.to_owned(),
224+
tag: values.2.map(|s| s.to_owned()),
225+
digest: values.3.map(|s| s.to_owned()),
226+
};
227+
assert_eq!(image.to_edf(), expected_edf);
228+
}
216229
}

0 commit comments

Comments
 (0)