Commit 65061e71 authored by Jay Guo's avatar Jay Guo
Browse files

FAB-14822 change func signature of CreateChannelFail



Change the func signature of nwo.CreateChannelFail to be
equal to nwo.CreateChannel so it can be reused.

Change-Id: Icbcdd38162fa04236b79201c7be62892bafd86d7
Signed-off-by: default avatarJay Guo <guojiannan1101@gmail.com>
parent 70b88048
......@@ -129,7 +129,7 @@ var _ bool = Describe("Kafka2RaftMigration", func() {
By("Step 1, Verify: new channels cannot be created")
channel := "testchannel"
network.CreateChannelFail(orderer, channel)
network.CreateChannelFail(channel, orderer, peer)
//=== Step 2: Config update on system channel, MigrationState=COMMIT, type=etcdraft ===
By("Step 2: Config update on system channel, MigrationState=COMMIT, type=etcdraft")
......@@ -155,7 +155,7 @@ var _ bool = Describe("Kafka2RaftMigration", func() {
validateConsensusTypeValue(consensusTypeValue, "etcdraft", protosorderer.ConsensusType_MIG_STATE_COMMIT, migrationContext)
By("Step 2, Verify: new channels cannot be created")
network.CreateChannelFail(orderer, channel)
network.CreateChannelFail(channel, orderer, peer, peer)
By("Step 2, Verify: new config updates are not accepted")
updateConfigWithConsensusType("kafka", []byte{}, protosorderer.ConsensusType_MIG_STATE_START, 0,
......
......@@ -767,17 +767,33 @@ func (n *Network) CreateChannel(channelName string, o *Orderer, p *Peer, additio
// at the location returned by CreateChannelTxPath.
//
// The orderer must be running when this is called.
func (n *Network) CreateChannelFail(o *Orderer, channelName string) {
peers := n.PeersWithChannel(channelName)
if len(peers) == 0 {
return
func (n *Network) CreateChannelFail(channelName string, o *Orderer, p *Peer, additionalSigners ...interface{}) {
channelCreateTxPath := n.CreateChannelTxPath(channelName)
for _, signer := range additionalSigners {
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")
}
}
createChannelFail := func() int {
sess, err := n.PeerAdminSession(peers[0], commands.ChannelCreate{
sess, err := n.PeerAdminSession(p, commands.ChannelCreate{
ChannelID: channelName,
Orderer: n.OrdererAddress(o, ListenPort),
File: n.CreateChannelTxPath(channelName),
File: channelCreateTxPath,
OutputBlock: "/dev/null",
})
Expect(err).NotTo(HaveOccurred())
......
Markdown is supported
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