fix server creation run binding

This commit is contained in:
npc0-hue
2026-08-04 17:14:28 +08:00
parent 980f1786dd
commit 5fbe8092b9
13 changed files with 80 additions and 53 deletions
@@ -53,7 +53,7 @@ describe("runtime profile server creation contracts", () => {
expect(runtimeBindingFields(plugin, "local").some((field) => field.key === "ftp.profile")).toBe(false);
});
it("selects the plugin profile and submits real profile bindings", () => {
it("submits deployment inputs without binding a Run or runtime profile", () => {
const form = defaultServerCreateForm([plugin], []);
expect(form.profileKey).toBe("local");
expect(
@@ -69,15 +69,10 @@ describe("runtime profile server creation contracts", () => {
).toEqual({
id: "server-1",
pluginId: "game.runtime",
runEndpointId: undefined,
name: "Runtime Server",
idempotencyKey: "web:create:server-1:17",
profileKey: "local",
bindings: { "server-root": "runtime.server-root", "rcon.password": "secret://runtime/server-1/rcon" },
deployment: {
mode: "guided-install",
profileKey: "local",
runtimeBindings: { "server-root": "runtime.server-root", "rcon.password": "secret://runtime/server-1/rcon" },
createInputs: { gamePort: "7777", maxPlayers: "64" }
}
});
@@ -117,7 +112,11 @@ describe("runtime profile server creation contracts", () => {
it("keeps complete paths and commands in a write-only deployment payload", () => {
const form = defaultServerCreateForm([plugin], []);
const request = serverCreateRequestFromForm({ ...form, name: "Venv Server", deploymentMode: "custom-command", serverRoot: "/srv/venv-server", workingDirectory: "/srv/venv-server", startCommand: "/srv/venv-server/.venv/bin/python server.py", shell: "" }, 19);
expect(request.runEndpointId).toBeUndefined();
expect("runEndpointId" in request).toBe(false);
expect("profileKey" in request).toBe(false);
expect("bindings" in request).toBe(false);
expect(request.deployment).toMatchObject({ mode: "custom-command", serverRoot: "/srv/venv-server", workingDirectory: "/srv/venv-server", startCommand: "/srv/venv-server/.venv/bin/python server.py" });
expect("profileKey" in (request.deployment ?? {})).toBe(false);
expect("runtimeBindings" in (request.deployment ?? {})).toBe(false);
});
});