Bug #4092
closedTest RandomKeyId in TestBackEnds could randomly fail
100%
Description
The RandomKeyId test in TestBackEnds tests whether TpmBackEnd::createKey creates a unique random key name. It is only guaranteed to be unique relative to the key names already in the store. But the RandomKeyId test deletes the key on line 256 after is is created:
https://github.com/named-data/ndn-cxx/blob/1ece2e3744fa75bb5afc0c2199a86b0b27a4de03/tests/unit-tests/security/tpm/back-end.t.cpp#L256
tpm.deleteKey(keyName);
It is possible (through very unlikely) that TpmBackEnd::createKey could generated the same key again and the test would fail. The purpose of the test is to test that createKey guarantees unique key names in the store. Its purpose is not to test the quality of the random number generator. The test is already checking for unique names by using the keyNames set. Suggestion: Simply remove deleteKey on line 256.