mathstuf / rust-keyutils

Rust interface to the Linux keyring
BSD 3-Clause "New" or "Revised" License
17 stars 9 forks source link

test: add basic encrypted key management tests #38

Open dlrobertson opened 4 years ago

dlrobertson commented 4 years ago

I added some basic tests for the Encrypted KeyType. Note that this change now requires CONFIG_ENCRYPTED_KEYS to be enabled for unit tests to pass.

mathstuf commented 4 years ago

:( It appears the runners do not support encrypted keys... man_shrugging maybe place the tests or all of encrypted keys behind a feature?

Yes, testing this stuff has been…painful on public CI infrastructure. They have this fetish with running as root inside containers which really messes with the permission checking done here. Quotas are also wacky and cause…interesting failures. See #34 for some fun.

mathstuf commented 4 years ago

Note that this change now requires CONFIG_ENCRYPTED_KEYS to be enabled for unit tests to pass.

34 also has code to make tests into no-ops if a feature is not supported. I wish there were a way to say "this test is skipped" in Rust, but that is tied up in rust-lang/rust#50297.

mathstuf commented 4 years ago

I've just merged #34 (with #39 as a TODO item) and some holes for tests when run as root. Please move the tests to the encrypted.rs file and use some of the patterns there for capability checking.

dlrobertson commented 4 years ago

Awesome! Will update soon