diff --git a/integration/lifecycle/lifecycle_test.go b/integration/lifecycle/lifecycle_test.go index 2bca9d47c34..597a8365722 100644 --- a/integration/lifecycle/lifecycle_test.go +++ b/integration/lifecycle/lifecycle_test.go @@ -298,8 +298,8 @@ 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) + jsonObj, _ := json.MarshalIndent(updatedConfig, "", " ") + _ = os.WriteFile("updatedConfig.json", jsonObj, 0o644) // get the configtx info for org3 sess, err = network.ConfigTxGen(commands.PrintOrg{ @@ -311,10 +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") + // delete(org3Group.Values, "Endpoints") - jsonObj, err = json.MarshalIndent(org3Group, "", " ") - _ = os.WriteFile("org3Group.json", jsonObj, 0644) + jsonObj, _ = json.MarshalIndent(org3Group, "", " ") + _ = os.WriteFile("org3Group.json", jsonObj, 0o644) // update the channel config to include org3 updatedConfig.ChannelGroup.Groups["Application"].Groups["Org3"] = org3Group.ConfigGroup diff --git a/orderer/common/cluster/util_test.go b/orderer/common/cluster/util_test.go index 6f900e36714..18012bf4961 100644 --- a/orderer/common/cluster/util_test.go +++ b/orderer/common/cluster/util_test.go @@ -14,7 +14,8 @@ import ( "encoding/pem" "errors" "fmt" - "math" + "os" + "os/exec" "path/filepath" "strings" "sync" @@ -798,8 +799,6 @@ func generateCertificatesSmartBFT(confAppSmartBFT *genesisconfig.Profile, certDi } func TestBlockVerifierFunc(t *testing.T) { - //block := sampleConfigBlock() - certPath := filepath.Join("testdata", "blockverification", "msp", "signcerts") conf := genesisconfig.Load(genesisconfig.SampleAppChannelSmartBftProfile, filepath.Join("testdata", "blockverification")) @@ -845,97 +844,6 @@ func TestBlockVerifierFunc(t *testing.T) { require.NoError(t, err) } -func sampleConfigBlock() *common.Block { - return &common.Block{ - Header: &common.BlockHeader{ - PreviousHash: []byte("foo"), - }, - Data: &common.BlockData{ - Data: [][]byte{ - protoutil.MarshalOrPanic(&common.Envelope{ - Payload: protoutil.MarshalOrPanic(&common.Payload{ - Header: &common.Header{ - ChannelHeader: protoutil.MarshalOrPanic(&common.ChannelHeader{ - Type: int32(common.HeaderType_CONFIG), - ChannelId: "mychannel", - }), - }, - Data: protoutil.MarshalOrPanic(&common.ConfigEnvelope{ - Config: &common.Config{ - ChannelGroup: &common.ConfigGroup{ - Values: map[string]*common.ConfigValue{ - "Capabilities": { - Value: protoutil.MarshalOrPanic(&common.Capabilities{ - Capabilities: map[string]*common.Capability{"V3_0": {}}, - }), - }, - "HashingAlgorithm": { - Value: protoutil.MarshalOrPanic(&common.HashingAlgorithm{Name: "SHA256"}), - }, - "BlockDataHashingStructure": { - Value: protoutil.MarshalOrPanic(&common.BlockDataHashingStructure{Width: math.MaxUint32}), - }, - }, - Groups: map[string]*common.ConfigGroup{ - "Orderer": { - Groups: map[string]*common.ConfigGroup{ - "SampleOrg": {}, - }, - Policies: map[string]*common.ConfigPolicy{ - "BlockValidation": { - Policy: &common.Policy{ - Type: 3, - }, - }, - }, - Values: map[string]*common.ConfigValue{ - "BatchSize": { - Value: protoutil.MarshalOrPanic(&orderer.BatchSize{ - MaxMessageCount: 500, - AbsoluteMaxBytes: 10485760, - PreferredMaxBytes: 2097152, - }), - }, - "BatchTimeout": { - Value: protoutil.MarshalOrPanic(&orderer.BatchTimeout{ - Timeout: "2s", - }), - }, - "Capabilities": { - Value: protoutil.MarshalOrPanic(&common.Capabilities{ - Capabilities: map[string]*common.Capability{"V3_0": {}}, - }), - }, - "ConsensusType": { - Value: protoutil.MarshalOrPanic(&common.BlockData{Data: [][]byte{[]byte("BFT")}}), - }, - "Orderers": { - Value: protoutil.MarshalOrPanic(&common.Orderers{ - ConsenterMapping: []*common.Consenter{ - { - Id: 1, - Host: "host1", - Port: 8001, - MspId: "SampleOrg", - Identity: []byte("identity1"), - }, - }, - }), - }, - }, - }, - }, - }, - }, - }), - }), - Signature: []byte("bar"), - }), - }, - }, - } -} - func TestGetTLSSessionBinding(t *testing.T) { serverCert, err := ca.NewServerCertKeyPair("127.0.0.1") require.NoError(t, err)