feat: 完整游戏运维功能

This commit is contained in:
npc0-hue
2026-07-18 09:04:01 +08:00
parent f3b14b7945
commit 48b8ad8d6c
187 changed files with 16607 additions and 1140 deletions
+7 -1
View File
@@ -17,6 +17,7 @@ func TestCoreServiceServerLifecycleWorkflows(t *testing.T) {
RunEndpointID: "run-local",
Name: "SCUM #1",
IdempotencyKey: "idem-create",
ProfileKey: "local",
})
if err != nil {
t.Fatalf("create lifecycle workflow: %v", err)
@@ -88,6 +89,7 @@ func TestCoreServiceServerLifecycleRejectsInvalidCommands(t *testing.T) {
if err != nil {
t.Fatalf("create ready server: %v", err)
}
createCompleteRuntimeBinding(t, svc, instance, "local")
_, err = svc.StartServerInstance(domain.ServerLifecycleCommand{
ServerInstanceID: instance.ID,
@@ -121,6 +123,7 @@ func TestCoreServiceServerLifecycleRejectsInvalidCommands(t *testing.T) {
State: domain.ServerInstanceStateRunning,
})
if err == nil {
createCompleteRuntimeBinding(t, svc, running, "local")
_, err = svc.StopServerInstance(domain.ServerLifecycleCommand{
ServerInstanceID: running.ID,
ExpectedConfigVersion: running.ConfigVersion,
@@ -141,6 +144,7 @@ func TestCoreServiceLifecycleFailureProjectsFailedState(t *testing.T) {
RunEndpointID: "run-local",
Name: "SCUM #1",
IdempotencyKey: "idem-create",
ProfileKey: "local",
}); err != nil {
t.Fatalf("create lifecycle workflow: %v", err)
}
@@ -166,6 +170,7 @@ func TestCoreServicePluginLifecycleManagesMultipleInstancesIndependently(t *test
RunEndpointID: "run-local",
Name: id,
IdempotencyKey: "idem-create-" + id,
ProfileKey: "local",
}); err != nil {
t.Fatalf("create %s: %v", id, err)
}
@@ -249,7 +254,8 @@ func createLifecyclePlugin(t *testing.T, svc *CoreService) domain.GamePlugin {
Start: "actions/start.json",
Stop: "actions/stop.json",
},
Permissions: domain.PluginPermissions{Jobs: true, Logs: true},
Permissions: domain.PluginPermissions{Jobs: true, Logs: true},
RuntimeProfiles: domain.GamePluginRuntimeProfiles{LifecycleProfiles: []domain.RuntimeLifecycleProfile{{Key: "local", Mode: "local-process", Capabilities: []string{domain.LifecycleCapabilityInstall, domain.LifecycleCapabilityStart, domain.LifecycleCapabilityStop}}}},
})
if err != nil {
t.Fatalf("create lifecycle plugin: %v", err)