Skip to content

Commit 027d751

Browse files
committed
FAB-17158 ignore util test using build tag
ledger_generate_test is used to generate test data, and is currently skipped by default. However, it still runs BeforeEach and AfterEach, which brings up a Fabric network, which is heavy, and leaves garbage data dir behind. This patch adds a build tag 'generate' to file. Test done: run `ginkgo -tags generate` to see that test being executed, and `ginkgo` to see it being excluded. Signed-off-by: Jay Guo <guojiannan1101@gmail.com>
1 parent 4cec60e commit 027d751

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

integration/ledger/ledger_generate_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// +build generate
2+
13
/*
24
Copyright IBM Corp All Rights Reserved.
35
@@ -16,7 +18,7 @@ import (
1618
)
1719

1820
// This test generate sample ledger data that can be used to verify rebuild ledger function and upgrade function (in a future release).
19-
// It is skipped in general. To generate sample ledger data, comment out the line `xxx` and run this test in isolation.
21+
// It is skipped in general. To generate sample ledger data, use build tag 'generate' and run this test in isolation.
2022
// It does not delete the network directory so that you can copy the generated data to a different directory for unit tests.
2123
// At the end of test, it prints `setup.testDir is <directory>`. Copy the network data under <directory> to
2224
// the unit test directory for rebuild tests as needed.
@@ -77,12 +79,10 @@ var _ = Describe("sample ledger generation", func() {
7779
setup.terminateAllProcess()
7880
setup.network.Cleanup()
7981
// do not delete testDir and log it so that we can copy the test data to unit tests for verification purpose
80-
fmt.Printf("The test dir is %s. Use peers/org2.peer0/filesystem/ledgersData as the sample ledger for kvledger rebuild tests\n", setup.testDir)
82+
fmt.Fprintf(GinkgoWriter, "The test dir is %s. Use peers/org2.peer0/filesystem/ledgersData as the sample ledger for kvledger rebuild tests\n", setup.testDir)
8183
})
8284

8385
It("creates marbles", func() {
84-
Skip("Uncomment to generate sample ledger in v2.0 with new lifecycle chaincode deployment")
85-
8686
org2peer0 := setup.network.Peer("org2", "peer0")
8787
height := helper.getLedgerHeight(org2peer0)
8888

0 commit comments

Comments
 (0)