fix(laya): extend shared CPU ranking timeout

This commit is contained in:
2026-11-23 20:39:37 +01:00
parent cb06d3432a
commit bf7f94bc80
8 changed files with 100 additions and 9 deletions

View File

@ -17,7 +17,7 @@ func TestLayaEnvironment(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if cfg.LayaURL != "http://laya:8000" || cfg.LayaTimeout != 120*time.Second {
if cfg.LayaURL != "http://laya:8000" || cfg.LayaTimeout != 5*time.Minute {
t.Fatal("incorrect Laya defaults")
}
t.Setenv("LAYA_URL", "http://127.0.0.1:8001")
@ -27,7 +27,12 @@ func TestLayaEnvironment(t *testing.T) {
if err != nil || cfg.LayaURL != "http://127.0.0.1:8001" || cfg.LayaTimeout != 45*time.Second || cfg.LayaAPIKey != "test-secret" {
t.Fatalf("environment not loaded: %v", err)
}
for _, value := range []string{"invalid", "0s", "-1s", "11m"} {
t.Setenv("LAYA_TIMEOUT", "10m")
cfg, err = Load()
if err != nil || cfg.LayaTimeout != 10*time.Minute {
t.Fatalf("maximum override rejected: %v", err)
}
for _, value := range []string{"invalid", "0s", "-1s", "11m", "10m1ns"} {
t.Setenv("LAYA_TIMEOUT", value)
if _, err := Load(); err == nil {
t.Errorf("accepted timeout %s", value)