Skip to content

Commit

Permalink
Merge pull request #76 from webern/fix-pubsys-repo-expiration-bug
Browse files Browse the repository at this point in the history
pubsys-setup: fix repo expiration deserialization bug
  • Loading branch information
webern authored Sep 20, 2023
2 parents 15c67f8 + 0287973 commit 0d55fba
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tools/pubsys-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ fn deserialize_offset<'de, D>(deserializer: D) -> std::result::Result<Duration,
where
D: Deserializer<'de>,
{
let s: &str = Deserialize::deserialize(deserializer)?;
parse_offset(s).map_err(serde::de::Error::custom)
let s: String = Deserialize::deserialize(deserializer)?;
parse_offset(&s).map_err(serde::de::Error::custom)
}

mod error {
Expand Down Expand Up @@ -277,3 +277,14 @@ mod error {
}
pub use error::Error;
pub type Result<T> = std::result::Result<T, error::Error>;

#[test]
fn repo_expiration_deserialization_test() {
let path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("..")
.join("pubsys")
.join("policies")
.join("repo-expiration")
.join("2w-2w-1w.toml");
let _ = RepoExpirationPolicy::from_path(path).unwrap();
}

0 comments on commit 0d55fba

Please sign in to comment.