Skip to content

Commit a160aea

Browse files
committed
[FAB-12255] set testing.T needed by testify
Newer versions of testify panic when a nil testing.T is used on assertions so fix the wiring. Change-Id: If8cb4d6405ed4a3b9e18fcdf148b18fcee16bbb7 Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
1 parent 4056c2a commit a160aea

File tree

5 files changed

+10
-3
lines changed

5 files changed

+10
-3
lines changed

core/chaincode/accesscontrol/access_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ func newCCServer(t *testing.T, port int, expectedCCname string, withTLS bool, ca
9191
l, err := net.Listen("tcp", fmt.Sprintf("%s:%d", "", port))
9292
assert.NoError(t, err, "%v", err)
9393
return &ccSrv{
94+
t: t,
9495
expectedCCname: expectedCCname,
9596
l: l,
9697
grpcSrv: s,

core/committer/txvalidator/plugin_validator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func TestSamplePlugin(t *testing.T) {
9090
capabilites := &mocks.Capabilities{}
9191
capabilites.On("PrivateChannelData").Return(true)
9292
factory := &mocks.PluginFactory{}
93-
factory.On("New").Return(&testdata.SampleValidationPlugin{})
93+
factory.On("New").Return(testdata.NewSampleValidationPlugin(t))
9494
pm["vscc"] = factory
9595

9696
transaction := testdata.MarshaledSignedData{

core/committer/txvalidator/testdata/test_plugin.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ type SampleValidationPlugin struct {
3030
pe PolicyEvaluator
3131
}
3232

33+
// NewSampleValidationPlugin returns an instance of a validation plugin setup
34+
// for assertions.
35+
func NewSampleValidationPlugin(t *testing.T) *SampleValidationPlugin {
36+
return &SampleValidationPlugin{t: t}
37+
}
38+
3339
type MarshaledSignedData struct {
3440
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
3541
Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`

core/committer/txvalidator/validator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,7 @@ func createCustomSupportAndLedger(t *testing.T) (*mocktxvalidator.Support, ledge
15991599

16001600
func TestDynamicCapabilitiesAndMSP(t *testing.T) {
16011601
factory := &mocks.PluginFactory{}
1602-
factory.On("New").Return(&testdata.SampleValidationPlugin{})
1602+
factory.On("New").Return(testdata.NewSampleValidationPlugin(t))
16031603
pm := &mocks.PluginMapper{}
16041604
pm.On("PluginFactoryByName", txvalidator.PluginName("vscc")).Return(factory)
16051605

core/deliverservice/requester_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func TestTLSBinding(t *testing.T) {
5050
})
5151
assert.NoError(t, err)
5252

53-
orderer.RegisterAtomicBroadcastServer(s.Server(), &mockOrderer{})
53+
orderer.RegisterAtomicBroadcastServer(s.Server(), &mockOrderer{t: t})
5454
go s.Start()
5555
defer s.Stop()
5656
time.Sleep(time.Second * 3)

0 commit comments

Comments
 (0)