diff --git a/pkgs/id/src/meta_client.rs b/pkgs/id/src/meta_client.rs index 25826a25c..9faadc0aa 100644 --- a/pkgs/id/src/meta_client.rs +++ b/pkgs/id/src/meta_client.rs @@ -54,7 +54,7 @@ pub fn expect_ok(resp: MetaResponse) -> Result { pub fn capped_response_error(err: ReadToEndError) -> anyhow::Error { match err { ReadToEndError::TooLong => anyhow::anyhow!( - "response too large: exceeds the {MAX_RESPONSE_BYTES}-byte limit (MAX_RESPONSE_BYTES)" + "response too large: exceeds the {MAX_RESPONSE_BYTES}-byte limit" ), other => other.into(), } @@ -248,7 +248,10 @@ mod tests { fn over_cap_error_names_the_limit() { let err = capped_response_error(ReadToEndError::TooLong); let msg = format!("{err}"); - assert!(msg.contains("response too large"), "{msg}"); - assert!(msg.contains(&MAX_RESPONSE_BYTES.to_string()), "{msg}"); + assert_eq!( + msg, + format!("response too large: exceeds the {MAX_RESPONSE_BYTES}-byte limit"), + "the message must be exactly the named limit, with no leftover placeholder text" + ); } }