@@ -56,25 +56,43 @@ var _ = Describe("Lifecycle", func() {
56
56
57
57
BeforeEach (func () {
58
58
updates = map [string ][]* kvrwset.KVWrite {
59
- "key1" : nil ,
60
- "key2" : nil ,
59
+ "+lifecycle" : {
60
+ {Key : "some/random/value" },
61
+ {Key : "namespaces/fields/cc-name/Sequence" },
62
+ {Key : "prefix/namespaces/fields/cc-name/Sequence" },
63
+ {Key : "namespaces/fields/Sequence/infix" },
64
+ {Key : "namespaces/fields/cc-name/Sequence/Postfix" },
65
+ },
66
+ "other-namespace" : nil ,
61
67
}
62
68
fakeLegacyProvider .UpdatedChaincodesReturns ([]* ledger.ChaincodeLifecycleInfo {
63
69
{Name : "foo" },
64
70
{Name : "bar" },
65
- }, fmt . Errorf ( "updated-chaincodes-error" ) )
71
+ }, nil )
66
72
})
67
73
68
- It ("passes through to the legacy impl" , func () {
74
+ It ("checks its own namespace, then passes through to the legacy impl" , func () {
69
75
res , err := l .UpdatedChaincodes (updates )
70
76
Expect (res ).To (Equal ([]* ledger.ChaincodeLifecycleInfo {
77
+ {Name : "cc-name" },
71
78
{Name : "foo" },
72
79
{Name : "bar" },
73
80
}))
74
- Expect (err ).To ( MatchError ( "updated-chaincodes-error" ))
81
+ Expect (err ).NotTo ( HaveOccurred ( ))
75
82
Expect (fakeLegacyProvider .UpdatedChaincodesCallCount ()).To (Equal (1 ))
76
83
Expect (fakeLegacyProvider .UpdatedChaincodesArgsForCall (0 )).To (Equal (updates ))
77
84
})
85
+
86
+ Context ("when the legacy provider returns an error" , func () {
87
+ BeforeEach (func () {
88
+ fakeLegacyProvider .UpdatedChaincodesReturns (nil , fmt .Errorf ("legacy-error" ))
89
+ })
90
+
91
+ It ("wraps and returns the error" , func () {
92
+ _ , err := l .UpdatedChaincodes (updates )
93
+ Expect (err ).To (MatchError ("error invoking legacy deployed cc info provider: legacy-error" ))
94
+ })
95
+ })
78
96
})
79
97
80
98
Describe ("ChaincodeInfo" , func () {
0 commit comments