Skip to content

Commit 70b59b0

Browse files
committed
[FAB-3732] Fix e2e cli
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 <[email protected]>
1 parent 8f4b6a9 commit 70b59b0

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

core/comm/connection.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,12 @@ func (cas *CASupport) GetServerRootCAs() (appRootCAs, ordererRootCAs [][]byte) {
7575
appRootCAs = append(appRootCAs, appRootCA...)
7676
}
7777

78-
for _, ordererRootCA := range cas.AppRootCAsByChain {
78+
for _, ordererRootCA := range cas.OrdererRootCAsByChain {
7979
ordererRootCAs = append(ordererRootCAs, ordererRootCA...)
8080
}
8181

8282
// also need to append statically configured root certs
8383
appRootCAs = append(appRootCAs, cas.ServerRootCAs...)
84-
ordererRootCAs = append(ordererRootCAs, cas.ServerRootCAs...)
8584
return appRootCAs, ordererRootCAs
8685
}
8786

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

159158
// also need to append statically configured root certs
160159
appRootCAs = append(appRootCAs, cas.ClientRootCAs...)
161-
ordererRootCAs = append(ordererRootCAs, cas.ClientRootCAs...)
162160
return appRootCAs, ordererRootCAs
163161
}
164162

core/comm/connection_test.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -117,22 +117,23 @@ func TestCASupport(t *testing.T) {
117117
cas := GetCASupport()
118118
cas.AppRootCAsByChain["channel1"] = [][]byte{rootCAs[0]}
119119
cas.AppRootCAsByChain["channel2"] = [][]byte{rootCAs[1]}
120-
cas.OrdererRootCAsByChain["channel1"] = [][]byte{(rootCAs[2])}
121-
cas.OrdererRootCAsByChain["channel2"] = [][]byte{rootCAs[3]}
122-
cas.ServerRootCAs = [][]byte{rootCAs[4]}
123-
cas.ClientRootCAs = [][]byte{rootCAs[4], rootCAs[5]}
120+
cas.AppRootCAsByChain["channel3"] = [][]byte{rootCAs[2]}
121+
cas.OrdererRootCAsByChain["channel1"] = [][]byte{(rootCAs[3])}
122+
cas.OrdererRootCAsByChain["channel2"] = [][]byte{rootCAs[4]}
123+
cas.ServerRootCAs = [][]byte{rootCAs[5]}
124+
cas.ClientRootCAs = [][]byte{rootCAs[5]}
124125

125126
appServerRoots, ordererServerRoots := cas.GetServerRootCAs()
126127
t.Logf("%d appServerRoots | %d ordererServerRoots", len(appServerRoots),
127128
len(ordererServerRoots))
128-
assert.Equal(t, 3, len(appServerRoots), "Expected 3 app server root CAs")
129-
assert.Equal(t, 3, len(ordererServerRoots), "Expected 3 orderer server root CAs")
129+
assert.Equal(t, 4, len(appServerRoots), "Expected 4 app server root CAs")
130+
assert.Equal(t, 2, len(ordererServerRoots), "Expected 2 orderer server root CAs")
130131

131132
appClientRoots, ordererClientRoots := cas.GetClientRootCAs()
132133
t.Logf("%d appClientRoots | %d ordererClientRoots", len(appClientRoots),
133134
len(ordererClientRoots))
134-
assert.Equal(t, 4, len(appClientRoots), "Expected 4 app server root CAs")
135-
assert.Equal(t, 4, len(ordererClientRoots), "Expected 4 orderer server root CAs")
135+
assert.Equal(t, 4, len(appClientRoots), "Expected 4 app client root CAs")
136+
assert.Equal(t, 2, len(ordererClientRoots), "Expected 4 orderer client root CAs")
136137

137138
// make sure we really have a singleton
138139
casClone := GetCASupport()

core/peer/pkg_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ func TestUpdateRootsFromConfigBlock(t *testing.T) {
238238

239239
{
240240
name: "MutualTLSOrg1Org1",
241-
listenAddress: fmt.Sprintf("localhost:%d", 4052),
241+
listenAddress: fmt.Sprintf("localhost:%d", 4051),
242242
secureConfig: comm.SecureServerConfig{
243243
UseTLS: true,
244244
ServerCertificate: org1Server1Cert,
@@ -254,7 +254,7 @@ func TestUpdateRootsFromConfigBlock(t *testing.T) {
254254
},
255255
{
256256
name: "MutualTLSOrg1Org2",
257-
listenAddress: fmt.Sprintf("localhost:%d", 4053),
257+
listenAddress: fmt.Sprintf("localhost:%d", 4052),
258258
secureConfig: comm.SecureServerConfig{
259259
UseTLS: true,
260260
ServerCertificate: org1Server1Cert,

0 commit comments

Comments
 (0)