-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update log verification to support assetsv2 and eventsv1 event verifi…
…cation (#15) * Update log verification to support assetsv2 and eventsv1 event verification re: AB#10260 --------- Co-authored-by: jgough <[email protected]>
- Loading branch information
1 parent
2583670
commit 973e5c4
Showing
22 changed files
with
882 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,15 +13,15 @@ jobs: | |
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22' | ||
go-version: '1.23' | ||
cache: false | ||
|
||
- name: Install Go quality tools | ||
run: | | ||
go install golang.org/x/tools/cmd/[email protected] | ||
go install github.com/axw/gocov/[email protected] | ||
go install github.com/jstemmer/go-junit-report/[email protected] | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.2 | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.3 | ||
- name: Install Task | ||
uses: arduino/setup-task@v1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,13 +76,15 @@ func (g *TestGenerator) NextId() (uint64, error) { | |
var err error | ||
var id uint64 | ||
|
||
for i := 0; i < 2; i++ { | ||
var msSleepDuration = 2 | ||
|
||
for range 2 { | ||
id, err = g.IdState.NextID() | ||
if err != nil { | ||
if !errors.Is(err, snowflakeid.ErrOverloaded) { | ||
return 0, err | ||
} | ||
time.Sleep(time.Millisecond * 2) | ||
time.Sleep(time.Millisecond * time.Duration(msSleepDuration)) | ||
} | ||
} | ||
return id, nil | ||
|
@@ -106,15 +108,15 @@ func (g *TestGenerator) GenerateLeaf(tenantIdentity string, base, i uint64) mmrt | |
|
||
func (g *TestGenerator) GenerateEventBatch(count int) []*v2assets.EventResponse { | ||
events := make([]*v2assets.EventResponse, 0, count) | ||
for i := 0; i < count; i++ { | ||
for range count { | ||
events = append(events, g.GenerateNextEvent(mmrtesting.DefaultGeneratorTenantIdentity)) | ||
} | ||
return events | ||
} | ||
|
||
func (g *TestGenerator) GenerateTenantEventMessageBatch(tenantIdentity string, count int) []*azbus.ReceivedMessage { | ||
msgs := make([]*azbus.ReceivedMessage, 0, count) | ||
for i := 0; i < count; i++ { | ||
for range count { | ||
event := v2assets.EventMessage{ | ||
TenantId: tenantIdentity, | ||
Event: g.GenerateNextEvent(tenantIdentity), | ||
|
@@ -138,14 +140,18 @@ func (g *TestGenerator) GenerateNextEvent(tenantIdentity string) *v2assets.Event | |
assetIdentity := g.NewAssetIdentity() | ||
assetUUID := strings.Split(assetIdentity, "/")[1] | ||
|
||
name := strings.Join(g.WordList(2), "") | ||
wordCount := 2 | ||
name := strings.Join(g.WordList(wordCount), "") | ||
email := fmt.Sprintf("%[email protected]", name) | ||
subject := strconv.Itoa(g.Intn(math.MaxInt)) | ||
|
||
// Use the desired event rate as the upper bound, and generate a time stamp at lastTime + rand(0, upper-bound * 2) | ||
// So the generated event stream will be around the target rate. | ||
ts := g.SinceLastJitter() | ||
|
||
firstAttributeWordString := 6 | ||
secondAttributeWordString := 4 | ||
|
||
event := &v2assets.EventResponse{ | ||
Identity: g.NewEventIdentity(assetUUID), | ||
AssetIdentity: assetIdentity, | ||
|
@@ -163,14 +169,14 @@ func (g *TestGenerator) GenerateNextEvent(tenantIdentity string) *v2assets.Event | |
|
||
"event-attribute-0": { | ||
Value: &attribute.Attribute_StrVal{ | ||
StrVal: g.MultiWordString(6), | ||
StrVal: g.MultiWordString(firstAttributeWordString), | ||
}, | ||
}, | ||
}, | ||
AssetAttributes: map[string]*attribute.Attribute{ | ||
"asset-attribute-0": { | ||
Value: &attribute.Attribute_StrVal{ | ||
StrVal: g.MultiWordString(4), | ||
StrVal: g.MultiWordString(secondAttributeWordString), | ||
}, | ||
}, | ||
}, | ||
|
Oops, something went wrong.