Skip to content

Commit 973e5c4

Browse files
honourfishjgough
andauthored
Update log verification to support assetsv2 and eventsv1 event verification (#15)
* Update log verification to support assetsv2 and eventsv1 event verification re: AB#10260 --------- Co-authored-by: jgough <[email protected]>
1 parent 2583670 commit 973e5c4

22 files changed

+882
-216
lines changed

.github/workflows/push.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ jobs:
1313
- uses: actions/checkout@v3
1414
- uses: actions/setup-go@v5
1515
with:
16-
go-version: '1.22'
16+
go-version: '1.23'
1717
cache: false
1818

1919
- name: Install Go quality tools
2020
run: |
2121
go install golang.org/x/tools/cmd/[email protected]
2222
go install github.com/axw/gocov/[email protected]
2323
go install github.com/jstemmer/go-junit-report/[email protected]
24-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.2
24+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.3
2525
2626
- name: Install Task
2727
uses: arduino/setup-task@v1

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ linters-settings:
108108
# paths anyway (we have no control over there layout). Until we get
109109
# direct evidence this is hurting us, we prefer our stucts layed out
110110
# logically and don't want to have to nolint tag everything.
111-
#
111+
#
112112
# misspell - expected UK spelling with misspell, but customer facing text needs to be US.
113113
# tagalign - suppress until we can get a golang code formatter that will fix this (cosmetic)
114114
#

go.mod

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
module github.com/datatrails/go-datatrails-logverification
22

3-
go 1.22
3+
go 1.23.0
44

55
require (
6-
github.com/datatrails/go-datatrails-common v0.18.0
7-
github.com/datatrails/go-datatrails-common-api-gen v0.4.5
6+
github.com/datatrails/go-datatrails-common v0.18.1
7+
github.com/datatrails/go-datatrails-common-api-gen v0.6.1
88
github.com/datatrails/go-datatrails-merklelog/massifs v0.3.1
99
github.com/datatrails/go-datatrails-merklelog/mmr v0.1.1
1010
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.1.0
11+
github.com/datatrails/go-datatrails-serialization/eventsv1 v0.0.2
1112
github.com/datatrails/go-datatrails-simplehash v0.0.5
12-
github.com/stretchr/testify v1.9.0
13+
github.com/google/uuid v1.6.0
14+
github.com/stretchr/testify v1.10.0
1315
github.com/veraison/go-cose v1.1.0
14-
google.golang.org/protobuf v1.34.2
16+
google.golang.org/protobuf v1.35.2
1517
)
1618

1719
require (
1820
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
19-
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 // indirect
20-
github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0 // indirect
21+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.12.0 // indirect
22+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.9.1 // indirect
2123
github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus v1.7.1 // indirect
2224
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.4.1 // indirect
2325
github.com/Azure/go-amqp v1.0.5 // indirect
@@ -31,13 +33,12 @@ require (
3133
github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect
3234
github.com/Azure/go-autorest/logger v0.2.1 // indirect
3335
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
34-
github.com/davecgh/go-spew v1.1.1 // indirect
36+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
3537
github.com/dimchansky/utfbom v1.1.1 // indirect
36-
github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect
37-
github.com/fxamacker/cbor/v2 v2.6.0 // indirect
38+
github.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect
39+
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
3840
github.com/gabriel-vasile/mimetype v1.4.4 // indirect
3941
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
40-
github.com/google/uuid v1.6.0 // indirect
4142
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
4243
github.com/ldclabs/cose/go v0.0.0-20221214142927-d22c1cfc2154 // indirect
4344
github.com/mitchellh/go-homedir v1.1.0 // indirect
@@ -46,7 +47,7 @@ require (
4647
github.com/opentracing/opentracing-go v1.2.0 // indirect
4748
github.com/openzipkin-contrib/zipkin-go-opentracing v0.5.0 // indirect
4849
github.com/openzipkin/zipkin-go v0.4.3 // indirect
49-
github.com/pmezard/go-difflib v1.0.0 // indirect
50+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
5051
github.com/x448/float16 v0.8.4 // indirect
5152
github.com/zeebo/bencode v1.0.0 // indirect
5253
go.uber.org/multierr v1.11.0 // indirect
@@ -56,7 +57,7 @@ require (
5657
golang.org/x/sys v0.22.0 // indirect
5758
golang.org/x/text v0.16.0 // indirect
5859
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect
59-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d // indirect
60+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
6061
google.golang.org/grpc v1.65.0 // indirect
6162
gopkg.in/yaml.v3 v3.0.1 // indirect
6263
)

go.sum

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU=
22
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
3-
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 h1:E+OJmp2tPvt1W+amx48v1eqbjDYsgN+RzP4q16yV5eM=
4-
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1/go.mod h1:a6xsAQUZg+VsS3TJ05SRp524Hs4pZ/AeFSr5ENf0Yjo=
5-
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.2 h1:FDif4R1+UUR+00q6wquyX90K7A8dN+R5E8GEadoP7sU=
6-
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.2/go.mod h1:aiYBYui4BJ/BJCAIKs92XiPyQfTaBWqvHujDwKb6CBU=
7-
github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0 h1:jBQA3cKT4L2rWMpgE7Yt3Hwh2aUj8KXjIGLxjHeYNNo=
8-
github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0/go.mod h1:4OG6tQ9EOP/MT0NMjDlRzWoVFxfu9rN9B2X+tlSVktg=
3+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.12.0 h1:1nGuui+4POelzDwI7RG56yfQJHCnKvwfMoU7VsEp+Zg=
4+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.12.0/go.mod h1:99EvauvlcJ1U06amZiksfYz/3aFGyIhWGHVyiZXtBAI=
5+
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc=
6+
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg=
7+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.9.1 h1:Xy/qV1DyOhhqsU/z0PyFMJfYCxnzna+vBEUtFW0ksQo=
8+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.9.1/go.mod h1:oib6iWdC+sILvNUoJbbBn3xv7TXow7mEp/WRcsYvmow=
99
github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus v1.7.1 h1:o/Ws6bEqMeKZUfj1RRm3mQ51O8JGU5w+Qdg2AhHib6A=
1010
github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus v1.7.1/go.mod h1:6QAMYBAbQeeKX+REFJMZ1nFWu9XLw/PPcjYpuc9RDFs=
1111
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.4.1 h1:QSdcrd/UFJv6Bp/CfoVf2SrENpFn9P6Yh8yb+xNhYMM=
@@ -40,29 +40,32 @@ github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUM
4040
github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
4141
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
4242
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
43-
github.com/datatrails/go-datatrails-common v0.18.0 h1:OeNP4EdIjhLHnE/mdN2/kp6Fq+xOnE6Y2p3DKg4xXHw=
44-
github.com/datatrails/go-datatrails-common v0.18.0/go.mod h1:fBDqKHRLUYcictdWdLrIhKNhieKVE2r0II8vyETCuhM=
45-
github.com/datatrails/go-datatrails-common-api-gen v0.4.5 h1:QtxIFSdOEf6bhHZd7g/MfWdCWfPEtwTQNDz3K9u33+c=
46-
github.com/datatrails/go-datatrails-common-api-gen v0.4.5/go.mod h1:OQN91xvlW6xcWTFvwsM2Nn4PZwFAIOE52FG7yRl4QPQ=
43+
github.com/datatrails/go-datatrails-common v0.18.1 h1:WYRQPFT0w+9o/WFrEQfjUnBY9UbBijoWmcmJEHGEXTY=
44+
github.com/datatrails/go-datatrails-common v0.18.1/go.mod h1:YUUAwrD7SQFXverHUxt2subZxTfSp76zUHxtmijNlvM=
45+
github.com/datatrails/go-datatrails-common-api-gen v0.6.1 h1:rkzx2FBdTTNirLNLWHpXRme3GrOssPP27reQUwdFAJc=
46+
github.com/datatrails/go-datatrails-common-api-gen v0.6.1/go.mod h1:rTMGdMdu5M6mGpbXZy1D84cBTGE8JwsDH6BYh9LJlmA=
4747
github.com/datatrails/go-datatrails-merklelog/massifs v0.3.1 h1:RR1FVJ85iCrZIoMzcfxPLZsPCYl7XvlZ4S8sm2TxFi8=
4848
github.com/datatrails/go-datatrails-merklelog/massifs v0.3.1/go.mod h1:3V08x15NPbzBTSrvjvgzUA0ADkxBRV7m3p5ODElmB2A=
4949
github.com/datatrails/go-datatrails-merklelog/mmr v0.1.1 h1:Ro2fYdDYxGGcPmudYuvPonx78GkdQuKwzrdknLR55cE=
5050
github.com/datatrails/go-datatrails-merklelog/mmr v0.1.1/go.mod h1:B/Kkz4joZTiTz0q/9FFAgHR+Tcn6UxtphMuCzamAc9Q=
5151
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.1.0 h1:q9RXtAGydXKSJjARnFObNu743cbfIOfERTXiiVa2tF4=
5252
github.com/datatrails/go-datatrails-merklelog/mmrtesting v0.1.0/go.mod h1:rWFjeK1NU7qnhl9+iKdjASpw/CkPwDAOPHsERYR7uEQ=
53+
github.com/datatrails/go-datatrails-serialization/eventsv1 v0.0.2 h1:yEk+0KvWkn/xYbf3WgdFCAZNkLE4pze9ySqeCr6Pnos=
54+
github.com/datatrails/go-datatrails-serialization/eventsv1 v0.0.2/go.mod h1:9i6Tip2lIXwSZ3SxP7XEhU2eQ9zkpxhEBmPmlOGqv/8=
5355
github.com/datatrails/go-datatrails-simplehash v0.0.5 h1:igu4QRYO87RQXrJlqSm3fgMA2Q0F4jglWqBlfvKrXKQ=
5456
github.com/datatrails/go-datatrails-simplehash v0.0.5/go.mod h1:XuOwViwdL+dyz7fGYIjaByS1ElMFsrVI0goKX0bNimA=
5557
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
56-
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
5758
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
59+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
60+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5861
github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U=
5962
github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=
60-
github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A=
61-
github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew=
63+
github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM=
64+
github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4=
6265
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
6366
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
64-
github.com/fxamacker/cbor/v2 v2.6.0 h1:sU6J2usfADwWlYDAFhZBQ6TnLFBHxgesMrQfQgk1tWA=
65-
github.com/fxamacker/cbor/v2 v2.6.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
67+
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
68+
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
6669
github.com/gabriel-vasile/mimetype v1.4.4 h1:QjV6pZ7/XZ7ryI2KuyeEDE8wnh7fHP9YnQy+R0LnH8I=
6770
github.com/gabriel-vasile/mimetype v1.4.4/go.mod h1:JwLei5XPtWdGiMFB5Pjle1oEeoSeEuJfJE+TtfvdB/s=
6871
github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c=
@@ -107,8 +110,9 @@ github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7s
107110
github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c=
108111
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
109112
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
110-
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
111113
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
114+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
115+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
112116
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
113117
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
114118
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -118,8 +122,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
118122
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
119123
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
120124
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
121-
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
122-
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
125+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
126+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
123127
github.com/veraison/go-cose v1.1.0 h1:AalPS4VGiKavpAzIlBjrn7bhqXiXi4jbMYY/2+UC+4o=
124128
github.com/veraison/go-cose v1.1.0/go.mod h1:7ziE85vSq4ScFTg6wyoMXjucIGOf4JkFEZi/an96Ct4=
125129
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
@@ -185,12 +189,12 @@ golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
185189
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
186190
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0=
187191
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw=
188-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d h1:k3zyW3BYYR30e8v3x0bTDdE9vpYFjZHK+HcyqkrppWk=
189-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY=
192+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA=
193+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY=
190194
google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
191195
google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=
192-
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
193-
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
196+
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
197+
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
194198
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
195199
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
196200
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=

integrationsupport/setup.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,27 @@ func SetupTest(t *testing.T, testContext mmrtesting.TestContext, testGenerator T
2525
tenantID := mmrtesting.DefaultGeneratorTenantIdentity
2626

2727
// Generate an initial batch of events. These are the last known backed-up events by the user.
28-
GenerateTenantLog(&testContext, testGenerator, 7, tenantID, true, TestMassifHeight)
28+
eventsToAppend := 7
29+
GenerateTenantLog(&testContext, testGenerator, eventsToAppend, tenantID, true, TestMassifHeight)
2930
oldMassifContext, err := massifReader.GetMassif(context.TODO(), tenantID, 0)
31+
32+
expectedRangeCount := 11
3033
require.Nil(t, err)
31-
require.Equal(t, uint64(11), oldMassifContext.RangeCount())
34+
require.Equal(t, uint64(expectedRangeCount), oldMassifContext.RangeCount())
3235

3336
// Append 4 leaves to the existing Merkle log.
34-
appendedEvents := GenerateTenantLog(&testContext, testGenerator, 4, tenantID, false, TestMassifHeight)
37+
eventsToAppend = 4
38+
appendedEvents := GenerateTenantLog(&testContext, testGenerator, eventsToAppend, tenantID, false, TestMassifHeight)
3539
massifContext, err := massifReader.GetMassif(context.TODO(), tenantID, 0)
3640
require.Nil(t, err)
3741

3842
// Check that our test generation code actually appended it. Confirm that the old massif context
3943
// hasn't been updated, as it represents the customer's cache of the data.
40-
require.Equal(t, uint64(19), massifContext.RangeCount())
41-
require.Equal(t, uint64(11), oldMassifContext.RangeCount())
44+
expectedRangeCount = 19
45+
require.Equal(t, uint64(expectedRangeCount), massifContext.RangeCount())
46+
47+
expectedRangeCount = 11
48+
require.Equal(t, uint64(expectedRangeCount), oldMassifContext.RangeCount())
4249

4350
// New log is old log plus these appended events
4451
lastLogBEvent := appendedEvents[len(appendedEvents)-1]

integrationsupport/testcontext.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,24 @@ import (
1919
"github.com/veraison/go-cose"
2020
)
2121

22+
const (
23+
millisecondMultiplier = 1000
24+
eventRate = 500
25+
)
26+
2227
func NewAzuriteTestContext(
2328
t *testing.T,
2429
testLabelPrefix string,
2530
) (mmrtesting.TestContext, TestGenerator, mmrtesting.TestConfig) {
2631
cfg := mmrtesting.TestConfig{
27-
StartTimeMS: (1698342521) * 1000, EventRate: 500,
32+
StartTimeMS: (1698342521) * millisecondMultiplier, EventRate: eventRate,
2833
TestLabelPrefix: testLabelPrefix,
2934
TenantIdentity: "",
3035
Container: strings.ReplaceAll(strings.ToLower(testLabelPrefix), "_", "")}
3136
leafHasher := NewLeafHasher()
3237
tc := mmrtesting.NewTestContext(t, cfg)
3338
g := NewTestGenerator(
34-
t, cfg.StartTimeMS/1000,
39+
t, cfg.StartTimeMS/millisecondMultiplier,
3540
&leafHasher,
3641
mmrtesting.TestGeneratorConfig{
3742
StartTimeMS: cfg.StartTimeMS,

integrationsupport/testeventgenerator.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,15 @@ func (g *TestGenerator) NextId() (uint64, error) {
7676
var err error
7777
var id uint64
7878

79-
for i := 0; i < 2; i++ {
79+
var msSleepDuration = 2
80+
81+
for range 2 {
8082
id, err = g.IdState.NextID()
8183
if err != nil {
8284
if !errors.Is(err, snowflakeid.ErrOverloaded) {
8385
return 0, err
8486
}
85-
time.Sleep(time.Millisecond * 2)
87+
time.Sleep(time.Millisecond * time.Duration(msSleepDuration))
8688
}
8789
}
8890
return id, nil
@@ -106,15 +108,15 @@ func (g *TestGenerator) GenerateLeaf(tenantIdentity string, base, i uint64) mmrt
106108

107109
func (g *TestGenerator) GenerateEventBatch(count int) []*v2assets.EventResponse {
108110
events := make([]*v2assets.EventResponse, 0, count)
109-
for i := 0; i < count; i++ {
111+
for range count {
110112
events = append(events, g.GenerateNextEvent(mmrtesting.DefaultGeneratorTenantIdentity))
111113
}
112114
return events
113115
}
114116

115117
func (g *TestGenerator) GenerateTenantEventMessageBatch(tenantIdentity string, count int) []*azbus.ReceivedMessage {
116118
msgs := make([]*azbus.ReceivedMessage, 0, count)
117-
for i := 0; i < count; i++ {
119+
for range count {
118120
event := v2assets.EventMessage{
119121
TenantId: tenantIdentity,
120122
Event: g.GenerateNextEvent(tenantIdentity),
@@ -138,14 +140,18 @@ func (g *TestGenerator) GenerateNextEvent(tenantIdentity string) *v2assets.Event
138140
assetIdentity := g.NewAssetIdentity()
139141
assetUUID := strings.Split(assetIdentity, "/")[1]
140142

141-
name := strings.Join(g.WordList(2), "")
143+
wordCount := 2
144+
name := strings.Join(g.WordList(wordCount), "")
142145
email := fmt.Sprintf("%[email protected]", name)
143146
subject := strconv.Itoa(g.Intn(math.MaxInt))
144147

145148
// Use the desired event rate as the upper bound, and generate a time stamp at lastTime + rand(0, upper-bound * 2)
146149
// So the generated event stream will be around the target rate.
147150
ts := g.SinceLastJitter()
148151

152+
firstAttributeWordString := 6
153+
secondAttributeWordString := 4
154+
149155
event := &v2assets.EventResponse{
150156
Identity: g.NewEventIdentity(assetUUID),
151157
AssetIdentity: assetIdentity,
@@ -163,14 +169,14 @@ func (g *TestGenerator) GenerateNextEvent(tenantIdentity string) *v2assets.Event
163169

164170
"event-attribute-0": {
165171
Value: &attribute.Attribute_StrVal{
166-
StrVal: g.MultiWordString(6),
172+
StrVal: g.MultiWordString(firstAttributeWordString),
167173
},
168174
},
169175
},
170176
AssetAttributes: map[string]*attribute.Attribute{
171177
"asset-attribute-0": {
172178
Value: &attribute.Attribute_StrVal{
173-
StrVal: g.MultiWordString(4),
179+
StrVal: g.MultiWordString(secondAttributeWordString),
174180
},
175181
},
176182
},

0 commit comments

Comments
 (0)