From 75ce24a3eae6e0fc347037d6a421c3561a664e10 Mon Sep 17 00:00:00 2001 From: "Tony Arcieri (iqlusion)" Date: Tue, 15 Aug 2023 17:21:45 -0700 Subject: [PATCH] Handle metadata command not being supported in test (#516) Some YubiKeys don't support this command. Instead of failing the test when it happens, log a warning message instead. --- tests/integration.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/integration.rs b/tests/integration.rs index 8fa38205..e75d0f0f 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -303,9 +303,14 @@ fn test_read_metadata() { ) .unwrap(); - let metadata = piv::metadata(&mut yubikey, slot).unwrap(); - - assert_eq!(metadata.public, Some(generated)); + match piv::metadata(&mut yubikey, slot) { + Ok(metadata) => assert_eq!(metadata.public, Some(generated)), + Err(Error::NotSupported) => { + // Some YubiKeys don't support metadata + eprintln!("metadata not supported by this YubiKey"); + } + Err(err) => panic!("{}", err), + } } #[test]