Remove legacy runtime deployment paths

This commit is contained in:
npc0-hue
2026-09-04 12:36:21 +08:00
parent 14cbc63e61
commit 3cfb98ed47
39 changed files with 407 additions and 589 deletions
+37
View File
@@ -0,0 +1,37 @@
package dto
import (
"encoding/json"
"strings"
"testing"
)
func TestGamePluginRuntimeProfilesBodyRejectsLegacyServerDeployments(t *testing.T) {
body := GamePluginRuntimeProfilesBody{ServerDeployments: json.RawMessage(`[{"key":"legacy"}]`)}
violations := body.UnsupportedLegacyProfileViolations("runtimeProfiles")
if len(violations) != 1 || !strings.Contains(violations[0], "runtimeProfiles.serverDeployments is no longer supported") {
t.Fatalf("expected legacy serverDeployments violation, got %v", violations)
}
}
func TestGamePluginRuntimeProfilesBodyRejectsLegacyClientManagers(t *testing.T) {
body := GamePluginRuntimeProfilesBody{ClientManagers: json.RawMessage(`[{"key":"legacy"}]`), LifecycleProfiles: []RuntimeLifecycleProfileBody{{Key: "local", ClientManagerRef: json.RawMessage(`{"key":"legacy"}`)}}}
violations := body.UnsupportedLegacyProfileViolations("manifest.runtimeProfiles")
if len(violations) != 2 || !strings.Contains(strings.Join(violations, "; "), "clientManagers is no longer supported") || !strings.Contains(strings.Join(violations, "; "), "clientManagerRef is no longer supported") {
t.Fatalf("expected legacy client manager violations, got %v", violations)
}
}
func TestGamePluginRuntimeProfilesBodyRejectsLegacyClientManagersWhenNull(t *testing.T) {
var body GamePluginRuntimeProfilesBody
if err := json.Unmarshal([]byte(`{"clientManagers":null}`), &body); err != nil {
t.Fatalf("decode runtime profile body: %v", err)
}
violations := body.UnsupportedLegacyProfileViolations("runtimeProfiles")
if len(violations) != 1 || !strings.Contains(violations[0], "runtimeProfiles.clientManagers is no longer supported") {
t.Fatalf("expected legacy clientManagers null violation, got %v", violations)
}
}