mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-06-13 23:36:45 +03:00
fix(tests): 32-bit build of EC e2e tests, type-check linux/386 in CI (#9922)
* fix(tests): keep EC e2e fid cookie arithmetic in uint32 The cookie constants 0x9490CA00 and 0x9500CA00 were added to the int loop variable before conversion, overflowing 32-bit int at compile time on linux/386 and linux/arm. Convert the loop variable instead so the addition stays in uint32. * fix(tests): pass s3client max backoff in milliseconds MaxBackoffDelay is documented as milliseconds and multiplied by 1e6 before use, but the example set it to 5s in nanoseconds, yielding an absurd backoff on 64-bit and a compile-time int overflow on 32-bit. * ci: type-check code and tests for linux/386 64-bit-only constant arithmetic keeps slipping into test files and breaking 32-bit downstream builds. Vet the whole root module under GOOS=linux GOARCH=386 so these fail in CI instead of after release. * fix(tests): convert s3client backoff to Duration before scaling The ms-to-ns multiplication ran in int, wrapping at runtime on 32-bit; scale by time.Millisecond after the Duration conversion instead.
This commit is contained in:
@@ -37,6 +37,21 @@ jobs:
|
||||
# Fail only if there are actual vet errors (not counting the filtered lock warnings)
|
||||
if grep -q "vet:" vet-output.txt; then exit 1; fi
|
||||
|
||||
vet-32bit:
|
||||
name: Go Vet 32-bit
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v6
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
- name: Go Vet linux/386 (type-checks code and tests for 32-bit int overflows)
|
||||
run: |
|
||||
GOOS=linux GOARCH=386 go vet ./... 2>&1 | grep -v "MessageState contains sync.Mutex" | grep -v "IdentityAccessManagement contains sync.RWMutex" | tee vet-32bit-output.txt
|
||||
if grep -q "vet:" vet-32bit-output.txt; then exit 1; fi
|
||||
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -23,7 +23,7 @@ func main() {
|
||||
Name: "newbucket",
|
||||
Versioning: false,
|
||||
},
|
||||
MaxBackoffDelay: aws.Int(int(time.Second * 5)),
|
||||
MaxBackoffDelay: aws.Int(int((5 * time.Second).Milliseconds())),
|
||||
MaxRetryAttempts: aws.Int(1),
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ func MyAwsConfig(cfg MyConfig) (*aws.Config, error) {
|
||||
config.WithEndpointResolverWithOptions(customResolver),
|
||||
config.WithRetryer(func() aws.Retryer {
|
||||
r := retry.AddWithMaxAttempts(retry.NewStandard(), *cfg.MaxRetryAttempts)
|
||||
return retry.AddWithMaxBackoffDelay(r, time.Duration(*cfg.MaxBackoffDelay*1000*1000))
|
||||
return retry.AddWithMaxBackoffDelay(r, time.Duration(*cfg.MaxBackoffDelay)*time.Millisecond)
|
||||
}))
|
||||
return &awsCfg, err
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ func TestEcEncodeLeavesRightFilesAndRemovesStubAndSource(t *testing.T) {
|
||||
framework.AllocateVolume(t, clientA, volumeID, collection)
|
||||
httpClient := framework.NewHTTPClient()
|
||||
for i := 0; i < 8; i++ {
|
||||
fid := framework.NewFileID(volumeID, uint64(948000+i), uint32(0x9490CA00+i))
|
||||
fid := framework.NewFileID(volumeID, uint64(948000+i), 0x9490CA00+uint32(i))
|
||||
payload := make([]byte, 4096)
|
||||
for j := range payload {
|
||||
payload[j] = byte(i + 1)
|
||||
|
||||
@@ -66,7 +66,7 @@ func TestEcEncodeJulorLayoutConverges(t *testing.T) {
|
||||
framework.AllocateVolume(t, clients[srcServer], volumeID, collection)
|
||||
httpClient := framework.NewHTTPClient()
|
||||
for i := 0; i < 8; i++ {
|
||||
fid := framework.NewFileID(volumeID, uint64(950000+i), uint32(0x9500CA00+i))
|
||||
fid := framework.NewFileID(volumeID, uint64(950000+i), 0x9500CA00+uint32(i))
|
||||
payload := make([]byte, 4096)
|
||||
for j := range payload {
|
||||
payload[j] = byte(i + 1)
|
||||
|
||||
Reference in New Issue
Block a user