fix (servers): return unhandled err from storeRootCertificates(...) (#2127)

This commit is contained in:
Jim authored and GitHub committed 2022-06-03 09:14:45 -04:00
1 parent ded44710d5
commit 78ffd82581
2 files changed
+7 -1

No files matched your search

+6 -1
View File
@@ -248,8 +248,13 @@ func (r *WorkerAuthRepositoryStorage) storeRootCertificates(ctx context.Context,
}
nextCert, err := r.convertRootCertificate(ctx, cert.Next)
if err != nil {
return errors.Wrap(ctx, err, op, errors.WithMsg("unable to convert next root certificate"))
}
currentCert, err := r.convertRootCertificate(ctx, cert.Current)
if err != nil {
return errors.Wrap(ctx, err, op, errors.WithMsg("unable to convert current root certificate"))
}
// Use passed version
var result rootCertificatesVersion
err = mapstructure.Decode(cert.State.AsMap(), &result)
@@ -255,6 +255,7 @@ func TestDuplicateRootCert(t *testing.T) {
current2, err := newRootCertificate(ctx, rand.Uint64(), populateBytes(defaultLength), beforeTimestamp, afterTimestamp,
RootCertificateKeys{publicKey: populateBytes(defaultLength), privateKey: populateBytes(defaultLength)},
testKey, CurrentState)
require.NoError(t, err)
next1, err := newRootCertificate(ctx, rand.Uint64(), populateBytes(defaultLength), beforeTimestamp, afterTimestamp,
RootCertificateKeys{publicKey: populateBytes(defaultLength), privateKey: populateBytes(defaultLength)},
testKey, NextState)