Skip to content

Commit

Permalink
[FAB-14346] 2/2/ Add integration test
Browse files Browse the repository at this point in the history
This CR adds an integration test that creates an app channel which
contains a subset of orderers as system channel.

Change-Id: I93388ec08fbf151bfe17b5d39b6498896ea1a6b7
Signed-off-by: Jay Guo <guojiannan1101@gmail.com>
  • Loading branch information
guoger committed Mar 5, 2019
1 parent ccd89a0 commit 7ee710b
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 6 deletions.
54 changes: 54 additions & 0 deletions integration/e2e/etcdraft_reconfig_test.go
Expand Up @@ -696,6 +696,60 @@ var _ = Describe("EndToEnd reconfiguration and onboarding", func() {
Consistently(o4Runner.Err(), time.Second*12, time.Second).ShouldNot(gbytes.Say("Suspecting our own eviction from the channel"))
})
})

It("can create a channel that contains a subset of orderers in system channel", func() {
config := nwo.BasicEtcdRaft()
config.Orderers = []*nwo.Orderer{
{Name: "orderer1", Organization: "OrdererOrg"},
{Name: "orderer2", Organization: "OrdererOrg"},
{Name: "orderer3", Organization: "OrdererOrg"},
}
config.Profiles = []*nwo.Profile{{
Name: "SampleDevModeEtcdRaft",
Orderers: []string{"orderer1", "orderer2", "orderer3"},
}, {
Name: "ThreeOrdererChannel",
Consortium: "SampleConsortium",
Organizations: []string{"Org1", "Org2"},
Orderers: []string{"orderer1", "orderer2", "orderer3"},
}, {
Name: "SingleOrdererChannel",
Consortium: "SampleConsortium",
Organizations: []string{"Org1", "Org2"},
Orderers: []string{"orderer1"},
}}
config.Channels = []*nwo.Channel{
{Name: "single-orderer-channel", Profile: "SingleOrdererChannel", BaseProfile: "SampleDevModeEtcdRaft"},
{Name: "three-orderer-channel", Profile: "ThreeOrdererChannel"},
}

network = nwo.New(config, testDir, client, StartPort(), 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)
}

for _, ordererProc := range ordererProcesses {
Eventually(ordererProc.Ready()).Should(BeClosed())
}

By("Creating an application channel with a subset of orderers in system channel")
additionalPeer := network.Peer("Org2", "peer1")
network.CreateChannel("single-orderer-channel", network.Orderers[0], peer, additionalPeer, network.Orderers[0])

By("Creating another channel via the orderer that is in system channel but not app channel")
network.CreateChannel("three-orderer-channel", network.Orderers[2], peer)
})
})

func ensureEvicted(evictedOrderer *nwo.Orderer, submitter *nwo.Peer, network *nwo.Network, channel string) {
Expand Down
23 changes: 17 additions & 6 deletions integration/nwo/network.go
Expand Up @@ -722,15 +722,26 @@ func (n *Network) UpdateChannelAnchors(o *Orderer, channelName string) {
// aspects of the channel config for the new channel.
//
// The orderer must be running when this is called.
func (n *Network) CreateChannel(channelName string, o *Orderer, p *Peer, additionalSigners ...*Peer) {
func (n *Network) CreateChannel(channelName string, o *Orderer, p *Peer, additionalSigners ...interface{}) {
channelCreateTxPath := n.CreateChannelTxPath(channelName)

for _, signer := range additionalSigners {
sess, err := n.PeerAdminSession(signer, commands.SignConfigTx{
File: channelCreateTxPath,
})
Expect(err).NotTo(HaveOccurred())
Eventually(sess, n.EventuallyTimeout).Should(gexec.Exit(0))
switch t := signer.(type) {
case *Peer:
sess, err := n.PeerAdminSession(t, commands.SignConfigTx{
File: channelCreateTxPath,
})
Expect(err).NotTo(HaveOccurred())
Eventually(sess, n.EventuallyTimeout).Should(gexec.Exit(0))
case *Orderer:
sess, err := n.OrdererAdminSession(t, p, commands.SignConfigTx{
File: channelCreateTxPath,
})
Expect(err).NotTo(HaveOccurred())
Eventually(sess, n.EventuallyTimeout).Should(gexec.Exit(0))
default:
panic("unknown signer type, expect Peer or Orderer")
}
}

createChannel := func() int {
Expand Down

0 comments on commit 7ee710b

Please sign in to comment.