mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-01-07 14:05:50 +00:00
Add tests for the new cert controllers and some other small refactorings
- Add a unit test for each cert controller - Make DynamicTLSServingCertProvider an interface and use a mutex internally - Create a shared ToPEM function instead of having two very similar functions - Move the ObservableWithInformerOption test helper to testutils - Rename some variables and imports
This commit is contained in:
@@ -195,6 +195,16 @@ func toPEM(cert *tls.Certificate, err error) ([]byte, []byte, error) {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
certPEM, keyPEM, err := ToPEM(cert)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return certPEM, keyPEM, nil
|
||||
}
|
||||
|
||||
// Encode a tls.Certificate into a private key PEM and a cert chain PEM.
|
||||
func ToPEM(cert *tls.Certificate) ([]byte, []byte, error) {
|
||||
// Encode the certificate(s) to PEM.
|
||||
certPEMBlocks := make([][]byte, 0, len(cert.Certificate))
|
||||
for _, c := range cert.Certificate {
|
||||
|
||||
Reference in New Issue
Block a user