Skip to content

Commit 3838d1b

Browse files
committed
[FAB-11329] fix flakes in pvtdata e2e tests
this change set aims to fix intermittent failures in pvtdata e2e test. the change set will also enable the tests after those were disabled as a result of the failures. FAB-11329 #done Change-Id: Ie9f0f6498c2cb5e7d455f5d321852f17b7d834ff Signed-off-by: nirro <nirro@il.ibm.com>
1 parent 7134f6e commit 3838d1b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

integration/pvtdata/e2e_test.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var _ = Describe("PrivateData-EndToEnd", func() {
4141
// 2. collectionMarblePrivateDetails - Org2 and Org3 have access to this collection
4242
// when calling QueryChaincode with first arg "readMarble", it will query collectionMarbles[1]
4343
// when calling QueryChaincode with first arg "readMarblePrivateDetails", it will query collectionMarblePrivateDetails[2]
44-
PDescribe("collection config is modified", func() {
44+
Describe("collection config is modified", func() {
4545
BeforeEach(func() {
4646
var err error
4747
testDir, err = ioutil.TempDir("", "e2e-pvtdata")
@@ -227,7 +227,7 @@ var _ = Describe("PrivateData-EndToEnd", func() {
227227
})
228228
})
229229

230-
PDescribe("collection config BlockToLive is respected", func() {
230+
Describe("collection config BlockToLive is respected", func() {
231231
BeforeEach(func() {
232232
var err error
233233
testDir, err = ioutil.TempDir("", "e2e-pvtdata")
@@ -316,15 +316,20 @@ var _ = Describe("PrivateData-EndToEnd", func() {
316316
return adminRunner.Err(), err
317317
}).Should(gbytes.Say("Successfully submitted proposal to join channel"))
318318

319+
By("install the chaincode on peer1.org2 in order to query it")
320+
adminPeer.InstallChaincode("marblesp", "1.0", "github.com/hyperledger/fabric/integration/chaincode/marbles_private/cmd")
321+
319322
By("fetch latest blocks to peer1.org2")
320323
EventuallyWithOffset(1, func() (*gbytes.Buffer, error) {
321324
adminRunner := adminPeer.FetchChannel(d.Channel, filepath.Join(w.Rootpath, "peer1.org2.example.com", fmt.Sprintf("%s_block.pb", d.Channel)), "newest", d.Orderer)
322325
err := helpers.Execute(adminRunner)
323326
return adminRunner.Err(), err
324327
}).Should(gbytes.Say("Received block: 9"))
325328

326-
By("install the chaincode on peer1.org2 in order to query it")
327-
adminPeer.InstallChaincode("marblesp", "1.0", "github.com/hyperledger/fabric/integration/chaincode/marbles_private/cmd")
329+
By("wait until ledger is updated with all blocks")
330+
EventuallyWithOffset(1, func() int {
331+
return getLedgerHeight(1, 2, d.Channel, testDir)
332+
}, time.Minute).Should(Equal(10))
328333

329334
By("query peer1.org2, verify marble1 exist in collectionMarbles and private data doesn't exist")
330335
verifyAccess(d.Chaincode.Name, d.Channel, `{"Args":["readMarble","marble1"]}`, []*runner.Peer{adminPeer}, `{"docType":"marble","name":"marble1","color":"blue","size":35,"owner":"tom"}`)

0 commit comments

Comments
 (0)