Skip to content

Commit

Permalink
[FAB-10472] Fix configless e2e test
Browse files Browse the repository at this point in the history
Load certs and keys before referencing
them or else the bytes will be nil.

Change-Id: Id24fcf4be4d8fe6b4b11ef3dda3e667e37387abb
Signed-off-by: Bob Stasyszyn <[email protected]>
  • Loading branch information
bstasyszyn committed May 30, 2018
1 parent c247930 commit 58ce93d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/integration/e2e/configless/endpointconfig_override_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,10 @@ func (m *exampleTLSClientCerts) TLSClientCerts() ([]tls.Certificate, error) {
m.RWLock = &sync.RWMutex{}
}
var clientCerts tls.Certificate
err := clientConfig.TLSCerts.Client.Cert.LoadBytes()
if err != nil {
return nil, err
}
cb := clientConfig.TLSCerts.Client.Cert.Bytes()

if len(cb) == 0 {
Expand Down Expand Up @@ -760,10 +764,14 @@ func (m *exampleTLSClientCerts) TLSClientCerts() ([]tls.Certificate, error) {
}
func (m *exampleTLSClientCerts) loadPrivateKeyFromConfig(clientConfig *msp.ClientConfig, clientCerts tls.Certificate, cb []byte) ([]tls.Certificate, error) {

err := clientConfig.TLSCerts.Client.Key.LoadBytes()
if err != nil {
return nil, err
}
kb := clientConfig.TLSCerts.Client.Key.Bytes()

// load the key/cert pair from []byte
clientCerts, err := tls.X509KeyPair(cb, kb)
clientCerts, err = tls.X509KeyPair(cb, kb)
if err != nil {
return nil, errors.Errorf("Error loading cert/key pair as TLS client credentials: %v", err)
}
Expand Down

0 comments on commit 58ce93d

Please sign in to comment.