Skip to content

Commit

Permalink
integration test updates
Browse files Browse the repository at this point in the history
Signed-off-by: Parameswaran Selvam <parselva@in.ibm.com>
  • Loading branch information
Param-S committed Nov 22, 2022
1 parent 52e485a commit b2b3d2e
Show file tree
Hide file tree
Showing 5 changed files with 641 additions and 1 deletion.
48 changes: 48 additions & 0 deletions integration/nwo/standard_networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,51 @@ func MultiNodeBFT() *Config {

return config
}

func BasicSmartBFT() *Config {
config := BasicConfig()
config.Consensus.Type = "smartbft"
config.Profiles = []*Profile{{
Name: "SampleDevModeSmartBFT",
Orderers: []string{"orderer"},
}, {
Name: "TwoOrgsChannel",
Consortium: "SampleConsortium",
Organizations: []string{"Org1", "Org2"},
}}
/* for _, peer := range config.Peers {
peer.BFTDeliveryClient = true
} */
config.SystemChannel.Profile = "SampleDevModeSmartBFT"
return config
}

func MultiNodeSmartBFT() *Config {
config := BasicSmartBFT()
config.Orderers = []*Orderer{
{Name: "orderer1", Organization: "OrdererOrg"},
{Name: "orderer2", Organization: "OrdererOrg"},
{Name: "orderer3", Organization: "OrdererOrg"},
{Name: "orderer4", Organization: "OrdererOrg"},
}
config.Profiles = []*Profile{{
Name: "SampleDevModeSmartBFT",
Orderers: []string{"orderer1", "orderer2", "orderer3", "orderer4"},
}, {
Name: "TwoOrgsChannel",
Consortium: "SampleConsortium",
Organizations: []string{"Org1", "Org2"},
}}

config.Channels = []*Channel{
{Name: "testchannel1", Profile: "TwoOrgsChannel"},
{Name: "testchannel2", Profile: "TwoOrgsChannel"}}

for _, peer := range config.Peers {
peer.Channels = []*PeerChannel{
{Name: "testchannel1", Anchor: true},
{Name: "testchannel2", Anchor: true},
}
}
return config
}
3 changes: 2 additions & 1 deletion integration/nwo/template/configtx_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,15 @@ Profiles:{{ range .Profiles }}
{{- else }}
V2_0: true
{{- end }}
{{- if eq $w.Consensus.Type "BFT" }}
{{- if eq $w.Consensus.Type "smartbft" }}
ConsenterMapping:{{ range $index, $orderer := .Orderers }}{{ with $w.Orderer . }}
- ID: {{ $index }}
Host: 127.0.0.1
Port: {{ $w.OrdererPort . "Cluster" }}
MSPID: {{ .Organization }}
ClientTLSCert: {{ $w.OrdererLocalCryptoDir . "tls" }}/server.crt
ServerTLSCert: {{ $w.OrdererLocalCryptoDir . "tls" }}/server.crt
Identity: {{ $w.OrdererLocalCryptoDir . "tls" }}/server.crt
{{- end }}{{- end }}
{{- end }}
{{- if eq $w.Consensus.Type "etcdraft" }}
Expand Down
1 change: 1 addition & 0 deletions integration/ports.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const (
PrivateDataBasePort
RaftBasePort
SBEBasePort
SmartBFTBasePort
)

// On linux, the default ephemeral port range is 32768-60999 and can be
Expand Down
53 changes: 53 additions & 0 deletions integration/smartbft/smartbft_suite_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
*
* Copyright IBM Corp. All Rights Reserved.
*
* SPDX-License-Identifier: Apache-2.0
* /
*
*/

package smartbft

import (
"encoding/json"
"testing"

"github.com/hyperledger/fabric/integration"
"github.com/hyperledger/fabric/integration/nwo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

func TestSmartBFT(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "SmartBFT-based Ordering Service Suite")
}

var (
buildServer *nwo.BuildServer
components *nwo.Components
)

var _ = SynchronizedBeforeSuite(func() []byte {
buildServer = nwo.NewBuildServer()
buildServer.Serve()

components = buildServer.Components()
payload, err := json.Marshal(components)
Expect(err).NotTo(HaveOccurred())

return payload
}, func(payload []byte) {
err := json.Unmarshal(payload, &components)
Expect(err).NotTo(HaveOccurred())
})

var _ = SynchronizedAfterSuite(func() {
}, func() {
buildServer.Shutdown()
})

func StartPort() int {
return integration.SmartBFTBasePort.StartPortForNode()
}
Loading

0 comments on commit b2b3d2e

Please sign in to comment.