Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit 7d9ebd2

Browse files
committed
[FAB-10556] CI: orderer panic on multi config update
The multi org integration test perioidically fails due to a Fabric 1.0 orderer panic. This change adjusts this test to wait between each config update for the orderer to advance the block number. Change-Id: I7048eb4a3e08a553c3dc969dd065d4c7a04d9064 Signed-off-by: Troy Ronda <troy@troyronda.com>
1 parent 63d2604 commit 7d9ebd2

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/integration/orgs/multiple_orgs_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,10 @@ func createChannel(org1AdminUser msp.SigningIdentity, org2AdminUser msp.SigningI
316316
chMgmtClient, err := resmgmt.New(mc.ordererClientContext)
317317
require.NoError(t, err, "failed to get a new channel management client")
318318

319+
var lastConfigBlock uint64
320+
configQueryClient, err := resmgmt.New(mc.org1AdminClientContext)
321+
require.NoError(t, err, "failed to get a new channel management client")
322+
319323
// create a channel for orgchannel.tx
320324
req := resmgmt.SaveChannelRequest{ChannelID: channelID,
321325
ChannelConfigPath: path.Join("../../../", metadata.ChannelConfigPath, "orgchannel.tx"),
@@ -324,6 +328,8 @@ func createChannel(org1AdminUser msp.SigningIdentity, org2AdminUser msp.SigningI
324328
require.Nil(t, err, "error should be nil for SaveChannel of orgchannel")
325329
require.NotEmpty(t, txID, "transaction ID should be populated")
326330

331+
lastConfigBlock = waitForOrdererConfigUpdate(t, configQueryClient, true, lastConfigBlock)
332+
327333
//do the same get ch client and create channel for each anchor peer as well (first for Org1MSP)
328334
chMgmtClient, err = resmgmt.New(mc.org1AdminClientContext)
329335
require.NoError(t, err, "failed to get a new channel management client for org1Admin")
@@ -334,6 +340,8 @@ func createChannel(org1AdminUser msp.SigningIdentity, org2AdminUser msp.SigningI
334340
require.Nil(t, err, "error should be nil for SaveChannel for anchor peer 1")
335341
require.NotEmpty(t, txID, "transaction ID should be populated for anchor peer 1")
336342

343+
lastConfigBlock = waitForOrdererConfigUpdate(t, configQueryClient, false, lastConfigBlock)
344+
337345
// lastly create channel for Org2MSP anchor peer
338346
chMgmtClient, err = resmgmt.New(mc.org2AdminClientContext)
339347
require.NoError(t, err, "failed to get a new channel management client for org2Admin")
@@ -343,6 +351,29 @@ func createChannel(org1AdminUser msp.SigningIdentity, org2AdminUser msp.SigningI
343351
txID, err = chMgmtClient.SaveChannel(req, resmgmt.WithRetry(retry.DefaultResMgmtOpts), resmgmt.WithOrdererEndpoint("orderer.example.com"))
344352
require.Nil(t, err, "error should be nil for SaveChannel for anchor peer 2")
345353
require.NotEmpty(t, txID, "transaction ID should be populated for anchor peer 2")
354+
355+
waitForOrdererConfigUpdate(t, configQueryClient, false, lastConfigBlock)
356+
}
357+
358+
func waitForOrdererConfigUpdate(t *testing.T, client *resmgmt.Client, genesis bool, lastConfigBlock uint64) uint64 {
359+
for i := 0; i < 10; i++ {
360+
chConfig, err := client.QueryConfigFromOrderer(channelID, resmgmt.WithOrdererEndpoint("orderer.example.com"))
361+
if err != nil {
362+
t.Logf("orderer returned err [%d, %d, %s]", i, lastConfigBlock, err)
363+
time.Sleep(2 * time.Second)
364+
continue
365+
}
366+
367+
currentBlock := chConfig.BlockNumber()
368+
t.Logf("waitForOrdererConfigUpdate [%d, %d, %d]", i, currentBlock, lastConfigBlock)
369+
if currentBlock > lastConfigBlock || genesis {
370+
return currentBlock
371+
}
372+
time.Sleep(2 * time.Second)
373+
}
374+
375+
t.Fatal("orderer did not update channel config")
376+
return 0
346377
}
347378

348379
func testCCPolicy(chClientOrg2User *channel.Client, t *testing.T, ccName string) {

0 commit comments

Comments
 (0)