Skip to content

Commit 88e418e

Browse files
authored
update fabric-proto-go dependency and tests (#56)
Signed-off-by: May Rosenbaum <mayro1595@gmail.com>
1 parent c29f04f commit 88e418e

12 files changed

Lines changed: 168 additions & 56 deletions

File tree

ci/azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ trigger:
1212

1313
variables:
1414
branch: $[ coalesce(variables['system.PullRequest.TargetBranch'], variables['build.SourceBranchName']) ]
15-
GO_VERSION: 1.16.7
15+
GO_VERSION: 1.20
1616
PATH: $(Agent.BuildDirectory)/go/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
1717

1818
pool:

ci/tools/tools.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build tools
12
// +build tools
23

34
// Copyright the Hyperledger Fabric contributors. All rights reserved.

configtx/application_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ func TestAppOrgRemoveAnchorPeerFailure(t *testing.T) {
518518
orgName: "Org1",
519519
anchorPeerToRemove: Address{Host: "host1", Port: 123},
520520
configValues: map[string]*cb.ConfigValue{AnchorPeersKey: {Value: []byte("a little fire")}},
521-
expectedErr: "failed unmarshaling anchor peer endpoints for application org Org1: proto: can't skip unknown wire type 6",
521+
expectedErr: "failed unmarshaling anchor peer endpoints for application org Org1: proto",
522522
},
523523
}
524524

@@ -547,7 +547,7 @@ func TestAppOrgRemoveAnchorPeerFailure(t *testing.T) {
547547
c := New(config)
548548

549549
err = c.Application().Organization(tt.orgName).RemoveAnchorPeer(tt.anchorPeerToRemove)
550-
gt.Expect(err).To(MatchError(tt.expectedErr))
550+
gt.Expect(err.Error()).To(ContainSubstring(tt.expectedErr))
551551
})
552552
}
553553
}
@@ -1083,7 +1083,8 @@ func TestApplicationACLsFailure(t *testing.T) {
10831083
c := New(config)
10841084

10851085
applicationACLs, err := c.Application().ACLs()
1086-
gt.Expect(err).To(MatchError("unmarshaling ACLs: unexpected EOF"))
1086+
gt.Expect(err.Error()).To(ContainSubstring("unmarshaling ACLs: proto:"))
1087+
gt.Expect(err.Error()).To(ContainSubstring("cannot parse invalid wire-format data"))
10871088
gt.Expect(applicationACLs).To(BeNil())
10881089
}
10891090

@@ -1354,7 +1355,7 @@ func TestAppOrgAddApplicationCapabilityFailures(t *testing.T) {
13541355
},
13551356
}
13561357
},
1357-
expectedErr: "retrieving application capabilities: unmarshaling capabilities: proto: can't skip unknown wire type 6",
1358+
expectedErr: "retrieving application capabilities: unmarshaling capabilities: proto",
13581359
},
13591360
}
13601361

@@ -1381,7 +1382,7 @@ func TestAppOrgAddApplicationCapabilityFailures(t *testing.T) {
13811382
c := New(config)
13821383

13831384
err = c.Application().AddCapability(tt.capability)
1384-
gt.Expect(err).To(MatchError(tt.expectedErr))
1385+
gt.Expect(err.Error()).To(ContainSubstring(tt.expectedErr))
13851386
})
13861387
}
13871388
}
@@ -1518,7 +1519,7 @@ func TestAppOrgRemoveApplicationCapabilityFailures(t *testing.T) {
15181519
},
15191520
}
15201521
},
1521-
expectedErr: "retrieving application capabilities: unmarshaling capabilities: proto: can't skip unknown wire type 6",
1522+
expectedErr: "retrieving application capabilities: unmarshaling capabilities: proto",
15221523
},
15231524
}
15241525

@@ -1545,7 +1546,7 @@ func TestAppOrgRemoveApplicationCapabilityFailures(t *testing.T) {
15451546
c := New(config)
15461547

15471548
err = c.Application().RemoveCapability(tt.capability)
1548-
gt.Expect(err).To(MatchError(tt.expectedErr))
1549+
gt.Expect(err.Error()).To(ContainSubstring(tt.expectedErr))
15491550
})
15501551
}
15511552
}

configtx/channel_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func TestSetChannelCapabilityFailures(t *testing.T) {
110110
},
111111
},
112112
},
113-
expectedErr: "retrieving channel capabilities: unmarshaling capabilities: proto: can't skip unknown wire type 6",
113+
expectedErr: "retrieving channel capabilities: unmarshaling capabilities: proto",
114114
},
115115
}
116116

