Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Unified expandable panels with mermaid flows, ZIP export, connection tests, and Playwright smoke coverage.
34 lines
769 B
Go
34 lines
769 B
Go
package erasure
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestS3ShardKeyRegional(t *testing.T) {
|
|
if got := S3ShardKey("tok", "eu-west-1", 2, "abc"); got != "shards/tok/eu-west-1/2-abc.bin" {
|
|
t.Fatalf("key=%q", got)
|
|
}
|
|
}
|
|
|
|
func TestFormatParseShardAdvert(t *testing.T) {
|
|
a := FormatShardAdvert("us-east-1", 3)
|
|
r, i, ok := ParseShardAdvert(a)
|
|
if !ok || r != "us-east-1" || i != 3 {
|
|
t.Fatalf("r=%q i=%d", r, i)
|
|
}
|
|
}
|
|
|
|
func TestBuildS3CRRRule(t *testing.T) {
|
|
doc, err := BuildS3CRRRule(S3ShardConfig{
|
|
ShardBucket: "p", ShardRegion: "us-east-1", CRRDestBucket: "r", CRRDestRegion: "eu-west-1",
|
|
ReplicationAccountID: "111",
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if role, _ := doc["Role"].(string); !strings.Contains(role, "111") {
|
|
t.Fatalf("role=%q", role)
|
|
}
|
|
}
|