Skip to content

Commit

Permalink
handle lifecycle test
Browse files Browse the repository at this point in the history
Signed-off-by: May Rosenbaum <[email protected]>
  • Loading branch information
MayRosenbaum committed Apr 16, 2024
1 parent 9f6ed31 commit 210bc37
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
8 changes: 8 additions & 0 deletions integration/lifecycle/lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package lifecycle

import (
"bytes"
"encoding/json"
"os"
"path/filepath"
"syscall"
Expand Down Expand Up @@ -297,6 +298,9 @@ var _ = Describe("Lifecycle", func() {
currentConfig := nwo.GetConfig(network, testPeers[0], orderer, "testchannel")
updatedConfig := proto.Clone(currentConfig).(*common.Config)

jsonObj, err := json.MarshalIndent(updatedConfig, "", " ")
_ = os.WriteFile("updatedConfig.json", jsonObj, 0644)

// get the configtx info for org3
sess, err = network.ConfigTxGen(commands.PrintOrg{
ConfigPath: network.RootDir,
Expand All @@ -307,6 +311,10 @@ var _ = Describe("Lifecycle", func() {
org3Group := &ordererext.DynamicOrdererOrgGroup{ConfigGroup: &common.ConfigGroup{}}
err = protolator.DeepUnmarshalJSON(bytes.NewBuffer(sess.Out.Contents()), org3Group)
Expect(err).NotTo(HaveOccurred())
//delete(org3Group.Values, "Endpoints")

jsonObj, err = json.MarshalIndent(org3Group, "", " ")
_ = os.WriteFile("org3Group.json", jsonObj, 0644)

// update the channel config to include org3
updatedConfig.ChannelGroup.Groups["Application"].Groups["Org3"] = org3Group.ConfigGroup
Expand Down
17 changes: 14 additions & 3 deletions orderer/common/cluster/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package cluster_test
import (
"bytes"
"context"
"crypto/sha256"
"crypto/x509"
"encoding/pem"
"errors"
Expand Down Expand Up @@ -789,8 +790,18 @@ func TestBlockVerifierBuilderNoConfigBlock(t *testing.T) {

func TestBlockVerifierFunc(t *testing.T) {
block := sampleConfigBlock(t)
require.NotNil(t, block)
bvfunc := cluster.BlockVerifierBuilder(&mocks.BCCSP{})
//require.NotNil(t, block)

//cp, err := sw.NewDefaultSecurityLevelWithKeystore(sw.NewDummyKeyStore())
//require.NoError(t, err)
//hash, err := cp.GetHash(&bccsp.SHA256Opts{})
//require.NoError(t, err)
//require.NotNil(t, hash)

bccsp := &mocks.BCCSP{}
bccsp.GetHashReturns(sha256.New(), nil)

bvfunc := cluster.BlockVerifierBuilder(bccsp)

verifier := bvfunc(block)

Expand Down Expand Up @@ -895,7 +906,7 @@ func sampleConfigBlock(t *testing.T) *common.Block {
Id: 1,
Host: "host1",
Port: 8001,
MspId: "msp1",
MspId: "SampleOrg",
Identity: []byte("identity1"),
},
},
Expand Down

0 comments on commit 210bc37

Please sign in to comment.