Skip to content

Commit

Permalink
[FAB-3732] Fix e2e cli
Browse files Browse the repository at this point in the history
While cleaning up before submitting
https://gerrit.hyperledger.org/r/#/c/9069
I accidentally removed a small but important
change.  This patch fixes that and also adjusts
the test cases to catch this in the future by
changing using different counts for app and
orderer CAs

Patch 2 changes the ports in one of the tests
since they seem to fail now

Change-Id: Ifdfe6f252c4f7ce7b3938ac322f33430916802b4
Signed-off-by: Gari Singh <gari.r.singh@gmail.com>
  • Loading branch information
mastersingh24 committed May 8, 2017
1 parent 8f4b6a9 commit 70b59b0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
4 changes: 1 addition & 3 deletions core/comm/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,12 @@ func (cas *CASupport) GetServerRootCAs() (appRootCAs, ordererRootCAs [][]byte) {
appRootCAs = append(appRootCAs, appRootCA...)
}

for _, ordererRootCA := range cas.AppRootCAsByChain {
for _, ordererRootCA := range cas.OrdererRootCAsByChain {
ordererRootCAs = append(ordererRootCAs, ordererRootCA...)
}

// also need to append statically configured root certs
appRootCAs = append(appRootCAs, cas.ServerRootCAs...)
ordererRootCAs = append(ordererRootCAs, cas.ServerRootCAs...)
return appRootCAs, ordererRootCAs
}

Expand Down Expand Up @@ -158,7 +157,6 @@ func (cas *CASupport) GetClientRootCAs() (appRootCAs, ordererRootCAs [][]byte) {

// also need to append statically configured root certs
appRootCAs = append(appRootCAs, cas.ClientRootCAs...)
ordererRootCAs = append(ordererRootCAs, cas.ClientRootCAs...)
return appRootCAs, ordererRootCAs
}

Expand Down
17 changes: 9 additions & 8 deletions core/comm/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,23 @@ func TestCASupport(t *testing.T) {
cas := GetCASupport()
cas.AppRootCAsByChain["channel1"] = [][]byte{rootCAs[0]}
cas.AppRootCAsByChain["channel2"] = [][]byte{rootCAs[1]}
cas.OrdererRootCAsByChain["channel1"] = [][]byte{(rootCAs[2])}
cas.OrdererRootCAsByChain["channel2"] = [][]byte{rootCAs[3]}
cas.ServerRootCAs = [][]byte{rootCAs[4]}
cas.ClientRootCAs = [][]byte{rootCAs[4], rootCAs[5]}
cas.AppRootCAsByChain["channel3"] = [][]byte{rootCAs[2]}
cas.OrdererRootCAsByChain["channel1"] = [][]byte{(rootCAs[3])}
cas.OrdererRootCAsByChain["channel2"] = [][]byte{rootCAs[4]}
cas.ServerRootCAs = [][]byte{rootCAs[5]}
cas.ClientRootCAs = [][]byte{rootCAs[5]}

appServerRoots, ordererServerRoots := cas.GetServerRootCAs()
t.Logf("%d appServerRoots | %d ordererServerRoots", len(appServerRoots),
len(ordererServerRoots))
assert.Equal(t, 3, len(appServerRoots), "Expected 3 app server root CAs")
assert.Equal(t, 3, len(ordererServerRoots), "Expected 3 orderer server root CAs")
assert.Equal(t, 4, len(appServerRoots), "Expected 4 app server root CAs")
assert.Equal(t, 2, len(ordererServerRoots), "Expected 2 orderer server root CAs")

appClientRoots, ordererClientRoots := cas.GetClientRootCAs()
t.Logf("%d appClientRoots | %d ordererClientRoots", len(appClientRoots),
len(ordererClientRoots))
assert.Equal(t, 4, len(appClientRoots), "Expected 4 app server root CAs")
assert.Equal(t, 4, len(ordererClientRoots), "Expected 4 orderer server root CAs")
assert.Equal(t, 4, len(appClientRoots), "Expected 4 app client root CAs")
assert.Equal(t, 2, len(ordererClientRoots), "Expected 4 orderer client root CAs")

// make sure we really have a singleton
casClone := GetCASupport()
Expand Down
4 changes: 2 additions & 2 deletions core/peer/pkg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func TestUpdateRootsFromConfigBlock(t *testing.T) {

{
name: "MutualTLSOrg1Org1",
listenAddress: fmt.Sprintf("localhost:%d", 4052),
listenAddress: fmt.Sprintf("localhost:%d", 4051),
secureConfig: comm.SecureServerConfig{
UseTLS: true,
ServerCertificate: org1Server1Cert,
Expand All @@ -254,7 +254,7 @@ func TestUpdateRootsFromConfigBlock(t *testing.T) {
},
{
name: "MutualTLSOrg1Org2",
listenAddress: fmt.Sprintf("localhost:%d", 4053),
listenAddress: fmt.Sprintf("localhost:%d", 4052),
secureConfig: comm.SecureServerConfig{
UseTLS: true,
ServerCertificate: org1Server1Cert,
Expand Down

0 comments on commit 70b59b0

Please sign in to comment.