adding comment to snapshot key insert race condition test per @cyli's request

Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
This commit is contained in:
David Lawrence 2015-12-07 12:54:57 -08:00
parent 09a6fa07a1
commit fb76bca9f0
1 changed files with 4 additions and 0 deletions

View File

@ -89,6 +89,10 @@ func (ks keyStore) SetKey(gun, role, algorithm string, public []byte) error {
return &storage.ErrKeyExists{}
}
// Tests the race condition where the server is being asked to generate a new key
// by 2 parallel requests and the second insert to be executed by the DB fails
// due to duplicate key (gun + role). It should then return the key added by the
// first insert.
func TestGetSnapshotKeyExistsOnSet(t *testing.T) {
crypto := signed.NewEd25519()
key, err := crypto.Create(data.CanonicalSnapshotRole, data.ED25519Key)