fix: sync current handlers, repair relic data and restore visible launcher consoles
This commit is contained in:
1 parent
163d4433e6
commit
74f3c4411b
46 files changed
+4599
-1402
No files matched your search
@@ -0,0 +1,43 @@
|
||||
package sdkserver
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"gac-hkrpg-go/internal/common"
|
||||
goproto "gac-hkrpg-go/protocol/proto"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func TestConfiguredDispatchAndGateway(t *testing.T) {
|
||||
// Fixture endpoints must appear on the wire instead of any local defaults.
|
||||
cfg := common.RuntimeConfig{PublicSDKURL: "https://sdk.example.invalid/prefix", PublicGameHost: "game.example.invalid", GamePort: 32123}
|
||||
w := httptest.NewRecorder()
|
||||
queryDispatch(w, httptest.NewRequest("GET", "/query_dispatch", nil), cfg)
|
||||
raw, err := base64.StdEncoding.DecodeString(w.Body.String())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var dispatch goproto.Dispatch
|
||||
if err := proto.Unmarshal(raw, &dispatch); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(dispatch.RegionList) != 1 || dispatch.RegionList[0].DispatchUrl != cfg.PublicSDKURL+"/query_gateway" {
|
||||
t.Fatalf("wrong dispatch: %v", &dispatch)
|
||||
}
|
||||
state := &appState{runtime: cfg, hotfixMap: map[string]VersionConfig{"fixture": {}}}
|
||||
w = httptest.NewRecorder()
|
||||
queryGateway(state)(w, httptest.NewRequest("GET", "/query_gateway?version=fixture", nil))
|
||||
raw, err = base64.StdEncoding.DecodeString(w.Body.String())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var gateway goproto.Gateserver
|
||||
if err := proto.Unmarshal(raw, &gateway); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if gateway.Ip != cfg.PublicGameHost || gateway.Port != uint32(cfg.GamePort) {
|
||||
t.Fatalf("wrong gateway: %v", &gateway)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user