tedsuo/ifrit 43
a simple process model for go
IBM/mirbft 23
MirBFT is a consensus library implementing the Mir consensus protocol.
sykesm/vagrant-openwrt-buildroot 7
A Vagrant environment for building OpenWRT
A CPI to deploy bosh releases to Kubernetes
bosh release for the furnace work
Some scripts to interact with a Cloud Foundry deployment to bosh lite
Terminal session recorder
startedAlecAivazis/survey
started time in 2 days
push eventhyperledger/fabric-protos-go
commit sha 71c4060efc424d4eb3ab18d23837dc709b55a3fe
[FAB-18235] Add NextAvailable seek position to ab.proto (#42) This option is added to allow a client listens to the future blocks only, comparing to the existing Newest option which refers to the last block that has been committed on the ledgerr. Signed-off-by: Wenjian Qiao <[email protected]>
push time in 2 days
push eventhyperledger/fabric-ca
commit sha 8ac73482d6c6a743c7749caf101fdd85ba98afa5
Allow reenroll to reuse existing private key FABC-914 Signed-off-by: Will Lahti <[email protected]>
push time in 3 days
PR merged hyperledger/fabric-ca
Type of change
- New feature
Description
Allow reenroll to reuse existing private key instead of always generating a new one.
Related issues
pr closed time in 3 days
push eventhyperledger/fabric-ca
commit sha 41d4b3f1ccefe03ba961d9f1fbd2cbd13bb995e0
Allow reenroll to reuse existing private key FABC-914 Signed-off-by: Will Lahti <[email protected]>
push time in 4 days
PR merged hyperledger/fabric-ca
Type of change
- New feature
Description
Allow reenroll to reuse existing private key instead of always generating a new one.
Related issues
pr closed time in 4 days
Pull request review commenthyperledger/fabric-ca
Allow reenroll to reuse existing private key
func registerAndRevokeUsers(t *testing.T, admin *lib.Identity, num int) []*big.I // Reenroll the user, this should create a new certificate, so this // user will have two valid certificates, but we will revoke one // of her certificate only- _, err := enrollResp.Identity.Reenroll(&api.ReenrollmentRequest{})+ _, err := enrollResp.Identity.Reenroll(&api.ReenrollmentRequest{+ CSR: &api.CSRInfo{+ KeyRequest: &api.KeyRequest{},
This should be optional, right? So why did the test need to change?
It's likely I'm missing something.
comment created time in 5 days
Pull request review commenthyperledger/fabric-ca
Allow reenroll to reuse existing private key
func (i *Identity) RegisterAndEnroll(req *api.RegistrationRequest) (*Identity, e func (i *Identity) Reenroll(req *api.ReenrollmentRequest) (*EnrollmentResponse, error) { log.Debugf("Reenrolling %s", util.StructToString(req)) - csrPEM, key, err := i.client.GenCSR(req.CSR, i.GetName())+ var key bccsp.Key+ if req.CSR.KeyRequest.ReuseKey {+ val, err := i.GetX509Credential().Val()+ if err != nil {+ return nil, err+ }+ key = val.(*x509.Signer).Key()+ }+ csrPEM, key, err := i.client.GenCSR(req.CSR, i.GetName(), key)
Here is the meat of the change. Glancing at the code, I see Reenroll checking a nested struct in CSRInfo (no nil check - which goes to the comment I made in main_test) and using that information to extract a key based on ReuseKey. This structure seems to be motivating the change to GenCSR (breaking client API) to pass down the key.
My guess is that this PR would have a much smaller surface area and much smaller impact if a new interface function was introduced on the client to handle this re-enrollment flow with an existing key.
comment created time in 5 days
Pull request review commenthyperledger/fabric-ca
Allow reenroll to reuse existing private key
func (c *Client) GetCAInfo(req *api.GetCAInfoRequest) (*GetCAInfoResponse, error } // GenCSR generates a CSR (Certificate Signing Request)-func (c *Client) GenCSR(req *api.CSRInfo, id string) ([]byte, bccsp.Key, error) {+func (c *Client) GenCSR(req *api.CSRInfo, id string, k bccsp.Key) ([]byte, bccsp.Key, error) {
Backwards compatibility isn't necessarily a strong requirement but this is the client API. Do we need (or really want) to make this change to add an argument and overload the semantics based on the presence of the key?
comment created time in 5 days
Pull request review commenthyperledger/fabric-ca
Allow reenroll to reuse existing private key
type ReenrollmentRequest struct { // AttrReqs are requests for attributes to add to the certificate. // Each attribute is added only if the requestor owns the attribute. AttrReqs []*AttributeRequest `json:"attr_reqs,omitempty"`+ // ReuseKey specifies whether to reuse the existing private key+ // when reenrolling an identity.+ ReuseKey bool `json:"reusekey"`
I'm very confused why this field exists at this level and also within the CSRInfo. It looks like the implementation of Reenroll does not look at this but only the nested value.
Can you explain the intent?
comment created time in 5 days
push eventhyperledger/fabric
commit sha 195d69efe2cf6695f2f6bc0c9636fb57d61466a1
Format code in chaincode docs Signed-off-by: Eugene Sinitsyn <[email protected]>
push time in 10 days
PR merged hyperledger/fabric
Signed-off-by: Eugene Sinitsyn [email protected]
<!--- DELETE MARKDOWN COMMENTS BEFORE SUBMITTING PULL REQUEST. -->
<!--- Provide a descriptive summary of your changes in the Title above. -->
Type of change
<!--- What type of change? Pick one option and delete the others. -->
- Documentation update
Description
<!--- Describe your changes in detail, including motivation. -->
Additional details
<!--- Additional implementation details or comments to reviewers. --> <!--- Summarize how the pull request was tested (if not obvious from commit). -->
Related issues
<!--- Include a link to any associated issues, e.g. Jira issue or approved rfc. -->
<!---
Release Note
If change impacts current users, uncomment Release Note heading and provide release note text. Also, copy release note text into the release specific /release_notes file. -->
<!-- Checklist (DELETE AFTER READING):
Signed-off-byadded to commits (required for DCO check to pass)- Tests have been added/updated (required for bug fixes and features)
- Unit and/or integration tests pass locally
- Run linters and checks locally using 'make checks'
- If change requires documentation updates, make updates in pull request, or open a separate issue and provide link
- Squash commits into a single commit, unless a stack of commits is intentional to assist reviewers or to preserve review comments.
- For additional contribution guidelines see the project's CONTRIBUTING.md file -->
pr closed time in 10 days
push eventhyperledger/fabric
commit sha 80d3934494bdac9a4be8aec456c2b153161314ab
Fix broken pkcs11 tests Running go test -tags pkcs11 was failing for bccsp. This was probably not caught in CI because CI runs with the short flag and the failing tests are omitted. Signed-off-by: Gari Singh <[email protected]>
push time in 18 days
PR merged hyperledger/fabric
Type of change
- Bug fix
Description
Running go test -tags pkcs11 was failing for bccsp. This was probably not caught in CI because CI runs with the short flag and the failing tests are omitted.
pr closed time in 18 days
push eventhyperledger/fabric
commit sha c8d124f87235df7085ff867254af95dd4bdd6cdf
[FAB-18073] Add integration test for dev mode Signed-off-by: Chongxin Luo <[email protected]> Signed-off-by: Tiffany Harris <[email protected]>
push time in 18 days
PR merged hyperledger/fabric
Type of change
- Test update
Description
Tests functionality of dev mode in 1.4
Related issues
pr closed time in 18 days
startedtomtastic/qnap-gpio
started time in 21 days
push eventhyperledger/fabric
commit sha 9da753a04e3dbf7d5849dc44bff241d2c6a503b5
[FAB-18169] Add DevMode support in ChaincodeEndorsementInfoSource * Added DevMode support in ChaincodeEndorsementInfoSource, when chaincode is launched by developer and missing Installinfo from chaincodeInfo cache, rebuild Installinfo and return accordinly. Signed-off-by: Chongxin Luo <[email protected]>
commit sha 8dae484118c4867fb9e9e37bb081dc7ec507aee5
[FAB-18120] Adding DevMode integration test for new lifecycle. * Added integration test for DevMode using new lifecycle. Signed-off-by: Chongxin Luo <[email protected]>
push time in 22 days
PR merged hyperledger/fabric
Type of change
- Test update
Description
- Added integration test support for DevMode using new lifecycle.
- Added DevMode support for ChaincodeEndorsementInfoSource.
Related issues
pr closed time in 22 days
Pull request review commenthyperledger/fabric
func TestPKCS11ECKeySignVerify(t *testing.T) { } msg1 := []byte("This is my very authentic message")- msg2 := []byte("This is my very unauthentic message") hash1, _ := currentBCCSP.Hash(msg1, &bccsp.SHAOpts{})+ /**+ msg2 := []byte("This is my very unauthentic message")++ /**
?
comment created time in 23 days
Pull request review commenthyperledger/fabric
SPDX-License-Identifier: Apache-2.0 package pkcs11 import (- "crypto/ecdsa"+ //"crypto/ecdsa"
Why keep the commented out code?
comment created time in 23 days
startedbkram/qnapdisplay
started time in 24 days
startedZopieux/qnapctl
started time in 24 days
push eventhyperledger/fabric
commit sha 23088b6e3fa1c76c714593c28dc3c77083a8025c
[FAB-18169] Add DevMode support in ChaincodeEndorsementInfoSource * Added DevMode support in ChaincodeEndorsementInfoSource, when chaincode is launched by developer and missing Installinfo from chaincodeInfo cache, rebuild Installinfo and return accordinly. Signed-off-by: Chongxin Luo <[email protected]>
commit sha 3386c801449c9ebc52360bef7ebcb70626886ffe
[FAB-18120] Adding DevMode integration test for new lifecycle. * Added integration test for DevMode using new lifecycle. Signed-off-by: Chongxin Luo <[email protected]>
push time in 25 days
PR merged hyperledger/fabric
Type of change
- Test update
Description
- Added integration test support for DevMode using new lifecycle.
- Added DevMode support for ChaincodeEndorsementInfoSource.
Related issues
pr closed time in 25 days
startedlukicdarkoo/rpi-wifi
started time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.++SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ network = nwo.New(devModeSolo, testDir, client, StartPort(), components)++ network.TLSEnabled = false+ // turn on dev mode for all peers
comment seems stale.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.++SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ network = nwo.New(devModeSolo, testDir, client, StartPort(), components)++ network.TLSEnabled = false+ // turn on dev mode for all peers+ network.Peer("Org1", "peer0").DevMode = true++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }++ org1peer0 := network.Peer("Org1", "peer0")+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("building chaincode")+ chaincodeExecutePath := components.Build(legacyChaincode.Path)++ By("running the chaincode")+ legacyChaincodeID := legacyChaincode.Name + ":" + legacyChaincode.Version+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ "CORE_CHAINCODE_ID_NAME=" + legacyChaincodeID,+ "DEVMODE_ENABLED=true",+ }+ cmd := exec.Command(chaincodeExecutePath, "-peer.address", peerChaincodeAddress)+ cmd.Env = append(cmd.Env, envs...)+ chaincodeRunner = ginkgomon.New(ginkgomon.Config{+ Name: "chaincode",+ Command: cmd,+ StartCheckTimeout: 15 * time.Second,+ StartCheck: "starting up in devmode...",+ })+ chaincodeProcess = ifrit.Invoke(chaincodeRunner)+ Eventually(chaincodeProcess.Ready(), network.EventuallyTimeout).Should(BeClosed())++ By("installing the chaincode")+ nwo.InstallChaincodeLegacy(network, legacyChaincode, org1peer0)++ By("instantiating the chaincode")+ nwo.InstantiateChaincodeLegacy(network, channelName, orderer, legacyChaincode, org1peer0, org1peer0)++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 100)+ Eventually(chaincodeRunner.Buffer()).Should(gbytes.Say("invoking in devmode"))+ })++ It("executes chaincode in dev mode", func() {+ chaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: components.Build("github.com/hyperledger/fabric/integration/chaincode/simple/cmd"),+ Lang: "binary",+ PackageFile: filepath.Join(testDir, "simplecc.tar.gz"),+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ SignaturePolicy: `OR ('Org1MSP.member')`,+ Sequence: "1",+ InitRequired: true,+ Label: "my_prebuilt_chaincode",+ }++ org1peer0 := network.Peer("Org1", "peer0")+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("enabling V2_0 application capabilities")+ nwo.EnableCapabilities(network, channelName, "Application", "V2_0", orderer, org1peer0)++ By("running the chaincode")+ chaincodeID := chaincode.Name + ":" + chaincode.Version+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ "CORE_PEER_ADDRESS=" + peerChaincodeAddress,+ "CORE_CHAINCODE_ID_NAME=" + chaincodeID,+ "DEVMODE_ENABLED=true",+ }++ cmd := exec.Command(chaincode.Path, "-peer.address", peerChaincodeAddress)+ cmd.Env = append(cmd.Env, envs...)+ chaincodeRunner = ginkgomon.New(ginkgomon.Config{+ Name: "chaincode",+ Command: cmd,+ StartCheckTimeout: 15 * time.Second,+ StartCheck: "starting up in devmode...",+ })+ chaincodeProcess = ifrit.Invoke(chaincodeRunner)+ Eventually(chaincodeProcess.Ready(), network.EventuallyTimeout).Should(BeClosed())++ By("approving chaincode for orgs")+ ApproveChaincodeForMyOrg(network, channelName, orderer, chaincode, org1peer0)+ By("committing the chaincode definition")+ nwo.CheckCommitReadinessUntilReady(network, channelName, chaincode, network.PeerOrgs(), org1peer0)+ nwo.CommitChaincode(network, channelName, orderer, chaincode, org1peer0, org1peer0)+ By("initializing chaincode if required")+ if chaincode.InitRequired {+ nwo.InitChaincode(network, channelName, orderer, chaincode, org1peer0)+ }++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 100)+ Eventually(chaincodeRunner.Buffer()).Should(gbytes.Say("invoking in devmode"))
Same comment about BufferProvider.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.++SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ network = nwo.New(devModeSolo, testDir, client, StartPort(), components)++ network.TLSEnabled = false+ // turn on dev mode for all peers+ network.Peer("Org1", "peer0").DevMode = true++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }++ org1peer0 := network.Peer("Org1", "peer0")+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("building chaincode")+ chaincodeExecutePath := components.Build(legacyChaincode.Path)++ By("running the chaincode")+ legacyChaincodeID := legacyChaincode.Name + ":" + legacyChaincode.Version+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ "CORE_CHAINCODE_ID_NAME=" + legacyChaincodeID,+ "DEVMODE_ENABLED=true",+ }+ cmd := exec.Command(chaincodeExecutePath, "-peer.address", peerChaincodeAddress)+ cmd.Env = append(cmd.Env, envs...)+ chaincodeRunner = ginkgomon.New(ginkgomon.Config{+ Name: "chaincode",+ Command: cmd,+ StartCheckTimeout: 15 * time.Second,+ StartCheck: "starting up in devmode...",+ })+ chaincodeProcess = ifrit.Invoke(chaincodeRunner)+ Eventually(chaincodeProcess.Ready(), network.EventuallyTimeout).Should(BeClosed())++ By("installing the chaincode")+ nwo.InstallChaincodeLegacy(network, legacyChaincode, org1peer0)++ By("instantiating the chaincode")+ nwo.InstantiateChaincodeLegacy(network, channelName, orderer, legacyChaincode, org1peer0, org1peer0)++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 100)+ Eventually(chaincodeRunner.Buffer()).Should(gbytes.Say("invoking in devmode"))
a ginkgomon.Runner implements gbytes.BufferProvider so the call to Buffer is not needed.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
func handleSigTerm() { } func main() {+ if os.Getenv("DEVMODE_ENABLED") != "" {+ fmt.Println("starting up in devmode...")+ }+
If this is being used as the readiness check, shouldn't it happen after starting the go routine that calls shim.Start? Neither is perfect but it seems closer to what we'd expect.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
func (cei *ChaincodeEndorsementInfoSource) CachedChaincodeInfo(channelID, chainc } if chaincodeInfo.InstallInfo == nil {+ if cei.UserRunsCC {+ chaincodeInfo.InstallInfo = &ChaincodeInstallInfo{+ PackageID: fmt.Sprintf("%s:%s", chaincodeName, chaincodeInfo.Definition.EndorsementInfo.Version),
In a follow-on, please consider replacing the printf with concatenation.
comment created time in a month
push eventsykesm/gomega
commit sha a0a9f8e65a5ff5efc80729e8388cad8e92f19fc4
wip Signed-off-by: Matthew Sykes <[email protected]>
push time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
func MultiNodeEtcdRaft() *Config { }} return config }++// DevModeSolo is a configuration with single organization and single peer.+func DevModeSolo() *Config {+ return &Config{+ Organizations: []*Organization{{+ Name: "OrdererOrg",+ MSPID: "OrdererMSP",+ Domain: "example.com",+ EnableNodeOUs: false,+ Users: 0,+ CA: &CA{Hostname: "ca"},+ }, {+ Name: "Org1",+ MSPID: "Org1MSP",+ Domain: "org1.example.com",+ EnableNodeOUs: true,+ Users: 2,+ CA: &CA{Hostname: "ca"},+ }},+ Consortiums: []*Consortium{{+ Name: "SampleConsortium",+ Organizations: []string{+ "Org1",+ },+ }},+ Consensus: &Consensus{+ Type: "solo",+ BootstrapMethod: "file",+ },+ SystemChannel: &SystemChannel{+ Name: "systemchannel",+ Profile: "TwoOrgsOrdererGenesis",+ },+ Orderers: []*Orderer{+ {Name: "orderer", Organization: "OrdererOrg"},+ },+ Channels: []*Channel{+ {Name: "testchannel", Profile: "TwoOrgsChannel"},+ },+ Peers: []*Peer{{+ Name: "peer0",+ Organization: "Org1",+ Channels: []*PeerChannel{+ {Name: "testchannel", Anchor: true},+ },+ }},+ Profiles: []*Profile{{+ Name: "TwoOrgsOrdererGenesis",+ Orderers: []string{"orderer"},+ }, {+ Name: "TwoOrgsChannel",
No longer TwoOrgs but one.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
func MultiNodeEtcdRaft() *Config { }} return config }++// DevModeSolo is a configuration with single organization and single peer.+func DevModeSolo() *Config {+ return &Config{+ Organizations: []*Organization{{+ Name: "OrdererOrg",+ MSPID: "OrdererMSP",+ Domain: "example.com",+ EnableNodeOUs: false,+ Users: 0,+ CA: &CA{Hostname: "ca"},+ }, {+ Name: "Org1",+ MSPID: "Org1MSP",+ Domain: "org1.example.com",+ EnableNodeOUs: true,+ Users: 2,+ CA: &CA{Hostname: "ca"},+ }},+ Consortiums: []*Consortium{{+ Name: "SampleConsortium",+ Organizations: []string{+ "Org1",+ },+ }},+ Consensus: &Consensus{+ Type: "solo",+ BootstrapMethod: "file",+ },+ SystemChannel: &SystemChannel{+ Name: "systemchannel",+ Profile: "TwoOrgsOrdererGenesis",+ },+ Orderers: []*Orderer{+ {Name: "orderer", Organization: "OrdererOrg"},+ },+ Channels: []*Channel{+ {Name: "testchannel", Profile: "TwoOrgsChannel"},+ },+ Peers: []*Peer{{+ Name: "peer0",+ Organization: "Org1",+ Channels: []*PeerChannel{+ {Name: "testchannel", Anchor: true},+ },+ }},+ Profiles: []*Profile{{+ Name: "TwoOrgsOrdererGenesis",
No longer TwoOrgs but one.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
func MultiNodeEtcdRaft() *Config { }} return config }++// DevModeSolo is a configuration with single organization and single peer.+func DevModeSolo() *Config {+ return &Config{+ Organizations: []*Organization{{+ Name: "OrdererOrg",+ MSPID: "OrdererMSP",+ Domain: "example.com",+ EnableNodeOUs: false,+ Users: 0,+ CA: &CA{Hostname: "ca"},+ }, {+ Name: "Org1",+ MSPID: "Org1MSP",+ Domain: "org1.example.com",+ EnableNodeOUs: true,+ Users: 2,+ CA: &CA{Hostname: "ca"},+ }},+ Consortiums: []*Consortium{{+ Name: "SampleConsortium",+ Organizations: []string{+ "Org1",+ },+ }},+ Consensus: &Consensus{+ Type: "solo",+ BootstrapMethod: "file",+ },+ SystemChannel: &SystemChannel{+ Name: "systemchannel",+ Profile: "TwoOrgsOrdererGenesis",+ },+ Orderers: []*Orderer{+ {Name: "orderer", Organization: "OrdererOrg"},+ },+ Channels: []*Channel{+ {Name: "testchannel", Profile: "TwoOrgsChannel"},
No longer TwoOrgs but one.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
func MultiNodeEtcdRaft() *Config { }} return config }++// DevModeSolo is a configuration with single organization and single peer.+func DevModeSolo() *Config {+ return &Config{+ Organizations: []*Organization{{+ Name: "OrdererOrg",+ MSPID: "OrdererMSP",+ Domain: "example.com",+ EnableNodeOUs: false,+ Users: 0,+ CA: &CA{Hostname: "ca"},+ }, {+ Name: "Org1",+ MSPID: "Org1MSP",+ Domain: "org1.example.com",+ EnableNodeOUs: true,+ Users: 2,+ CA: &CA{Hostname: "ca"},+ }},+ Consortiums: []*Consortium{{+ Name: "SampleConsortium",+ Organizations: []string{+ "Org1",+ },+ }},+ Consensus: &Consensus{+ Type: "solo",+ BootstrapMethod: "file",+ },+ SystemChannel: &SystemChannel{+ Name: "systemchannel",+ Profile: "TwoOrgsOrdererGenesis",
No longer TwoOrgs but one.
comment created time in a month
push eventhyperledger/fabric-ca
commit sha 8a07eefa7452b86db4fbea58ea61ec5ee8080f02
[FABC-920] Modify cdr command in README Signed-off-by: 5pecia1 <[email protected]>
push time in a month
PR merged hyperledger/fabric-ca
Type of change
- Documentation update
Description
- Change
cdrtocd $GOPATH/src/github.com/hyperledger/fabric-cain README.md
Signed-off-by: Sol Kang [email protected]
pr closed time in a month
Pull request review commenthyperledger/fabric-ca
[FABC-920] Modify cdr command in README
The following are guidelines to follow when contributing: 2. To run the unit tests manually: ```- # cdr+ # cd $GOPATH/src/github.com/hyperledger/fabric-ca
Thanks. I'm going to merge this as it's an improvement but it's still not quite right. A GOPATH can contain more than one path entry (just like a PATH). This only works when there's a single path entry.
comment created time in a month
push eventhyperledger/fabric
commit sha f47ac7d8e49d78d9a33a7d5525d2f434b177f96d
Drain session pool before creating new sessions If a bad session was retrieved from the session pool, a new session would be immediately created instead of attempting to retrieve another session from the pool. This change attempts to uses pooled sessions before creating new ones. Signed-off-by: Matthew Sykes <[email protected]> Signed-off-by: Gari Singh <[email protected]>
commit sha 8a637325607c7f3d2a611be9b27653a8eb23d306
Merge pkcs11/impl.go and pkcs11/pkcs11.go Signed-off-by: Matthew Sykes <[email protected]> Signed-off-by: Gari Singh <[email protected]>
commit sha 86a5c64219761a96365e6989da2f1dfc6f0d313f
Replace loadLib with initialize method Signed-off-by: Matthew Sykes <[email protected]> Signed-off-by: Gari Singh <[email protected]>
commit sha 2a2216067faca1219683acf19aefbaaf798efa02
Make findKeyPairFromSKI a method on impl Signed-off-by: Matthew Sykes <[email protected]> Signed-off-by: Gari Singh <[email protected]>
commit sha bf2f3fc530815b961abb5ef99bfb42d2ec349148
Make ecPoint a method on impl Signed-off-by: Matthew Sykes <[email protected]>
commit sha 7b8de81ada3ee68bc92c78e3a2241ede8901fca2
Add object handle cache to PKCS#11 bccsp provider With this change, object handles obtained through findKeyPairFromSKI are cached in the PKCS#11 implementation of BCCSP. In support of this change, in addition to pooling idle sessions, the provider tracks active sessions. If some condition occurs that results in all sessions being closed, cached object handles are no longer valid so the handle cache is purged. Signed-off-by: Matthew Sykes <[email protected]>
commit sha 2fc575cbe2b7ec546659323cc8304f2e1c77599a
Cache bccsp keys generated from getECKey Signed-off-by: Matthew Sykes <[email protected]> Signed-off-by: Gari Singh <[email protected]>
push time in a month
pull request commenthyperledger/fabric
Cache object handles for PKCS#11 enabled BCCSP implementation
Sorry to do this to you again.
Testing with pkcs11...
# github.com/hyperledger/fabric/bccsp/pkcs11 [github.com/hyperledger/fabric/bccsp/pkcs11.test]
bccsp/pkcs11/pkcs11_test.go:1250:2: undefined: assert
bccsp/pkcs11/pkcs11_test.go:1251:2: undefined: assert
bccsp/pkcs11/pkcs11_test.go:1282:2: undefined: assert
bccsp/pkcs11/pkcs11_test.go:1286:2: undefined: assert
bccsp/pkcs11/pkcs11_test.go:1290:2: undefined: assert
bccsp/pkcs11/pkcs11_test.go:1294:2: undefined: assert
bccsp/pkcs11/pkcs11_test.go:1307:3: undefined: assert
bccsp/pkcs11/pkcs11_test.go:1324:3: undefined: assert
bccsp/pkcs11/pkcs11_test.go:1329:2: undefined: assert
bccsp/pkcs11/pkcs11_test.go:1380:2: undefined: assert
bccsp/pkcs11/pkcs11_test.go:1380:2: too many errors
ok github.com/hyperledger/fabric/bccsp/factory 6.931s coverage: 84.8% of statements
FAIL github.com/hyperledger/fabric/bccsp/pkcs11 [build failed]
FAIL
warning: execution failed: ./scripts/run-unit-tests.sh
You can fix the problem, and then run
git rebase --continue
This is running against the commit for `Make ecPoint a method on impl'
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")+ network = nwo.New(soloConfig, testDir, client, StartPort(), components)+ network.TLSEnabled = false+ // turn on dev mode for all peers+ for _, p := range network.Peers {+ p.DevMode = true+ }++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }+ legacyChaincodeID := fmt.Sprintf("%s:%s", legacyChaincode.Name, legacyChaincode.Version)++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("building chaincode")+ chaincodeExecutePath := components.Build(legacyChaincode.Path)++ By("running the chaincode")+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ fmt.Sprintf("CORE_CHAINCODE_ID_NAME=%s", legacyChaincodeID),+ }+ cmd := exec.Command(chaincodeExecutePath, []string{"-peer.address", peerChaincodeAddress}...)+ cmd.Env = append(cmd.Env, envs...)+ chaincodeRunner = ginkgomon.New(ginkgomon.Config{+ Name: "chaincode",+ Command: cmd,+ StartCheckTimeout: 15 * time.Second,+ })+ chaincodeProcess = ifrit.Invoke(chaincodeRunner)+ Eventually(chaincodeProcess.Ready(), network.EventuallyTimeout).Should(BeClosed())++ docContainers, err := client.ListContainers(docker.ListContainersOptions{All: false})
Issue a message when the chaincode starts and on every request received when a flag (not normally provided by the peer) or an environment variable (not normally provided by the peer) is set. Then make assertions on the output of the chaincode.
No docker. Low complexity. Easy to implement.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")+ network = nwo.New(soloConfig, testDir, client, StartPort(), components)+ network.TLSEnabled = false+ // turn on dev mode for all peers+ for _, p := range network.Peers {+ p.DevMode = true+ }++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }+ legacyChaincodeID := fmt.Sprintf("%s:%s", legacyChaincode.Name, legacyChaincode.Version)++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("building chaincode")+ chaincodeExecutePath := components.Build(legacyChaincode.Path)++ By("running the chaincode")+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ fmt.Sprintf("CORE_CHAINCODE_ID_NAME=%s", legacyChaincodeID),+ }+ cmd := exec.Command(chaincodeExecutePath, []string{"-peer.address", peerChaincodeAddress}...)+ cmd.Env = append(cmd.Env, envs...)+ chaincodeRunner = ginkgomon.New(ginkgomon.Config{+ Name: "chaincode",+ Command: cmd,+ StartCheckTimeout: 15 * time.Second,+ })+ chaincodeProcess = ifrit.Invoke(chaincodeRunner)+ Eventually(chaincodeProcess.Ready(), network.EventuallyTimeout).Should(BeClosed())++ docContainers, err := client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(err).NotTo(HaveOccurred())+ Expect(docContainers).Should(HaveLen(0))++ By("installing the chaincode")+ nwo.InstallChaincodeLegacy(network, legacyChaincode, peers...)++ By("instantiating the chaincode")+ nwo.InstantiateChaincodeLegacy(network, channelName, orderer, legacyChaincode, org1peer0, peers...)++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 100)++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(0))++ By("killing chaincode process")+ chaincodeProcess.Signal(syscall.SIGKILL)+ Eventually(chaincodeProcess.Wait(), network.EventuallyTimeout).Should(Receive())++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(0))++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 90)++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(1))+ Expect(docContainers[0].Names[0]).To(ContainSubstring("Org1.peer0-mycc-0.0"))+ })++ It("executes chaincode in dev mode", func() {+ chaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: components.Build("github.com/hyperledger/fabric/integration/chaincode/simple/cmd"),+ Lang: "binary",+ PackageFile: filepath.Join(testDir, "simplecc.tar.gz"),+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ SignaturePolicy: `OR ('Org1MSP.member')`,+ Sequence: "1",+ InitRequired: true,+ Label: "my_prebuilt_chaincode",+ }++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)
Same as the other test: We have one peer so I don't understand why we need this list and the expansions later on.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")+ network = nwo.New(soloConfig, testDir, client, StartPort(), components)+ network.TLSEnabled = false+ // turn on dev mode for all peers+ for _, p := range network.Peers {+ p.DevMode = true+ }++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }+ legacyChaincodeID := fmt.Sprintf("%s:%s", legacyChaincode.Name, legacyChaincode.Version)++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("building chaincode")+ chaincodeExecutePath := components.Build(legacyChaincode.Path)++ By("running the chaincode")+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ fmt.Sprintf("CORE_CHAINCODE_ID_NAME=%s", legacyChaincodeID),+ }+ cmd := exec.Command(chaincodeExecutePath, []string{"-peer.address", peerChaincodeAddress}...)+ cmd.Env = append(cmd.Env, envs...)+ chaincodeRunner = ginkgomon.New(ginkgomon.Config{+ Name: "chaincode",+ Command: cmd,+ StartCheckTimeout: 15 * time.Second,+ })+ chaincodeProcess = ifrit.Invoke(chaincodeRunner)+ Eventually(chaincodeProcess.Ready(), network.EventuallyTimeout).Should(BeClosed())++ docContainers, err := client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(err).NotTo(HaveOccurred())+ Expect(docContainers).Should(HaveLen(0))++ By("installing the chaincode")+ nwo.InstallChaincodeLegacy(network, legacyChaincode, peers...)++ By("instantiating the chaincode")+ nwo.InstantiateChaincodeLegacy(network, channelName, orderer, legacyChaincode, org1peer0, peers...)++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 100)++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(0))++ By("killing chaincode process")+ chaincodeProcess.Signal(syscall.SIGKILL)+ Eventually(chaincodeProcess.Wait(), network.EventuallyTimeout).Should(Receive())++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(0))++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 90)++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(1))+ Expect(docContainers[0].Names[0]).To(ContainSubstring("Org1.peer0-mycc-0.0"))+ })++ It("executes chaincode in dev mode", func() {+ chaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: components.Build("github.com/hyperledger/fabric/integration/chaincode/simple/cmd"),+ Lang: "binary",+ PackageFile: filepath.Join(testDir, "simplecc.tar.gz"),+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ SignaturePolicy: `OR ('Org1MSP.member')`,+ Sequence: "1",+ InitRequired: true,+ Label: "my_prebuilt_chaincode",+ }++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("enabling V2_0 application capabilities")+ nwo.EnableCapabilities(network, "testchannel", "Application", "V2_0", orderer, org1peer0)++ By("running the chaincode")+ chaincodeID := fmt.Sprintf("%s:%s", chaincode.Name, chaincode.Version)+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ fmt.Sprintf("CORE_PEER_ADDRESS=%s", peerChaincodeAddress),+ fmt.Sprintf("CORE_CHAINCODE_ID_NAME=%s", chaincodeID),+ }++ cmd := exec.Command(chaincode.Path, []string{"-peer.address", peerChaincodeAddress}...)+ cmd.Env = append(cmd.Env, envs...)+ chaincodeRunner = ginkgomon.New(ginkgomon.Config{+ Name: "chaincode",+ Command: cmd,+ StartCheckTimeout: 15 * time.Second,
Same comment about start check. Timeout is irrelevant if you don't have a check.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
func (c *Config) RemovePeer(orgName, peerName string) { } c.Peers = peers }++func (c *Config) RemoveOrg(orgName string) {+ orgs := []*Organization{}+ for _, o := range c.Organizations {+ if o.Name != orgName {+ orgs = append(orgs, o)+ }+ }+ c.Organizations = orgs++ for _, con := range c.Consortiums {+ orgs := []string{}+ for _, o := range con.Organizations {+ if o != orgName {+ orgs = append(orgs, o)+ }+ }+ con.Organizations = orgs+ }++ peers := []*Peer{}+ for _, p := range c.Peers {+ if p.Organization != orgName {+ peers = append(peers, p)+ }+ }+ c.Peers = peers++ for _, pro := range c.Profiles {+ orgs := []string{}+ for _, o := range pro.Organizations {+ if o != orgName {+ orgs = append(orgs, o)+ }+ }+ pro.Organizations = orgs+ }+}
Please remove this in favor of defining a fit-for-purpose network.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")+ network = nwo.New(soloConfig, testDir, client, StartPort(), components)+ network.TLSEnabled = false+ // turn on dev mode for all peers+ for _, p := range network.Peers {+ p.DevMode = true+ }++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }+ legacyChaincodeID := fmt.Sprintf("%s:%s", legacyChaincode.Name, legacyChaincode.Version)++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("building chaincode")+ chaincodeExecutePath := components.Build(legacyChaincode.Path)++ By("running the chaincode")+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ fmt.Sprintf("CORE_CHAINCODE_ID_NAME=%s", legacyChaincodeID),+ }+ cmd := exec.Command(chaincodeExecutePath, []string{"-peer.address", peerChaincodeAddress}...)+ cmd.Env = append(cmd.Env, envs...)+ chaincodeRunner = ginkgomon.New(ginkgomon.Config{+ Name: "chaincode",+ Command: cmd,+ StartCheckTimeout: 15 * time.Second,+ })+ chaincodeProcess = ifrit.Invoke(chaincodeRunner)+ Eventually(chaincodeProcess.Ready(), network.EventuallyTimeout).Should(BeClosed())++ docContainers, err := client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(err).NotTo(HaveOccurred())+ Expect(docContainers).Should(HaveLen(0))++ By("installing the chaincode")+ nwo.InstallChaincodeLegacy(network, legacyChaincode, peers...)++ By("instantiating the chaincode")+ nwo.InstantiateChaincodeLegacy(network, channelName, orderer, legacyChaincode, org1peer0, peers...)++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 100)++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(0))++ By("killing chaincode process")+ chaincodeProcess.Signal(syscall.SIGKILL)+ Eventually(chaincodeProcess.Wait(), network.EventuallyTimeout).Should(Receive())++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(0))++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 90)++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(1))+ Expect(docContainers[0].Names[0]).To(ContainSubstring("Org1.peer0-mycc-0.0"))+ })++ It("executes chaincode in dev mode", func() {+ chaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: components.Build("github.com/hyperledger/fabric/integration/chaincode/simple/cmd"),+ Lang: "binary",+ PackageFile: filepath.Join(testDir, "simplecc.tar.gz"),+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ SignaturePolicy: `OR ('Org1MSP.member')`,+ Sequence: "1",+ InitRequired: true,+ Label: "my_prebuilt_chaincode",+ }++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("enabling V2_0 application capabilities")+ nwo.EnableCapabilities(network, "testchannel", "Application", "V2_0", orderer, org1peer0)++ By("running the chaincode")+ chaincodeID := fmt.Sprintf("%s:%s", chaincode.Name, chaincode.Version)+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ fmt.Sprintf("CORE_PEER_ADDRESS=%s", peerChaincodeAddress),+ fmt.Sprintf("CORE_CHAINCODE_ID_NAME=%s", chaincodeID),+ }++ cmd := exec.Command(chaincode.Path, []string{"-peer.address", peerChaincodeAddress}...)
Why the complicated slice + expansion instead of just providing the two arguments?
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")+ network = nwo.New(soloConfig, testDir, client, StartPort(), components)+ network.TLSEnabled = false+ // turn on dev mode for all peers+ for _, p := range network.Peers {+ p.DevMode = true+ }++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }+ legacyChaincodeID := fmt.Sprintf("%s:%s", legacyChaincode.Name, legacyChaincode.Version)
No need to use Sprintf to concatenate three strings.
legacyChaincode.Name + ":" + legacyChaincode.Version ?
Also, it's way up here but not used until the environment is built.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")+ network = nwo.New(soloConfig, testDir, client, StartPort(), components)+ network.TLSEnabled = false+ // turn on dev mode for all peers+ for _, p := range network.Peers {+ p.DevMode = true+ }++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }+ legacyChaincodeID := fmt.Sprintf("%s:%s", legacyChaincode.Name, legacyChaincode.Version)++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("building chaincode")+ chaincodeExecutePath := components.Build(legacyChaincode.Path)++ By("running the chaincode")+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ fmt.Sprintf("CORE_CHAINCODE_ID_NAME=%s", legacyChaincodeID),+ }+ cmd := exec.Command(chaincodeExecutePath, []string{"-peer.address", peerChaincodeAddress}...)+ cmd.Env = append(cmd.Env, envs...)+ chaincodeRunner = ginkgomon.New(ginkgomon.Config{+ Name: "chaincode",+ Command: cmd,+ StartCheckTimeout: 15 * time.Second,+ })+ chaincodeProcess = ifrit.Invoke(chaincodeRunner)+ Eventually(chaincodeProcess.Ready(), network.EventuallyTimeout).Should(BeClosed())++ docContainers, err := client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(err).NotTo(HaveOccurred())+ Expect(docContainers).Should(HaveLen(0))++ By("installing the chaincode")+ nwo.InstallChaincodeLegacy(network, legacyChaincode, peers...)++ By("instantiating the chaincode")+ nwo.InstantiateChaincodeLegacy(network, channelName, orderer, legacyChaincode, org1peer0, peers...)++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 100)++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(0))++ By("killing chaincode process")+ chaincodeProcess.Signal(syscall.SIGKILL)+ Eventually(chaincodeProcess.Wait(), network.EventuallyTimeout).Should(Receive())++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(0))++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 90)++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(1))+ Expect(docContainers[0].Names[0]).To(ContainSubstring("Org1.peer0-mycc-0.0"))+ })++ It("executes chaincode in dev mode", func() {+ chaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: components.Build("github.com/hyperledger/fabric/integration/chaincode/simple/cmd"),+ Lang: "binary",+ PackageFile: filepath.Join(testDir, "simplecc.tar.gz"),+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ SignaturePolicy: `OR ('Org1MSP.member')`,+ Sequence: "1",+ InitRequired: true,+ Label: "my_prebuilt_chaincode",+ }++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("enabling V2_0 application capabilities")+ nwo.EnableCapabilities(network, "testchannel", "Application", "V2_0", orderer, org1peer0)++ By("running the chaincode")+ chaincodeID := fmt.Sprintf("%s:%s", chaincode.Name, chaincode.Version)+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ fmt.Sprintf("CORE_PEER_ADDRESS=%s", peerChaincodeAddress),+ fmt.Sprintf("CORE_CHAINCODE_ID_NAME=%s", chaincodeID),
No need to use Sprintf and when we're just concatenating strings.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")+ network = nwo.New(soloConfig, testDir, client, StartPort(), components)+ network.TLSEnabled = false+ // turn on dev mode for all peers+ for _, p := range network.Peers {+ p.DevMode = true+ }++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }+ legacyChaincodeID := fmt.Sprintf("%s:%s", legacyChaincode.Name, legacyChaincode.Version)++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("building chaincode")+ chaincodeExecutePath := components.Build(legacyChaincode.Path)++ By("running the chaincode")+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ fmt.Sprintf("CORE_CHAINCODE_ID_NAME=%s", legacyChaincodeID),+ }+ cmd := exec.Command(chaincodeExecutePath, []string{"-peer.address", peerChaincodeAddress}...)+ cmd.Env = append(cmd.Env, envs...)+ chaincodeRunner = ginkgomon.New(ginkgomon.Config{+ Name: "chaincode",+ Command: cmd,+ StartCheckTimeout: 15 * time.Second,+ })+ chaincodeProcess = ifrit.Invoke(chaincodeRunner)+ Eventually(chaincodeProcess.Ready(), network.EventuallyTimeout).Should(BeClosed())++ docContainers, err := client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(err).NotTo(HaveOccurred())+ Expect(docContainers).Should(HaveLen(0))++ By("installing the chaincode")+ nwo.InstallChaincodeLegacy(network, legacyChaincode, peers...)++ By("instantiating the chaincode")+ nwo.InstantiateChaincodeLegacy(network, channelName, orderer, legacyChaincode, org1peer0, peers...)++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 100)++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(0))++ By("killing chaincode process")+ chaincodeProcess.Signal(syscall.SIGKILL)+ Eventually(chaincodeProcess.Wait(), network.EventuallyTimeout).Should(Receive())++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(0))++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 90)++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(1))+ Expect(docContainers[0].Names[0]).To(ContainSubstring("Org1.peer0-mycc-0.0"))+ })++ It("executes chaincode in dev mode", func() {+ chaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: components.Build("github.com/hyperledger/fabric/integration/chaincode/simple/cmd"),+ Lang: "binary",+ PackageFile: filepath.Join(testDir, "simplecc.tar.gz"),+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ SignaturePolicy: `OR ('Org1MSP.member')`,+ Sequence: "1",+ InitRequired: true,+ Label: "my_prebuilt_chaincode",+ }++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("enabling V2_0 application capabilities")+ nwo.EnableCapabilities(network, "testchannel", "Application", "V2_0", orderer, org1peer0)++ By("running the chaincode")+ chaincodeID := fmt.Sprintf("%s:%s", chaincode.Name, chaincode.Version)
No need to use Sprintf when we're concatenating three strings.
chaincode.Name + ":" + chaincodeVersion
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")+ network = nwo.New(soloConfig, testDir, client, StartPort(), components)+ network.TLSEnabled = false+ // turn on dev mode for all peers+ for _, p := range network.Peers {+ p.DevMode = true+ }++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }+ legacyChaincodeID := fmt.Sprintf("%s:%s", legacyChaincode.Name, legacyChaincode.Version)++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("building chaincode")+ chaincodeExecutePath := components.Build(legacyChaincode.Path)++ By("running the chaincode")+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ fmt.Sprintf("CORE_CHAINCODE_ID_NAME=%s", legacyChaincodeID),+ }+ cmd := exec.Command(chaincodeExecutePath, []string{"-peer.address", peerChaincodeAddress}...)+ cmd.Env = append(cmd.Env, envs...)+ chaincodeRunner = ginkgomon.New(ginkgomon.Config{+ Name: "chaincode",+ Command: cmd,+ StartCheckTimeout: 15 * time.Second,+ })+ chaincodeProcess = ifrit.Invoke(chaincodeRunner)+ Eventually(chaincodeProcess.Ready(), network.EventuallyTimeout).Should(BeClosed())++ docContainers, err := client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(err).NotTo(HaveOccurred())+ Expect(docContainers).Should(HaveLen(0))
Expect/To Eventually/Should (here and elsewhere)
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")+ network = nwo.New(soloConfig, testDir, client, StartPort(), components)+ network.TLSEnabled = false+ // turn on dev mode for all peers+ for _, p := range network.Peers {+ p.DevMode = true+ }++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }+ legacyChaincodeID := fmt.Sprintf("%s:%s", legacyChaincode.Name, legacyChaincode.Version)++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)
This confused me since we have exactly one peer. Again, with one peer, I'd expect to use the explicit peer instance that we're testing.
Later on this is used in the variadic list for no effect as we already explicitly use org1peer0.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")+ network = nwo.New(soloConfig, testDir, client, StartPort(), components)+ network.TLSEnabled = false+ // turn on dev mode for all peers+ for _, p := range network.Peers {+ p.DevMode = true+ }++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }+ legacyChaincodeID := fmt.Sprintf("%s:%s", legacyChaincode.Name, legacyChaincode.Version)++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("building chaincode")+ chaincodeExecutePath := components.Build(legacyChaincode.Path)++ By("running the chaincode")+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ fmt.Sprintf("CORE_CHAINCODE_ID_NAME=%s", legacyChaincodeID),+ }+ cmd := exec.Command(chaincodeExecutePath, []string{"-peer.address", peerChaincodeAddress}...)
Why the complicated slice and expansion instead of just providing the two arguments?
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")+ network = nwo.New(soloConfig, testDir, client, StartPort(), components)+ network.TLSEnabled = false+ // turn on dev mode for all peers+ for _, p := range network.Peers {+ p.DevMode = true+ }++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }+ legacyChaincodeID := fmt.Sprintf("%s:%s", legacyChaincode.Name, legacyChaincode.Version)++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("building chaincode")+ chaincodeExecutePath := components.Build(legacyChaincode.Path)++ By("running the chaincode")+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ fmt.Sprintf("CORE_CHAINCODE_ID_NAME=%s", legacyChaincodeID),+ }+ cmd := exec.Command(chaincodeExecutePath, []string{"-peer.address", peerChaincodeAddress}...)+ cmd.Env = append(cmd.Env, envs...)+ chaincodeRunner = ginkgomon.New(ginkgomon.Config{+ Name: "chaincode",+ Command: cmd,+ StartCheckTimeout: 15 * time.Second,+ })+ chaincodeProcess = ifrit.Invoke(chaincodeRunner)+ Eventually(chaincodeProcess.Ready(), network.EventuallyTimeout).Should(BeClosed())++ docContainers, err := client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(err).NotTo(HaveOccurred())+ Expect(docContainers).Should(HaveLen(0))++ By("installing the chaincode")+ nwo.InstallChaincodeLegacy(network, legacyChaincode, peers...)++ By("instantiating the chaincode")+ nwo.InstantiateChaincodeLegacy(network, channelName, orderer, legacyChaincode, org1peer0, peers...)++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 100)++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(0))++ By("killing chaincode process")+ chaincodeProcess.Signal(syscall.SIGKILL)+ Eventually(chaincodeProcess.Wait(), network.EventuallyTimeout).Should(Receive())++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(0))++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 90)++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(1))+ Expect(docContainers[0].Names[0]).To(ContainSubstring("Org1.peer0-mycc-0.0"))
Please see above: I believe this asserting incorrect behavior that we do not want to preserve in v2
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")+ network = nwo.New(soloConfig, testDir, client, StartPort(), components)+ network.TLSEnabled = false+ // turn on dev mode for all peers+ for _, p := range network.Peers {+ p.DevMode = true+ }++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }+ legacyChaincodeID := fmt.Sprintf("%s:%s", legacyChaincode.Name, legacyChaincode.Version)++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("building chaincode")+ chaincodeExecutePath := components.Build(legacyChaincode.Path)++ By("running the chaincode")+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ fmt.Sprintf("CORE_CHAINCODE_ID_NAME=%s", legacyChaincodeID),+ }+ cmd := exec.Command(chaincodeExecutePath, []string{"-peer.address", peerChaincodeAddress}...)+ cmd.Env = append(cmd.Env, envs...)+ chaincodeRunner = ginkgomon.New(ginkgomon.Config{+ Name: "chaincode",+ Command: cmd,+ StartCheckTimeout: 15 * time.Second,
If there's no start check so the timeout doesn't matter and the Eventually(chaincodeProcess.Ready()) assertions are useless. When the start check is not specified, it becomes immediately satisfied.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")+ network = nwo.New(soloConfig, testDir, client, StartPort(), components)+ network.TLSEnabled = false+ // turn on dev mode for all peers+ for _, p := range network.Peers {+ p.DevMode = true+ }++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }+ legacyChaincodeID := fmt.Sprintf("%s:%s", legacyChaincode.Name, legacyChaincode.Version)++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("building chaincode")+ chaincodeExecutePath := components.Build(legacyChaincode.Path)++ By("running the chaincode")+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ fmt.Sprintf("CORE_CHAINCODE_ID_NAME=%s", legacyChaincodeID),+ }+ cmd := exec.Command(chaincodeExecutePath, []string{"-peer.address", peerChaincodeAddress}...)+ cmd.Env = append(cmd.Env, envs...)+ chaincodeRunner = ginkgomon.New(ginkgomon.Config{+ Name: "chaincode",+ Command: cmd,+ StartCheckTimeout: 15 * time.Second,+ })+ chaincodeProcess = ifrit.Invoke(chaincodeRunner)+ Eventually(chaincodeProcess.Ready(), network.EventuallyTimeout).Should(BeClosed())++ docContainers, err := client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(err).NotTo(HaveOccurred())+ Expect(docContainers).Should(HaveLen(0))++ By("installing the chaincode")+ nwo.InstallChaincodeLegacy(network, legacyChaincode, peers...)++ By("instantiating the chaincode")+ nwo.InstantiateChaincodeLegacy(network, channelName, orderer, legacyChaincode, org1peer0, peers...)++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 100)++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(0))++ By("killing chaincode process")+ chaincodeProcess.Signal(syscall.SIGKILL)+ Eventually(chaincodeProcess.Wait(), network.EventuallyTimeout).Should(Receive())++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(0))++ By("querying and invoking the chaincode")+ RunQueryInvokeQuery(network, orderer, org1peer0, channelName, 90)++ docContainers, err = client.ListContainers(docker.ListContainersOptions{All: false})+ Expect(docContainers).Should(HaveLen(1))+ Expect(docContainers[0].Names[0]).To(ContainSubstring("Org1.peer0-mycc-0.0"))+ })++ It("executes chaincode in dev mode", func() {+ chaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: components.Build("github.com/hyperledger/fabric/integration/chaincode/simple/cmd"),+ Lang: "binary",+ PackageFile: filepath.Join(testDir, "simplecc.tar.gz"),+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ SignaturePolicy: `OR ('Org1MSP.member')`,+ Sequence: "1",+ InitRequired: true,+ Label: "my_prebuilt_chaincode",+ }++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("enabling V2_0 application capabilities")+ nwo.EnableCapabilities(network, "testchannel", "Application", "V2_0", orderer, org1peer0)
You're using channelName everywhere else. I had to change this when I used the hand-crafted network.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")+ network = nwo.New(soloConfig, testDir, client, StartPort(), components)+ network.TLSEnabled = false+ // turn on dev mode for all peers+ for _, p := range network.Peers {+ p.DevMode = true+ }++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }+ legacyChaincodeID := fmt.Sprintf("%s:%s", legacyChaincode.Name, legacyChaincode.Version)++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("building chaincode")+ chaincodeExecutePath := components.Build(legacyChaincode.Path)++ By("running the chaincode")+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ fmt.Sprintf("CORE_CHAINCODE_ID_NAME=%s", legacyChaincodeID),+ }+ cmd := exec.Command(chaincodeExecutePath, []string{"-peer.address", peerChaincodeAddress}...)+ cmd.Env = append(cmd.Env, envs...)+ chaincodeRunner = ginkgomon.New(ginkgomon.Config{+ Name: "chaincode",+ Command: cmd,+ StartCheckTimeout: 15 * time.Second,+ })+ chaincodeProcess = ifrit.Invoke(chaincodeRunner)+ Eventually(chaincodeProcess.Ready(), network.EventuallyTimeout).Should(BeClosed())++ docContainers, err := client.ListContainers(docker.ListContainersOptions{All: false})
nit: 'doc' implies documentation, not docker.
non-nit: Why are we playing with Docker at all? If this is dev mode, the chaincode should be started and registered by the developer. If it goes down, the chaincode should not be started by the peer - which appears to be what is being tested.
At the end of the day, the behavior from the new chaincode is what I'd expect here: the peer does not start (non-system) chaincode when we're in dev mode. That means all of the docker related enumerations and validation can be removed.
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")+ network = nwo.New(soloConfig, testDir, client, StartPort(), components)+ network.TLSEnabled = false+ // turn on dev mode for all peers+ for _, p := range network.Peers {+ p.DevMode = true+ }
There should be only one peer. Why not just change it?
network.Peer("Org1", "peer0").DevMode = true
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")+ network = nwo.New(soloConfig, testDir, client, StartPort(), components)+ network.TLSEnabled = false+ // turn on dev mode for all peers+ for _, p := range network.Peers {+ p.DevMode = true+ }++ network.GenerateConfigTree()+ network.Bootstrap()++ networkRunner := network.NetworkGroupRunner()+ process = ifrit.Invoke(networkRunner)+ Eventually(process.Ready(), network.EventuallyTimeout).Should(BeClosed())+ })++ AfterEach(func() {+ if process != nil {+ process.Signal(syscall.SIGTERM)+ Eventually(process.Wait(), network.EventuallyTimeout).Should(Receive())+ }++ if chaincodeProcess != nil {+ chaincodeProcess.Signal(syscall.SIGTERM)+ }++ if network != nil {+ network.Cleanup()+ }++ os.RemoveAll(testDir)+ })++ It("executes chaincode in dev mode using legacy lifecycle", func() {+ legacyChaincode = nwo.Chaincode{+ Name: "mycc",+ Version: "0.0",+ Path: "github.com/hyperledger/fabric/integration/chaincode/simple/cmd",+ Ctor: `{"Args":["init","a","100","b","200"]}`,+ Policy: `OR ('Org1MSP.member')`,+ }+ legacyChaincodeID := fmt.Sprintf("%s:%s", legacyChaincode.Name, legacyChaincode.Version)++ org1peer0 := network.Peer("Org1", "peer0")+ peers := network.PeersWithChannel(channelName)+ orderer := network.Orderer("orderer")++ By("setting up the channel")+ network.CreateAndJoinChannel(orderer, channelName)++ By("building chaincode")+ chaincodeExecutePath := components.Build(legacyChaincode.Path)++ By("running the chaincode")+ peerChaincodeAddress := network.PeerAddress(org1peer0, nwo.ChaincodePort)+ envs := []string{+ "CORE_PEER_TLS_ENABLED=false",+ fmt.Sprintf("CORE_CHAINCODE_ID_NAME=%s", legacyChaincodeID),
Appending is a good choice here: "CORE_CHAINCODE_ID_NAME=" + legacyChaincodeID
comment created time in a month
Pull request review commenthyperledger/fabric
[FAB-18120] Add integration test for DevMode using new lifecycle
+/*+Copyright IBM Corp All Rights Reserved.+SPDX-License-Identifier: Apache-2.0+*/++package devmode++import (+ "fmt"+ "io/ioutil"+ "os"+ "os/exec"+ "path/filepath"+ "strconv"+ "syscall"+ "time"++ docker "github.com/fsouza/go-dockerclient"+ "github.com/hyperledger/fabric/integration/nwo"+ "github.com/hyperledger/fabric/integration/nwo/commands"+ . "github.com/onsi/ginkgo"+ . "github.com/onsi/gomega"+ "github.com/onsi/gomega/gbytes"+ "github.com/onsi/gomega/gexec"+ "github.com/tedsuo/ifrit"+ "github.com/tedsuo/ifrit/ginkgomon"+)++var _ = Describe("Devmode", func() {+ var (+ testDir string+ client *docker.Client+ network *nwo.Network+ process ifrit.Process+ chaincode nwo.Chaincode+ legacyChaincode nwo.Chaincode+ chaincodeRunner *ginkgomon.Runner+ chaincodeProcess ifrit.Process+ channelName string+ )++ BeforeEach(func() {+ var err error+ channelName = "testchannel"+ testDir, err = ioutil.TempDir("", "devmode")+ Expect(err).NotTo(HaveOccurred())++ client, err = docker.NewClientFromEnv()+ Expect(err).NotTo(HaveOccurred())++ soloConfig := nwo.BasicSolo()+ soloConfig.RemoveOrg("Org2")
Please don't add to the config structure. They are meant to be literals. (There's one other method on config and it really needs to be removed.)
Instead, you can create a network configuration for this package that does exactly what you want and nothing else. This one works for me:
var devNetwork = &nwo.Config{
Organizations: []*nwo.Organization{{
Name: "OrdererOrg",
MSPID: "OrdererMSP",
Domain: "example.com",
CA: &nwo.CA{Hostname: "ca"},
}, {
Name: "Org1",
MSPID: "Org1MSP",
Domain: "org1.example.com",
EnableNodeOUs: true,
Users: 1,
CA: &nwo.CA{Hostname: "ca"},
}},
Consortiums: []*nwo.Consortium{
{Name: "DevConsortium", Organizations: []string{"Org1"}},
},
Consensus: &nwo.Consensus{
Type: "solo",
BootstrapMethod: "file",
},
SystemChannel: &nwo.SystemChannel{
Name: "systemchannel",
Profile: "OrderingProfile",
},
Channels: []*nwo.Channel{
{Name: "devchannel", Profile: "DevProfile"},
},
Profiles: []*nwo.Profile{
{Name: "OrderingProfile", Orderers: []string{"orderer"}},
{Name: "DevProfile", Consortium: "DevConsortium", Organizations: []string{"Org1"}},
},
Orderers: []*nwo.Orderer{
{Name: "orderer", Organization: "OrdererOrg"},
},
Peers: []*nwo.Peer{{
Name: "peer0",
Organization: "Org1",
Channels: []*nwo.PeerChannel{{Name: "devchannel"}},
}},
}
comment created time in a month
push eventhyperledger/fabric
commit sha bb70d42175b34c0399e9ff74ed087c1f8d1cbd5d
Use test helpers and table tests in bccsp/pkcs11 Signed-off-by: Matthew Sykes <[email protected]>
commit sha 7b259b5b46d4026322d514526056b386a63ee472
Add explicit test for config#setSecurityLevel Signed-off-by: Matthew Sykes <[email protected]>
commit sha 3696e3022a2cc376d9fe62e057f14f06ddaec1b5
Remove TestSHA from bccsp/pkcs11 tests The implementation of Hash comes from the software provider and is already tested there. Signed-off-by: Matthew Sykes <[email protected]>
commit sha c16eaad45a82f3607f20208e99364d44bb113463
Remove unused argument to unexported ECDSA funcs Signed-off-by: Matthew Sykes <[email protected]>
commit sha 82b867ff2d846e81d02977233410222abe10372f
Move {sign,verify}ECDSA to pkcs11.go & rm ecdsa.go Signed-off-by: Matthew Sykes <[email protected]>
commit sha f55ef458bbb406620ce7db2ede93eb496ad4ab7f
Isolate softVerify to impacted test paths The SoftwareVerify option only get used when validating ECDSA signatures. By isolating the configuration to the test that requires it, we can reduce the number of times all tests are executed. Signed-off-by: Matthew Sykes <[email protected]>
commit sha c84fd9aef0e2a4a6efe7de5901a26b86f716a1f3
Remove unused fields from pkcs11#config The hash family and AES bit length fields from the config object are not used by the bccsp/pkcs11 package and can be removed. After removing the unused fields, we can further prune the test configurations used in the bccsp/pkcs11 tests. Signed-off-by: Matthew Sykes <[email protected]>
commit sha aa0f9212ff9d44600c5bb6eb8cf24de994f0311e
Remove bccsp/pkcs11#config After removing the unused fields from pkcs11#config, all that was left was the calculation of the curve from the security level. This logic has been extracted to a function and the config struct has been removed. Signed-off-by: Matthew Sykes <[email protected]>
commit sha 87458b0540e185268d90fb7b6840da07638ffaa1
Reduce test duplication in bccsp/pkcs11 A large portion of the tests in bccsp/pkcs11 was exercising the software provider. These changes replace the functional testing with tests that verify delegation to the software provider. Additional changes were made to - verify the CKA_TOKEN and CKA_MODIFIABLE attributes of objects created with generating keys. - remove unnecessary stubs to Encrypt, Decrypt, and KeyImport - remove the config loop from TestMain that resulted in tests running multiple times Signed-off-by: Matthew Sykes <[email protected]>
commit sha 7d3aa2562aaf80baaeb641eaa6c8294718b55b54
Use separate provider instances in tests - Add options and key store helpers for provider instantiation in test - Move from a package level configuration and a single instance to multiple instances in test - Move session management knobs to (unexported) configuration - Attempt systematic test cleanup - Remove TestMain Signed-off-by: Matthew Sykes <[email protected]>
commit sha 1e91646de5b83420e1424442376febcce221fc5a
Rename bccsp/pkcs11#impl bccsp/pkcs11#Provider Rename and export the implementation and modify the constructor to return the concrete type instead of an interface. Signed-off-by: Matthew Sykes <[email protected]>
push time in a month
push eventhyperledger/fabric
commit sha 19ed8eba892c54f73795deb047a984b8bd1f3390
fix typo 'Udpate' -> 'Update' Signed-off-by: nontapat <[email protected]>
push time in a month
PR merged hyperledger/fabric
Signed-off-by: nontapat [email protected]
<!--- DELETE MARKDOWN COMMENTS BEFORE SUBMITTING PULL REQUEST. -->
<!--- Provide a descriptive summary of your changes in the Title above. -->
Type of change
<!--- What type of change? Pick one option and delete the others. -->
- Bug fix
- New feature
- Improvement (improvement to code, performance, etc)
- Test update
- Documentation update
Description
<!--- Describe your changes in detail, including motivation. -->
Additional details
<!--- Additional implementation details or comments to reviewers. --> <!--- Summarize how the pull request was tested (if not obvious from commit). -->
Related issues
<!--- Include a link to any associated issues, e.g. Jira issue or approved rfc. -->
<!---
Release Note
If change impacts current users, uncomment Release Note heading and provide release note text. Also, copy release note text into the release specific /release_notes file. -->
<!-- Checklist (DELETE AFTER READING):
Signed-off-byadded to commits (required for DCO check to pass)- Tests have been added/updated (required for bug fixes and features)
- Unit and/or integration tests pass locally
- Run linters and checks locally using 'make checks'
- If change requires documentation updates, make updates in pull request, or open a separate issue and provide link
- Squash commits into a single commit, unless a stack of commits is intentional to assist reviewers or to preserve review comments.
- For additional contribution guidelines see the project's CONTRIBUTING.md file -->
pr closed time in a month