[pve-devel] [PATCH installer v2 11/17] auto-installer: tests: replace manual panic!() with assert_eq!()
Aaron Lauterer
a.lauterer at proxmox.com
Tue Jul 23 12:39:20 CEST 2024
Do we still see which test case actually failed? IIRC I used the panic
so I can print the needed info, mainly the name of the current test
scenario so it is easier to find out which failed.
On 2024-07-18 15:48, Christoph Heiss wrote:
> Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
> ---
> Changes v1 -> v2:
> * new patch, suggested by Stefan
> ---
> proxmox-auto-installer/tests/parse-answer.rs | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/proxmox-auto-installer/tests/parse-answer.rs b/proxmox-auto-installer/tests/parse-answer.rs
> index 450915a..1fc515e 100644
> --- a/proxmox-auto-installer/tests/parse-answer.rs
> +++ b/proxmox-auto-installer/tests/parse-answer.rs
> @@ -75,12 +75,8 @@ fn test_parse_answers() {
> path.push(format!("{name}.json"));
> let compare_raw = std::fs::read_to_string(&path).unwrap();
> let compare: Value = serde_json::from_str(&compare_raw).unwrap();
> - if config != compare {
> - panic!(
> - "Test {} failed:\nleft: {:#?}\nright: {:#?}\n",
> - name, config, compare
> - );
> - }
> +
> + assert_eq!(config, compare);
> }
> }
> }
More information about the pve-devel
mailing list