Skip to content

Commit 3c321f7

Browse files
committed
[FAB-3642] Improve unit test coverage for configtxgen
Improve unit test coverage for common/configtx/tool/configtxgen. This change set improves the test coverage from 65% to 79.3%. Change-Id: I85cc72075d488f405073b1c6f1bc5c952763b5e0 Signed-off-by: Yuki Kondo <[email protected]>
1 parent 70b59b0 commit 3c321f7

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

common/configtx/tool/configtxgen/main_test.go

+23
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,26 @@ func TestGenerateAnchorPeersUpdate(t *testing.T) {
6969

7070
assert.NoError(t, doOutputAnchorPeersUpdate(config, "foo", configTxDest, genesisconfig.SampleOrgName), "Good anchorPeerUpdate request")
7171
}
72+
73+
func TestFlags(t *testing.T) {
74+
blockDest := tmpDir + string(os.PathSeparator) + "block"
75+
configTxDest := tmpDir + string(os.PathSeparator) + "configtx"
76+
oldArgs := os.Args
77+
defer func() { os.Args = oldArgs }()
78+
os.Args = []string{
79+
"cmd",
80+
"-outputBlock=" + blockDest,
81+
"-outputCreateChannelTx=" + configTxDest,
82+
"-profile=" + genesisconfig.SampleSingleMSPSoloProfile,
83+
"-inspectBlock=" + blockDest,
84+
"-inspectChannelCreateTx=" + configTxDest,
85+
"-outputAnchorPeersUpdate=" + configTxDest,
86+
"-asOrg=" + genesisconfig.SampleOrgName,
87+
}
88+
main()
89+
90+
_, err := os.Stat(blockDest)
91+
assert.NoError(t, err, "Block file is written successfully")
92+
_, err = os.Stat(configTxDest)
93+
assert.NoError(t, err, "Configtx file is written successfully")
94+
}

0 commit comments

Comments
 (0)