Skip to content

Commit 7563808

Browse files
author
Luis Sanchez
committed
[FAB-3776] unit test get config after restart
Added unit tests to cover the scenario described in the comments of https://gerrit.hyperledger.org/r/#/c/9185/ Change-Id: I204eaf1adb60a8e8ffa24d3b87b68c483ea9f832 Signed-off-by: Luis Sanchez <[email protected]>
1 parent 6765b35 commit 7563808

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

orderer/multichain/chainsupport_test.go

+17-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ func TestWriteLastConfig(t *testing.T) {
131131

132132
cm.SequenceVal = 1
133133
expected = uint64(2)
134-
135134
if lc := utils.GetLastConfigIndexFromBlockOrPanic(cs.WriteBlock(cb.NewBlock(2, nil), nil, nil)); lc != expected {
136135
t.Fatalf("Second block should have config block index of %d, but got %d", expected, lc)
137136
}
@@ -140,4 +139,21 @@ func TestWriteLastConfig(t *testing.T) {
140139
t.Fatalf("Second block should have config block index of %d, but got %d", expected, lc)
141140
}
142141

142+
t.Run("ResetChainSupport", func(t *testing.T) {
143+
144+
cm.SequenceVal = 2
145+
expected = uint64(4)
146+
147+
cs = &chainSupport{ledgerResources: &ledgerResources{configResources: &configResources{Manager: cm}, ledger: ml}, signer: mockCrypto()}
148+
149+
if lc := utils.GetLastConfigIndexFromBlockOrPanic(cs.WriteBlock(cb.NewBlock(4, nil), nil, nil)); lc != expected {
150+
t.Fatalf("Second block should have config block index of %d, but got %d", expected, lc)
151+
}
152+
153+
if lc := utils.GetLastConfigIndexFromBlockOrPanic(cs.WriteBlock(cb.NewBlock(5, nil), nil, nil)); lc != expected {
154+
t.Fatalf("Second block should have config block index of %d, but got %d", expected, lc)
155+
}
156+
157+
})
158+
143159
}

0 commit comments

Comments
 (0)