Unverified Commit d568cc02 authored by Artem Barger's avatar Artem Barger
Browse files

FAB-14838 properly clean IT test resources



This commit moves code which takes care to free resources and stop peers
and orderers processes after the integration test. Also need to make
sure system channel is actually ready to pull configuration blocks, by
actually waiting for leader to be selected.

Change-Id: Iefb37732edbd2b375022190691667700840d2b52
Signed-off-by: default avatarArtem Barger <bartem@il.ibm.com>
parent 3103a6ac
......@@ -1012,52 +1012,57 @@ var _ = Describe("EndToEnd reconfiguration and onboarding", func() {
network.CreateChannel("three-orderer-channel", network.Orderers[2], peer)
})
When("Adding new orderer organization", func() {
It("it will be added successfully", func() {
network = nwo.New(nwo.MultiNodeEtcdRaft(), testDir, client, BasePort(), components)
network.GenerateConfigTree()
network.Bootstrap()
It("can add a new orderer organization", func() {
network = nwo.New(nwo.MultiNodeEtcdRaft(), testDir, client, BasePort(), components)
o1, o2, o3 := network.Orderer("orderer1"), network.Orderer("orderer2"), network.Orderer("orderer3")
orderers := []*nwo.Orderer{o1, o2, o3}
peer = network.Peer("Org1", "peer1")
network.GenerateConfigTree()
network.Bootstrap()
By("Launching the orderers")
for _, o := range orderers {
runner := network.OrdererRunner(o)
ordererRunners = append(ordererRunners, runner)
process := ifrit.Invoke(runner)
ordererProcesses = append(ordererProcesses, process)
}
networkRunner := network.NetworkGroupRunner()
process := ifrit.Invoke(networkRunner)
Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())
for _, ordererProc := range ordererProcesses {
Eventually(ordererProc.Ready()).Should(BeClosed())
}
peer := network.Peer("Org1", "peer1")
orderer := network.Orderer("orderer1")
channel := "systemchannel"
By("Waiting for system channel to be ready")
findLeader(ordererRunners)
config := nwo.GetConfig(network, peer, orderer, channel)
updatedConfig := proto.Clone(config).(*common.Config)
channel := "systemchannel"
config := nwo.GetConfig(network, peer, o1, channel)
updatedConfig := proto.Clone(config).(*common.Config)
ordererOrg := updatedConfig.ChannelGroup.Groups["Orderer"].Groups["OrdererOrg"]
mspConfig := &msp.MSPConfig{}
proto.Unmarshal(ordererOrg.Values["MSP"].Value, mspConfig)
ordererOrg := updatedConfig.ChannelGroup.Groups["Orderer"].Groups["OrdererOrg"]
mspConfig := &msp.MSPConfig{}
proto.Unmarshal(ordererOrg.Values["MSP"].Value, mspConfig)
fabMSPConfig := &msp.FabricMSPConfig{}
proto.Unmarshal(mspConfig.Config, fabMSPConfig)
fabMSPConfig := &msp.FabricMSPConfig{}
proto.Unmarshal(mspConfig.Config, fabMSPConfig)
fabMSPConfig.Name = "OrdererMSP2"
fabMSPConfig.Name = "OrdererMSP2"
mspConfig.Config, _ = proto.Marshal(fabMSPConfig)
updatedConfig.ChannelGroup.Groups["Orderer"].Groups["OrdererMSP2"] = &common.ConfigGroup{
Values: map[string]*common.ConfigValue{
"MSP": {
Value: utils.MarshalOrPanic(mspConfig),
ModPolicy: "Admins",
},
mspConfig.Config, _ = proto.Marshal(fabMSPConfig)
updatedConfig.ChannelGroup.Groups["Orderer"].Groups["OrdererMSP2"] = &common.ConfigGroup{
Values: map[string]*common.ConfigValue{
"MSP": {
Value: utils.MarshalOrPanic(mspConfig),
ModPolicy: "Admins",
},
ModPolicy: "Admins",
}
nwo.UpdateOrdererConfig(network, orderer, channel, config, updatedConfig, peer, orderer)
},
ModPolicy: "Admins",
}
if process != nil {
process.Signal(syscall.SIGTERM)
Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())
}
os.RemoveAll(testDir)
})
nwo.UpdateOrdererConfig(network, o1, channel, config, updatedConfig, peer, o1)
})
})
func ensureEvicted(evictedOrderer *nwo.Orderer, submitter *nwo.Peer, network *nwo.Network, channel string) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment