Skip to content

Commit e6118f6

Browse files
Jason Yellickwlahti
Jason Yellick
authored andcommitted
[FAB-9655] Function test for LSCC GetInstantiatedCCs
Adds another section to the e2e ACLs tests for the lscc/GetInstantiatedChaincodes ACL. It first sets the ACL, and does a successful query as an admin of org1. It then does an unsuccessful query as an admin of org2. Change-Id: I35742fdfb9ba3ae5f0f94e9f036dc0d692652eff Signed-off-by: Jason Yellick <jyellick@us.ibm.com> Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
1 parent 469dd2f commit e6118f6

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

integration/e2e/acl_test.go

+22
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,28 @@ var _ = Describe("EndToEndACL", func() {
146146
execute(lRunner)
147147
Expect(lRunner.Err()).To(gbytes.Say("Log level set for peer modules matching regular expression 'common/deliver': INFO"))
148148

149+
//
150+
// when the ACL policy for lscc/GetInstantiatedChaincodes is satisfied
151+
//
152+
By("setting the lscc/GetInstantiatedChaincodes ACL policy to Org1/Admins")
153+
policyName = resources.Lscc_GetInstantiatedChaincodes
154+
policy = "/Channel/Application/Org1/Admins"
155+
SetACLPolicy(w, deployment, policyName, policy)
156+
157+
By("listing the instantiated chaincodes as a permitted Org1 Admin identity")
158+
adminRunner = org1Peer0.ChaincodeListInstantiated(deployment.Channel)
159+
execute(adminRunner)
160+
Expect(adminRunner.Buffer()).To(gbytes.Say("Name: mycc, Version: 0.0, Path: github.com/hyperledger/fabric/integration/chaincode/simple/cmd, Escc: escc, Vscc: vscc"))
161+
162+
//
163+
// when the ACL policy for lscc/GetInstantiatedChaincodes is not satisfied
164+
//
165+
By("listing the instantiated chaincodes as a forbidden Org2 Admin identity")
166+
adminRunner = org2Peer0.ChaincodeListInstantiated(deployment.Channel)
167+
execute(adminRunner)
168+
Expect(adminRunner.Buffer()).NotTo(gbytes.Say("Name: mycc, Version: 0.0, Path: github.com/hyperledger/fabric/integration/chaincode/simple/cmd, Escc: escc, Vscc: vscc"))
169+
Expect(adminRunner.Err()).To(gbytes.Say(`access denied for \[getchaincodes\]\[testchannel\](.*)signature set did not satisfy policy`))
170+
149171
//
150172
// when a system chaincode ACL policy is set and a query is performed
151173
//

0 commit comments

Comments
 (0)