Skip to content

Commit

Permalink
Handle metadata command not being supported in test (#516)
Browse files Browse the repository at this point in the history
Some YubiKeys don't support this command. Instead of failing the test
when it happens, log a warning message instead.
  • Loading branch information
tony-iqlusion authored Aug 16, 2023
1 parent 7831336 commit 75ce24a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/integration.rs
Original file line number Diff line number Diff line change
@@ -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]

0 comments on commit 75ce24a

Please sign in to comment.