Add an assertion that the private key and cert chain match in certs_manager_test.go
Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
parent
fadd718d08
commit
5ec1fbd1ca
@ -7,6 +7,7 @@ package apicerts
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"crypto/tls"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"errors"
|
"errors"
|
||||||
@ -239,8 +240,9 @@ func TestManagerControllerSync(t *testing.T) {
|
|||||||
r.WithinDuration(time.Now(), parsedCert.NotBefore, time.Minute*2)
|
r.WithinDuration(time.Now(), parsedCert.NotBefore, time.Minute*2)
|
||||||
r.WithinDuration(time.Now().Add(24*365*time.Hour), parsedCert.NotAfter, time.Minute*2)
|
r.WithinDuration(time.Now().Add(24*365*time.Hour), parsedCert.NotAfter, time.Minute*2)
|
||||||
|
|
||||||
// TODO How can we validate that the actualPrivateKey is correct and works with the other cert values?
|
// Check that the private key and cert chain match
|
||||||
// Maybe start a test http server using these certs and then make a request to it using the actualCACert?
|
_, err = tls.X509KeyPair([]byte(actualCertChain), []byte(actualPrivateKey))
|
||||||
|
r.NoError(err)
|
||||||
|
|
||||||
// Make sure we updated the APIService caBundle and left it otherwise unchanged
|
// Make sure we updated the APIService caBundle and left it otherwise unchanged
|
||||||
r.Len(aggregatorAPIClient.Actions(), 2)
|
r.Len(aggregatorAPIClient.Actions(), 2)
|
||||||
|
Loading…
Reference in New Issue
Block a user