Skip to content

Commit ba55204

Browse files
committed
Merge branch 'release-2.5' into release-2.5-bft
Signed-off-by: Fedor Partanskiy <fredprtnsk@gmail.com> # Conflicts: # go.mod # go.sum # tools/go.mod # tools/go.sum # vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md # vendor/github.com/onsi/ginkgo/v2/core_dsl.go # vendor/github.com/onsi/ginkgo/v2/ginkgo/main.go # vendor/github.com/onsi/ginkgo/v2/ginkgo_t_dsl.go # vendor/github.com/onsi/ginkgo/v2/internal/node.go # vendor/github.com/onsi/ginkgo/v2/reporters/junit_report.go # vendor/github.com/onsi/ginkgo/v2/table_dsl.go # vendor/github.com/onsi/ginkgo/v2/types/config.go # vendor/github.com/onsi/ginkgo/v2/types/types.go # vendor/github.com/onsi/ginkgo/v2/types/version.go # vendor/github.com/onsi/gomega/CHANGELOG.md # vendor/github.com/onsi/gomega/gomega_dsl.go # vendor/github.com/onsi/gomega/gstruct/fields.go # vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb # vendor/google.golang.org/protobuf/internal/filedesc/editions.go # vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go # vendor/google.golang.org/protobuf/internal/version/version.go # vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go # vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go # vendor/modules.txt
2 parents 7613957 + 16a1c59 commit ba55204

File tree

196 files changed

+17846
-1771
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+17846
-1771
lines changed

bccsp/factory/nopkcs11.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build !pkcs11
2-
// +build !pkcs11
32

43
/*
54
Copyright IBM Corp. All Rights Reserved.

bccsp/factory/nopkcs11_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build !pkcs11
2-
// +build !pkcs11
32

43
/*
54
Copyright IBM Corp. All Rights Reserved.

bccsp/factory/pkcs11.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build pkcs11
2-
// +build pkcs11
32

43
/*
54
Copyright IBM Corp. All Rights Reserved.

bccsp/factory/pkcs11_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build pkcs11
2-
// +build pkcs11
32

43
/*
54
Copyright IBM Corp. All Rights Reserved.

bccsp/factory/pkcs11factory.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build pkcs11
2-
// +build pkcs11
32

43
/*
54
Copyright IBM Corp. All Rights Reserved.

bccsp/factory/pkcs11factory_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build pkcs11
2-
// +build pkcs11
32

43
/*
54
Copyright IBM Corp. All Rights Reserved.

bccsp/pkcs11/pkcs11_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build pkcs11
2-
// +build pkcs11
32

43
/*
54
Copyright IBM Corp. All Rights Reserved.

core/deliverservice/config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"io/ioutil"
1212
"time"
1313

14+
"github.com/hyperledger/fabric/common/viperutil"
1415
"github.com/hyperledger/fabric/core/config"
1516
"github.com/hyperledger/fabric/internal/pkg/comm"
1617
"github.com/hyperledger/fabric/internal/pkg/peer/orderers"
@@ -72,7 +73,7 @@ func GlobalConfig() *DeliverServiceConfig {
7273
// LoadOverridesMap reads and returns endpoints from the peer config
7374
func LoadOverridesMap() (map[string]*orderers.Endpoint, error) {
7475
var overrides []AddressOverride
75-
err := viper.UnmarshalKey("peer.deliveryclient.addressOverrides", &overrides)
76+
err := viper.UnmarshalKey("peer.deliveryclient.addressOverrides", &overrides, viper.DecodeHook(viperutil.YamlStringToStructHook(overrides)))
7677
if err != nil {
7778
return nil, errors.WithMessage(err, "could not unmarshal peer.deliveryclient.addressOverrides")
7879
}

core/deliverservice/config_test.go

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ import (
1111
"io/ioutil"
1212
"os"
1313
"path/filepath"
14+
"strings"
1415
"testing"
1516
"time"
1617

17-
"github.com/stretchr/testify/require"
18-
1918
"github.com/hyperledger/fabric/core/deliverservice"
19+
"github.com/hyperledger/fabric/internal/peer/common"
2020
"github.com/hyperledger/fabric/internal/pkg/comm"
2121
"github.com/spf13/viper"
22+
"github.com/stretchr/testify/require"
2223
)
2324

2425
func TestSecureOptsConfig(t *testing.T) {
@@ -161,6 +162,37 @@ func TestLoadOverridesMap(t *testing.T) {
161162
require.Equal(t, "addressTo2", ep2.Address)
162163
})
163164

165+
t.Run("GreenPath With Env", func(t *testing.T) {
166+
t.Setenv("CORE_PEER_DELIVERYCLIENT_ADDRESSOVERRIDES", "[{from: addressFrom1, to: addressTo1, caCertsFile: testdata/cert.pem}"+
167+
", {from: addressFrom2, to: addressTo2, caCertsFile: testdata/cert.pem}]")
168+
config := `
169+
peer:
170+
deliveryclient:
171+
addressOverrides:
172+
`
173+
174+
viper.Reset()
175+
176+
viper.SetEnvPrefix(common.CmdRoot)
177+
viper.AllowEmptyEnv(true)
178+
viper.AutomaticEnv()
179+
replacer := strings.NewReplacer(".", "_")
180+
viper.SetEnvKeyReplacer(replacer)
181+
182+
viper.SetConfigType("yaml")
183+
err := viper.ReadConfig(bytes.NewBuffer([]byte(config)))
184+
require.NoError(t, err)
185+
res, err := deliverservice.LoadOverridesMap()
186+
require.NoError(t, err)
187+
require.Len(t, res, 2)
188+
ep1, ok := res["addressFrom1"]
189+
require.True(t, ok)
190+
require.Equal(t, "addressTo1", ep1.Address)
191+
ep2, ok := res["addressFrom2"]
192+
require.True(t, ok)
193+
require.Equal(t, "addressTo2", ep2.Address)
194+
})
195+
164196
t.Run("MissingCAFiles", func(t *testing.T) {
165197
config := `
166198
peer:

core/handlers/library/noplugin_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build noplugin
2-
// +build noplugin
32

43
/*
54
Copyright IBM Corp. All Rights Reserved.

0 commit comments

Comments
 (0)