@@ -124,7 +124,7 @@ func TestSetChannelCapabilityFailures(t *testing.T) {
124124
c := New(tt.config)
125125

126126
err := c.Channel().AddCapability(tt.capability)
127-
gt.Expect(err).To(MatchError(tt.expectedErr))
127+
gt.Expect(err.Error()).To(ContainSubstring(tt.expectedErr))
128128
})
129129
}
130130
}
@@ -211,7 +211,7 @@ func TestRemoveChannelCapabilityFailures(t *testing.T) {
211211
},
212212
},
213213
},
214-
expectedErr: "retrieving channel capabilities: unmarshaling capabilities: proto: can't skip unknown wire type 6",
214+
expectedErr: "retrieving channel capabilities: unmarshaling capabilities: proto",
215215
},
216216
}
217217

@@ -225,7 +225,7 @@ func TestRemoveChannelCapabilityFailures(t *testing.T) {
225225
c := New(tt.config)
226226

227227
err := c.Channel().RemoveCapability(tt.capability)
228-
gt.Expect(err).To(MatchError(tt.expectedErr))
228+
gt.Expect(err.Error()).To(ContainSubstring(tt.expectedErr))
229229
})
230230
}
231231
}
@@ -490,7 +490,7 @@ func TestConfigurationFailures(t *testing.T) {
490490
},
491491
},
492492
},
493-
expectedErr: "unmarshaling Consortium: proto: can't skip unknown wire type 6",
493+
expectedErr: "unmarshaling Consortium: proto:",
494494
},
495495
{
496496
testName: "when retrieving existing orderer group",
@@ -575,7 +575,7 @@ func TestConfigurationFailures(t *testing.T) {
575575
},
576576
},
577577
},
578-
expectedErr: "retrieving channel capabilities: unmarshaling capabilities: proto: can't skip unknown wire type 6",
578+
expectedErr: "retrieving channel capabilities: unmarshaling capabilities: proto",
579579
},
580580
}
581581

@@ -589,7 +589,7 @@ func TestConfigurationFailures(t *testing.T) {
589589
c := New(tt.config)
590590

591591
_, err := c.Channel().Configuration()
592-
gt.Expect(err).To(MatchError(tt.expectedErr))
592+
gt.Expect(err.Error()).To(ContainSubstring(tt.expectedErr))
593593
})
594594
}
595595
}

configtx/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,7 +1914,7 @@ func TestNewEnvelopeFailures(t *testing.T) {
19141914
{
19151915
spec: "when the marshaled config update isn't a config update",
19161916
marshaledUpdate: []byte("not-a-config-update"),
1917-
expectedErr: "unmarshaling config update: proto: can't skip unknown wire type 6",
1917+
expectedErr: "unmarshaling config update: proto",
19181918
},
19191919
}
19201920

@@ -1925,7 +1925,7 @@ func TestNewEnvelopeFailures(t *testing.T) {
19251925
gt := NewGomegaWithT(t)
19261926

19271927
env, err := NewEnvelope(tc.marshaledUpdate)
1928-
gt.Expect(err).To(MatchError(tc.expectedErr))
1928+
gt.Expect(err.Error()).To(ContainSubstring(tc.expectedErr))
19291929
gt.Expect(env).To(BeNil())
19301930
})
19311931
}

