Added error check after GenerateDefaultKeyPair

This commit is contained in:
dharanikumar-s 2020-07-05 22:38:45 +05:30
parent 2479371c06
commit 0c21f0ae9e

View file

@ -372,6 +372,7 @@ ZYtQ9Ot36qc=
func TestAuthority_RenewOrRekey(t *testing.T) { func TestAuthority_RenewOrRekey(t *testing.T) {
pub, _, err := keys.GenerateDefaultKeyPair() pub, _, err := keys.GenerateDefaultKeyPair()
assert.FatalError(t, err)
pub1, _, err := keys.GenerateDefaultKeyPair() pub1, _, err := keys.GenerateDefaultKeyPair()
assert.FatalError(t, err) assert.FatalError(t, err)
@ -479,9 +480,9 @@ func TestAuthority_RenewOrRekey(t *testing.T) {
var certChain []*x509.Certificate var certChain []*x509.Certificate
if tc.auth != nil { if tc.auth != nil {
certChain, err = tc.auth.RenewOrRekey(tc.cert,pub1) certChain, err = tc.auth.RenewOrRekey(tc.cert, pub1)
} else { } else {
certChain, err = a.RenewOrRekey(tc.cert,pub1) certChain, err = a.RenewOrRekey(tc.cert, pub1)
} }
if err != nil { if err != nil {
if assert.NotNil(t, tc.err, fmt.Sprintf("unexpected error: %s", err)) { if assert.NotNil(t, tc.err, fmt.Sprintf("unexpected error: %s", err)) {