From 4201eb512701164d9ebe4b8de1e187433d843624 Mon Sep 17 00:00:00 2001 From: pfi79 Date: Mon, 25 Dec 2023 21:31:26 +0300 Subject: [PATCH] fix gateway integration tests error (#4584) Signed-off-by: Fedor Partanskiy --- integration/devmode/devmode_test.go | 1 + integration/e2e/acl_test.go | 4 ++++ integration/e2e/e2e_test.go | 1 + integration/nwo/commands/peer.go | 9 +++++++++ integration/nwo/deploy.go | 2 ++ integration/pvtdata/pvtdata_test.go | 1 + integration/smartbft/smartbft_test.go | 1 + 7 files changed, 19 insertions(+) diff --git a/integration/devmode/devmode_test.go b/integration/devmode/devmode_test.go index 8d82c944a6d..909ce1b7894 100644 --- a/integration/devmode/devmode_test.go +++ b/integration/devmode/devmode_test.go @@ -232,6 +232,7 @@ func ApproveChaincodeForMyOrg(n *nwo.Network, channel string, orderer *nwo.Order InitRequired: chaincode.InitRequired, CollectionsConfig: chaincode.CollectionsConfig, ClientAuth: n.ClientAuthRequired, + WaitForEventTimeout: n.EventuallyTimeout, }) Expect(err).NotTo(HaveOccurred()) Eventually(sess, n.EventuallyTimeout).Should(gexec.Exit(0)) diff --git a/integration/e2e/acl_test.go b/integration/e2e/acl_test.go index 8ff956954ac..7bcb65daf20 100644 --- a/integration/e2e/acl_test.go +++ b/integration/e2e/acl_test.go @@ -148,6 +148,7 @@ var _ = Describe("EndToEndACL", func() { ChannelConfigPolicy: chaincode.ChannelConfigPolicy, InitRequired: chaincode.InitRequired, CollectionsConfig: chaincode.CollectionsConfig, + WaitForEventTimeout: network.EventuallyTimeout, }) Expect(err).NotTo(HaveOccurred()) Eventually(sess, network.EventuallyTimeout).Should(gexec.Exit()) @@ -166,6 +167,7 @@ var _ = Describe("EndToEndACL", func() { ChannelConfigPolicy: chaincode.ChannelConfigPolicy, InitRequired: chaincode.InitRequired, CollectionsConfig: chaincode.CollectionsConfig, + WaitForEventTimeout: network.EventuallyTimeout, }) Expect(err).NotTo(HaveOccurred()) Eventually(sess, network.EventuallyTimeout).Should(gexec.Exit()) @@ -192,6 +194,7 @@ var _ = Describe("EndToEndACL", func() { InitRequired: chaincode.InitRequired, CollectionsConfig: chaincode.CollectionsConfig, PeerAddresses: []string{network.PeerAddress(org1Peer0, nwo.ListenPort)}, + WaitForEventTimeout: network.EventuallyTimeout, }) Expect(err).NotTo(HaveOccurred()) Eventually(sess, network.EventuallyTimeout).Should(gexec.Exit()) @@ -279,6 +282,7 @@ var _ = Describe("EndToEndACL", func() { InitRequired: chaincode.InitRequired, CollectionsConfig: chaincode.CollectionsConfig, PeerAddresses: peerAddresses, + WaitForEventTimeout: network.EventuallyTimeout, }) Expect(err).NotTo(HaveOccurred()) Eventually(sess, network.EventuallyTimeout).Should(gexec.Exit()) diff --git a/integration/e2e/e2e_test.go b/integration/e2e/e2e_test.go index 609156f8ded..c7cb49a1a1d 100644 --- a/integration/e2e/e2e_test.go +++ b/integration/e2e/e2e_test.go @@ -700,6 +700,7 @@ var _ = Describe("EndToEnd", func() { InitRequired: chaincode.InitRequired, CollectionsConfig: chaincode.CollectionsConfig, ClientAuth: network.ClientAuthRequired, + WaitForEventTimeout: network.EventuallyTimeout, }) Expect(err).NotTo(HaveOccurred()) Eventually(sess.Err, network.EventuallyTimeout).Should(gbytes.Say(`Error: proposal failed with status: 500`)) diff --git a/integration/nwo/commands/peer.go b/integration/nwo/commands/peer.go index f8421f088e8..f5a42c38593 100644 --- a/integration/nwo/commands/peer.go +++ b/integration/nwo/commands/peer.go @@ -330,6 +330,7 @@ type ChaincodeApproveForMyOrg struct { PeerAddresses []string WaitForEvent bool ClientAuth bool + WaitForEventTimeout time.Duration } func (c ChaincodeApproveForMyOrg) SessionName() string { @@ -367,6 +368,10 @@ func (c ChaincodeApproveForMyOrg) Args() []string { args = append(args, "--peerAddresses", p) } + if c.WaitForEventTimeout > 30*time.Second { + args = append(args, "--waitForEventTimeout", c.WaitForEventTimeout.String()) + } + return args } @@ -471,6 +476,7 @@ type ChaincodeCommit struct { PeerAddresses []string WaitForEvent bool ClientAuth bool + WaitForEventTimeout time.Duration } func (c ChaincodeCommit) SessionName() string { @@ -502,6 +508,9 @@ func (c ChaincodeCommit) Args() []string { if c.ClientAuth { args = append(args, "--clientauth") } + if c.WaitForEventTimeout > 30*time.Second { + args = append(args, "--waitForEventTimeout", c.WaitForEventTimeout.String()) + } return args } diff --git a/integration/nwo/deploy.go b/integration/nwo/deploy.go index d738fc488b1..b9dfda6230d 100644 --- a/integration/nwo/deploy.go +++ b/integration/nwo/deploy.go @@ -182,6 +182,7 @@ func ApproveChaincodeForMyOrg(n *Network, channel string, orderer *Orderer, chai InitRequired: chaincode.InitRequired, CollectionsConfig: chaincode.CollectionsConfig, ClientAuth: n.ClientAuthRequired, + WaitForEventTimeout: n.EventuallyTimeout, }) Expect(err).NotTo(HaveOccurred()) Eventually(sess, n.EventuallyTimeout).Should(gexec.Exit(0)) @@ -238,6 +239,7 @@ func CommitChaincode(n *Network, channel string, orderer *Orderer, chaincode Cha CollectionsConfig: chaincode.CollectionsConfig, PeerAddresses: peerAddresses, ClientAuth: n.ClientAuthRequired, + WaitForEventTimeout: n.EventuallyTimeout, }) Expect(err).NotTo(HaveOccurred()) Eventually(sess, n.EventuallyTimeout).Should(gexec.Exit(0)) diff --git a/integration/pvtdata/pvtdata_test.go b/integration/pvtdata/pvtdata_test.go index 5cdc4082ec4..ecf73b5dfec 100644 --- a/integration/pvtdata/pvtdata_test.go +++ b/integration/pvtdata/pvtdata_test.go @@ -997,6 +997,7 @@ func approveChaincodeForMyOrgExpectErr(n *nwo.Network, orderer *nwo.Orderer, cha ChannelConfigPolicy: chaincode.ChannelConfigPolicy, InitRequired: chaincode.InitRequired, CollectionsConfig: chaincode.CollectionsConfig, + WaitForEventTimeout: n.EventuallyTimeout, }) Expect(err).NotTo(HaveOccurred()) Eventually(sess, n.EventuallyTimeout).Should(gexec.Exit()) diff --git a/integration/smartbft/smartbft_test.go b/integration/smartbft/smartbft_test.go index 30d140621dc..47821a5ce8a 100644 --- a/integration/smartbft/smartbft_test.go +++ b/integration/smartbft/smartbft_test.go @@ -1783,6 +1783,7 @@ var _ = Describe("EndToEnd Smart BFT configuration test", func() { InitRequired: chaincode.InitRequired, CollectionsConfig: chaincode.CollectionsConfig, ClientAuth: network.ClientAuthRequired, + WaitForEventTimeout: network.EventuallyTimeout, }) Expect(err).NotTo(HaveOccurred()) Eventually(sess, network.EventuallyTimeout).Should(gexec.Exit(0))