mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-03 18:42:14 +00:00
* ci: Fix linter complaint (#9645)
Fixes a very silly linter complaint that makes absolutely no sense and is blocking the merging of several PRs.
---
#### PR checklist
- [x] Tests written/updated, or no tests needed
- [x] `CHANGELOG_PENDING.md` updated, or no changelog entry needed
- [x] Updated relevant documentation (`docs/`) and code comments, or no
documentation updates needed
(cherry picked from commit 83b7f4ad5b)
# Conflicts:
# .github/workflows/lint.yml
# .golangci.yml
# cmd/tendermint/commands/debug/util.go
* Resolve conflicts
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* ci: Sync golangci-lint config with main
Minus the spelling configuration that restricts spelling to US English
only.
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* make format
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* Remove usage of deprecated io/ioutil package
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* Remove unused mockBlockStore
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* blockchain/v2: Remove unused method
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* Bulk fix lints
Signed-off-by: Thane Thomson <connect@thanethomson.com>
* lint: Ignore auto-generated query PEG
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Co-authored-by: Thane Thomson <connect@thanethomson.com>
59 lines
1.4 KiB
Go
59 lines
1.4 KiB
Go
package payload_test
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
|
|
"github.com/google/uuid"
|
|
|
|
"github.com/tendermint/tendermint/test/loadtime/payload"
|
|
)
|
|
|
|
const payloadSizeTarget = 1024 // 1kb
|
|
|
|
func TestSize(t *testing.T) {
|
|
s, err := payload.MaxUnpaddedSize()
|
|
if err != nil {
|
|
t.Fatalf("calculating max unpadded size %s", err)
|
|
}
|
|
if s > payloadSizeTarget {
|
|
t.Fatalf("unpadded payload size %d exceeds target %d", s, payloadSizeTarget)
|
|
}
|
|
}
|
|
|
|
func TestRoundTrip(t *testing.T) {
|
|
const (
|
|
testConns = 512
|
|
testRate = 4
|
|
)
|
|
testID := [16]byte(uuid.New())
|
|
b, err := payload.NewBytes(&payload.Payload{
|
|
Size: payloadSizeTarget,
|
|
Connections: testConns,
|
|
Rate: testRate,
|
|
Id: testID[:],
|
|
})
|
|
if err != nil {
|
|
t.Fatalf("generating payload %s", err)
|
|
}
|
|
if len(b) < payloadSizeTarget {
|
|
t.Fatalf("payload size in bytes %d less than expected %d", len(b), payloadSizeTarget)
|
|
}
|
|
p, err := payload.FromBytes(b)
|
|
if err != nil {
|
|
t.Fatalf("reading payload %s", err)
|
|
}
|
|
if p.Size != payloadSizeTarget {
|
|
t.Fatalf("payload size value %d does not match expected %d", p.Size, payloadSizeTarget)
|
|
}
|
|
if p.Connections != testConns {
|
|
t.Fatalf("payload connections value %d does not match expected %d", p.Connections, testConns)
|
|
}
|
|
if p.Rate != testRate {
|
|
t.Fatalf("payload rate value %d does not match expected %d", p.Rate, testRate)
|
|
}
|
|
if !bytes.Equal(p.Id, testID[:]) {
|
|
t.Fatalf("payload ID value %d does not match expected %d", p.Id, testID)
|
|
}
|
|
}
|