configtx/internal/policydsl/policyparser.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,17 +264,17 @@ func newContext() *context {
264264
// GATE(P[, P])
265265
//
266266
// where:
267-
// - GATE is either "and" or "or"
268-
// - P is either a principal or another nested call to GATE
267+
// - GATE is either "and" or "or"
268+
// - P is either a principal or another nested call to GATE
269269
//
270270
// A principal is defined as:
271271
//
272-
// ORG.ROLE
272+
// # ORG.ROLE
273273
//
274274
// where:
275-
// - ORG is a string (representing the MSP identifier)
276-
// - ROLE takes the value of any of the RoleXXX constants representing
277-
// the required role
275+
// - ORG is a string (representing the MSP identifier)
276+
// - ROLE takes the value of any of the RoleXXX constants representing
277+
// the required role
278278
func FromString(policy string) (*cb.SignaturePolicyEnvelope, error) {
279279
// first we translate the and/or business into outof gates
280280
intermediate, err := govaluate.NewEvaluableExpressionWithFunctions(

configtx/msp_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func TestMSPConfigurationFailures(t *testing.T) {
4848
badCert := &x509.Certificate{}
4949
msp.RootCerts = append(msp.RootCerts, badCert)
5050
},
51-
expectedErr: "parsing root certs: asn1: syntax error: sequence truncated",
51+
expectedErr: "parsing root certs: x509: malformed certificate",
5252
},
5353
{
5454
name: "Bad intermediate cert",
@@ -57,7 +57,7 @@ func TestMSPConfigurationFailures(t *testing.T) {
5757
mspMod: func(msp *MSP) {
5858
msp.IntermediateCerts = append(msp.IntermediateCerts, badCert)
5959
},
60-
expectedErr: "parsing intermediate certs: asn1: syntax error: sequence truncated",
60+
expectedErr: "parsing intermediate certs: x509: malformed certificate",
6161
},
6262
{
6363
name: "Bad admin cert",
@@ -66,7 +66,7 @@ func TestMSPConfigurationFailures(t *testing.T) {
6666
mspMod: func(msp *MSP) {
6767
msp.Admins = append(msp.Admins, badCert)
6868
},
69-
expectedErr: "parsing admin certs: asn1: syntax error: sequence truncated",
69+
expectedErr: "parsing admin certs: x509: malformed certificate",
7070
},
7171
{
7272
name: "Bad OU Identifier cert",
@@ -75,7 +75,7 @@ func TestMSPConfigurationFailures(t *testing.T) {
7575
mspMod: func(msp *MSP) {
7676
msp.OrganizationalUnitIdentifiers[0].Certificate = badCert
7777
},
78-
expectedErr: "parsing ou identifiers: asn1: syntax error: sequence truncated",
78+
expectedErr: "parsing ou identifiers: x509: malformed certificate",
7979
},
8080
{
8181
name: "Bad tls root cert",
@@ -84,7 +84,7 @@ func TestMSPConfigurationFailures(t *testing.T) {
8484
mspMod: func(msp *MSP) {
8585
msp.TLSRootCerts = append(msp.TLSRootCerts, badCert)
8686
},
87-
expectedErr: "parsing tls root certs: asn1: syntax error: sequence truncated",
87+
expectedErr: "parsing tls root certs: x509: malformed certificate",
8888
},
8989
{
9090
name: "Bad tls intermediate cert",
@@ -93,7 +93,7 @@ func TestMSPConfigurationFailures(t *testing.T) {
9393
mspMod: func(msp *MSP) {
9494
msp.TLSIntermediateCerts = append(msp.TLSIntermediateCerts, badCert)
9595
},
96-
expectedErr: "parsing tls intermediate certs: asn1: syntax error: sequence truncated",
96+
expectedErr: "parsing tls intermediate certs: x509: malformed certificate",
9797
},
9898
{
9999
name: "Bad Client OU Identifier cert",
@@ -102,7 +102,7 @@ func TestMSPConfigurationFailures(t *testing.T) {
102102
mspMod: func(msp *MSP) {
103103
msp.NodeOUs.ClientOUIdentifier.Certificate = badCert
104104
},
105-
expectedErr: "parsing client ou identifier cert: asn1: syntax error: sequence truncated",
105+
expectedErr: "parsing client ou identifier cert: x509: malformed certificate",
106106
},
107107
{
108108
name: "Bad Peer OU Identifier cert",
@@ -111,7 +111,7 @@ func TestMSPConfigurationFailures(t *testing.T) {
111111
mspMod: func(msp *MSP) {
112112
msp.NodeOUs.PeerOUIdentifier.Certificate = badCert
113113
},
114-
expectedErr: "parsing peer ou identifier cert: asn1: syntax error: sequence truncated",
114+
expectedErr: "parsing peer ou identifier cert: x509: malformed certificate",
115115
},
116116
{
117117
name: "Bad Admin OU Identifier cert",
@@ -120,7 +120,7 @@ func TestMSPConfigurationFailures(t *testing.T) {
120120
mspMod: func(msp *MSP) {
121121
msp.NodeOUs.AdminOUIdentifier.Certificate = badCert
122122
},
123-
expectedErr: "parsing admin ou identifier cert: asn1: syntax error: sequence truncated",
123+
expectedErr: "parsing admin ou identifier cert: x509: malformed certificate",
124124
},
125125
{
126126
name: "Bad Orderer OU Identifier cert",
@@ -129,7 +129,7 @@ func TestMSPConfigurationFailures(t *testing.T) {
129129
mspMod: func(msp *MSP) {
130130
msp.NodeOUs.OrdererOUIdentifier.Certificate = badCert
131131
},
132-
expectedErr: "parsing orderer ou identifier cert: asn1: syntax error: sequence truncated",
132+
expectedErr: "parsing orderer ou identifier cert: x509: malformed certificate",
133133
},
134134
}
135135

configtx/orderer_test.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,7 +1751,8 @@ func TestRemoveOrdererEndpointFailure(t *testing.T) {
17511751
c := New(config)
17521752

17531753
err := c.Orderer().Organization("OrdererOrg").RemoveEndpoint(Address{Host: "127.0.0.1", Port: 8050})
1754-
gt.Expect(err).To(MatchError("failed unmarshaling endpoints for orderer org OrdererOrg: proto: can't skip unknown wire type 6"))
1754+
gt.Expect(err.Error()).To(ContainSubstring("failed unmarshaling endpoints for orderer org OrdererOrg: proto:"))
1755+
gt.Expect(err.Error()).To(ContainSubstring("cannot parse invalid wire-format data"))
17551756
}
17561757

17571758
func TestGetOrdererOrg(t *testing.T) {
@@ -2868,7 +2869,7 @@ func TestAddOrdererCapabilityFailures(t *testing.T) {
28682869
},
28692870
}
28702871
},
2871-
expectedErr: "retrieving orderer capabilities: unmarshaling capabilities: proto: can't skip unknown wire type 6",
2872+
expectedErr: "retrieving orderer capabilities: unmarshaling capabilities: proto",
28722873
},
28732874
}
28742875

@@ -2895,7 +2896,7 @@ func TestAddOrdererCapabilityFailures(t *testing.T) {
28952896
c := New(config)
28962897

28972898
err = c.Orderer().AddCapability(tt.capability)
2898-
gt.Expect(err).To(MatchError(tt.expectedErr))
2899+
gt.Expect(err.Error()).To(ContainSubstring(tt.expectedErr))
28992900
})
29002901
}
29012902
}
@@ -3172,7 +3173,7 @@ func TestRemoveOrdererCapabilityFailures(t *testing.T) {
31723173
},
31733174
}
31743175
},
3175-
expectedErr: "retrieving orderer capabilities: unmarshaling capabilities: proto: can't skip unknown wire type 6",
3176+
expectedErr: "retrieving orderer capabilities: unmarshaling capabilities: proto",
31763177
},
31773178
}
31783179

