Root is always on disk unless restored from backup.

(In which case if Yubikey is available, it will only be on the Yubikey and not on disk.)

Signed-off-by: Ying Li <ying.li@docker.com>
This commit is contained in:
Ying Li 2016-01-25 12:13:02 -08:00
parent 20648f18e9
commit b51d1e8cf8
1 changed files with 4 additions and 2 deletions

View File

@ -743,14 +743,16 @@ func TestClientCertInteraction(t *testing.T) {
_, err = runCommand(t, tempDir, "-s", server.URL, "init", "gun2")
assert.NoError(t, err)
certs := assertNumCerts(t, tempDir, 2)
assertNumKeys(t, tempDir, 1, 4, !rootOnHardware())
// root is always on disk, because even if there's a yubikey a backup is created
assertNumKeys(t, tempDir, 1, 4, true)
// remove certs for one gun
_, err = runCommand(t, tempDir, "cert", "remove", "-g", "gun1", "-y")
assert.NoError(t, err)
certs = assertNumCerts(t, tempDir, 1)
// assert that when we remove cert by gun, we do not remove repo signing keys
assertNumKeys(t, tempDir, 1, 4, !rootOnHardware())
// (root is always on disk, because even if there's a yubikey a backup is created)
assertNumKeys(t, tempDir, 1, 4, true)
// assert that when we remove cert by gun, we also remove TUF metadata
_, err = os.Stat(filepath.Join(tempDir, "tuf", "gun1"))
assert.Error(t, err)