Skip to content

Commit 7f5d017

Browse files
yuki-konyacovm
authored andcommitted
[FAB-3545] Improve unit test coverage for provisional
Improve unit test coverage for common/configtx/tool/provisional. This change set improves the test coverage from 77% to 86%. Change-Id: Ifc82ab1c2597114636ad754b5616ac6cae121a44 Signed-off-by: Yuki Kondo <[email protected]>
1 parent a39904a commit 7f5d017

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

common/configtx/tool/provisional/provisional_test.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ import (
2222

2323
genesisconfig "github.com/hyperledger/fabric/common/configtx/tool/localconfig"
2424
cb "github.com/hyperledger/fabric/protos/common"
25+
"github.com/stretchr/testify/assert"
2526
)
2627

2728
var confSolo *genesisconfig.Profile
29+
var confKafka *genesisconfig.Profile
2830
var testCases []*genesisconfig.Profile
2931

3032
func init() {
3133
confSolo = genesisconfig.Load(genesisconfig.SampleSingleMSPSoloProfile)
32-
testCases = []*genesisconfig.Profile{confSolo}
34+
confKafka = genesisconfig.Load("SampleInsecureKafka")
35+
testCases = []*genesisconfig.Profile{confSolo, confKafka}
3336
}
3437

3538
func TestGenesisBlockHeader(t *testing.T) {
@@ -58,3 +61,13 @@ func TestGenesisMetadata(t *testing.T) {
5861
}
5962
}
6063
}
64+
65+
func TestGenesisBlockForChannelHeader(t *testing.T) {
66+
expectedHeaderNumber := uint64(0)
67+
68+
for _, tc := range testCases {
69+
genesisBlock := New(tc).GenesisBlockForChannel("mychannel")
70+
assert.Equal(t, expectedHeaderNumber, genesisBlock.Header.Number, "Case %s: Header number should be equal", tc.Orderer.OrdererType)
71+
assert.Nil(t, genesisBlock.Header.PreviousHash, "Case %s: Header previousHash to be nil", tc.Orderer.OrdererType)
72+
}
73+
}

0 commit comments

Comments
 (0)