@@ -3199,7 +3200,7 @@ func TestRemoveOrdererCapabilityFailures(t *testing.T) {
31993200
c := New(config)
32003201

32013202
err = c.Orderer().RemoveCapability(tt.capability)
3202-
gt.Expect(err).To(MatchError(tt.expectedErr))
3203+
gt.Expect(err.Error()).To(ContainSubstring(tt.expectedErr))
32033204
})
32043205
}
32053206
}
@@ -4661,8 +4662,9 @@ func TestSetMaxMessageCountFailures(t *testing.T) {
46614662
}
46624663

46634664
c := New(config)
4665+
46644666
err = c.Orderer().BatchSize().SetMaxMessageCount(5)
4665-
gt.Expect(err).To(MatchError("unexpected EOF"))
4667+
gt.Expect(err.Error()).To(ContainSubstring("cannot parse invalid wire-format data"))
46664668
}
46674669

46684670
func TestSetAbsoluteMaxBytesFailures(t *testing.T) {
@@ -4685,7 +4687,7 @@ func TestSetAbsoluteMaxBytesFailures(t *testing.T) {
46854687

46864688
c := New(config)
46874689
err = c.Orderer().BatchSize().SetAbsoluteMaxBytes(5)
4688-
gt.Expect(err).To(MatchError("unexpected EOF"))
4690+
gt.Expect(err.Error()).To(ContainSubstring("cannot parse invalid wire-format data"))
46894691
}
46904692

46914693
func TestSetPreferredMaxBytesFailures(t *testing.T) {
@@ -4708,7 +4710,7 @@ func TestSetPreferredMaxBytesFailures(t *testing.T) {
47084710

47094711
c := New(config)
47104712
err = c.Orderer().BatchSize().SetPreferredMaxBytes(5)
4711-
gt.Expect(err).To(MatchError("unexpected EOF"))
4713+
gt.Expect(err.Error()).To(ContainSubstring("cannot parse invalid wire-format data"))
47124714
}
47134715

47144716
func TestSetBatchTimeout(t *testing.T) {

configtx/signer_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ func TestToLowS(t *testing.T) {
305305
},
306306
},
307307
} {
308+
test := test
308309
t.Run(test.name, func(t *testing.T) {
309310
t.Parallel()
310311

go.mod

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
module github.com/hyperledger/fabric-config
22

3-
go 1.14
3+
go 1.20
44

55
require (
66
github.com/Knetic/govaluate v3.0.0+incompatible
7-
github.com/golang/protobuf v1.3.3
8-
github.com/hyperledger/fabric-protos-go v0.0.0-20200424173316-dd554ba3746e
7+
github.com/golang/protobuf v1.5.2
8+
github.com/hyperledger/fabric-protos-go v0.3.0
99
github.com/onsi/gomega v1.9.0
1010
)
11+
12+
require (
13+
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect
14+
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 // indirect
15+
golang.org/x/text v0.3.3 // indirect
16+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
17+
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
18+
google.golang.org/grpc v1.46.2 // indirect
19+
google.golang.org/protobuf v1.28.1 // indirect
20+
gopkg.in/yaml.v2 v2.2.4 // indirect
21+
)

0 commit comments

Comments
 (0)