Skip to content

Commit

Permalink
[FAB-11595] minor JavaCC e2e test cleanup
Browse files Browse the repository at this point in the history
- Use SIGKILL instead of SIGILL to stop the network
- Clarify the test descriptions

Change-Id: Ie6831dfa7fe197fe408e65c6317ab91f89271352
Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
  • Loading branch information
sykesm committed Sep 18, 2018
1 parent e6bdd23 commit f2b16af
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 64 deletions.
120 changes: 58 additions & 62 deletions integration/java_chaincode/javacc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/hyperledger/fabric/integration/nwo/commands"
)

var _ = Describe("EndToEnd-JavaCC", func() {
var _ = Describe("Java Chaincode EndToEnd Suite", func() {
var (
testDir string
client *docker.Client
Expand All @@ -40,11 +40,18 @@ var _ = Describe("EndToEnd-JavaCC", func() {
client, err = docker.NewClientFromEnv()
Expect(err).NotTo(HaveOccurred())

network = nwo.New(nwo.BasicSolo(), testDir, client, 40000+1000*GinkgoParallelNode(), components)
network.GenerateConfigTree()
network.Bootstrap()

networkRunner := network.NetworkGroupRunner()
process = ifrit.Invoke(networkRunner)
Eventually(process.Ready()).Should(BeClosed())
})

AfterEach(func() {
if process != nil {
process.Signal(syscall.SIGILL)
process.Signal(syscall.SIGKILL)
Eventually(process.Wait(), time.Minute).Should(Receive())
}
if network != nil {
Expand All @@ -53,66 +60,55 @@ var _ = Describe("EndToEnd-JavaCC", func() {
os.RemoveAll(testDir)
})

Describe("javacc project runs on top of basic solo network with 2 org", func() {
BeforeEach(func() {
network = nwo.New(nwo.BasicSolo(), testDir, client, 30000, components)
network.GenerateConfigTree()
network.Bootstrap()

networkRunner := network.NetworkGroupRunner()
process = ifrit.Invoke(networkRunner)
Eventually(process.Ready()).Should(BeClosed())
})

It("support for java chaincode gradle project", func() {
chaincode = nwo.Chaincode{
Name: "mycc",
Version: "0.0",
Path: "../chaincode/java/simple/gradle/",
Ctor: `{"Args":["init","a","100","b","200"]}`,
Policy: `OR ('Org1MSP.member','Org2MSP.member')`,
Lang: "java",
}

By("getting the orderer by name")
orderer := network.Orderer("orderer")

By("setting up the channel")
network.CreateAndJoinChannel(orderer, "testchannel")

By("deploying the chaincode")
nwo.DeployChaincode(network, "testchannel", orderer, chaincode)

By("getting the client peer by name")
peer := network.Peer("Org1", "peer0")

RunQueryInvokeQuery(network, orderer, peer)
})
It("support for private data in java chaincode", func() {
chaincode = nwo.Chaincode{
Name: "mycc",
Version: "0.0",
Path: "../chaincode/java/simple_pvtdata/gradle/",
Ctor: `{"Args":["init","a","100","b","200"]}`,
Policy: `OR ('Org1MSP.member','Org2MSP.member')`,
Lang: "java",
CollectionsConfig: "testdata/collection_config.json",
}

By("getting the orderer by name")
orderer := network.Orderer("orderer")

By("setting up the channel")
network.CreateAndJoinChannel(orderer, "testchannel")

By("deploying the chaincode")
nwo.DeployChaincode(network, "testchannel", orderer, chaincode)

By("getting the client peer by name")
peer := network.Peer("Org1", "peer0")

RunQueryInvokeQuery(network, orderer, peer)
})
It("supports java chaincode from a gradle project", func() {
chaincode = nwo.Chaincode{
Name: "mycc",
Version: "0.0",
Path: "../chaincode/java/simple/gradle/",
Ctor: `{"Args":["init","a","100","b","200"]}`,
Policy: `OR ('Org1MSP.member','Org2MSP.member')`,
Lang: "java",
}

By("getting the orderer by name")
orderer := network.Orderer("orderer")

By("setting up the channel")
network.CreateAndJoinChannel(orderer, "testchannel")

By("deploying the chaincode")
nwo.DeployChaincode(network, "testchannel", orderer, chaincode)

By("getting the client peer by name")
peer := network.Peer("Org1", "peer0")

RunQueryInvokeQuery(network, orderer, peer)
})

It("supports private data in java chaincode", func() {
chaincode = nwo.Chaincode{
Name: "mycc",
Version: "0.0",
Path: "../chaincode/java/simple_pvtdata/gradle/",
Ctor: `{"Args":["init","a","100","b","200"]}`,
Policy: `OR ('Org1MSP.member','Org2MSP.member')`,
Lang: "java",
CollectionsConfig: "testdata/collection_config.json",
}

By("getting the orderer by name")
orderer := network.Orderer("orderer")

By("setting up the channel")
network.CreateAndJoinChannel(orderer, "testchannel")

By("deploying the chaincode")
nwo.DeployChaincode(network, "testchannel", orderer, chaincode)

By("getting the client peer by name")
peer := network.Peer("Org1", "peer0")

RunQueryInvokeQuery(network, orderer, peer)
})
})

Expand Down
5 changes: 4 additions & 1 deletion integration/nwo/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ SPDX-License-Identifier: Apache-2.0
package nwo

import (
"fmt"
"os"
"runtime"

"github.com/hyperledger/fabric/integration/helpers"
"github.com/hyperledger/fabric/integration/runner"
Expand All @@ -20,7 +22,8 @@ type Components struct {
}

var RequiredImages = []string{
"hyperledger/fabric-ccenv:latest",
fmt.Sprintf("hyperledger/fabric-ccenv:%s-latest", runtime.GOARCH),
fmt.Sprintf("hyperledger/fabric-javaenv:%s-latest", runtime.GOARCH),
runner.CouchDBDefaultImage,
runner.KafkaDefaultImage,
runner.ZooKeeperDefaultImage,
Expand Down
1 change: 0 additions & 1 deletion sampleconfig/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,6 @@ chaincode:
# This image is packed with shim layer libraries that are necessary
# for Java chaincode runtime.
runtime: $(DOCKER_NS)/fabric-javaenv:$(ARCH)-$(PROJECT_VERSION)
# from $(DOCKER_NS)/fabric-javaenv:$(ARCH)-1.2.0

node:
# need node.js engine at runtime, currently available in baseimage
Expand Down

0 comments on commit f2b16af

Please sign in to comment.