update workflow and add ssh keys support
This commit is contained in:
parent
f3a8a8d757
commit
3947df9fbb
6 changed files with 69 additions and 12 deletions
34
test/serverLauncher.test.js
Normal file
34
test/serverLauncher.test.js
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { buildSshArgs } from "../src/services/serverLauncher.js";
|
||||
|
||||
test("builds ssh args with optional port and key file", () => {
|
||||
assert.deepEqual(
|
||||
buildSshArgs({
|
||||
target: "user@192.0.2.10",
|
||||
port: "2222",
|
||||
keyFile: "/home/app/.ssh/game-key",
|
||||
command: "bash /opt/game/start.sh",
|
||||
}),
|
||||
[
|
||||
"-p",
|
||||
"2222",
|
||||
"-i",
|
||||
"/home/app/.ssh/game-key",
|
||||
"user@192.0.2.10",
|
||||
"bash /opt/game/start.sh",
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
test("builds ssh args without optional port and key file", () => {
|
||||
assert.deepEqual(
|
||||
buildSshArgs({
|
||||
target: "game-server",
|
||||
port: "",
|
||||
keyFile: "",
|
||||
command: "bash /opt/game/start.sh",
|
||||
}),
|
||||
["game-server", "bash /opt/game/start.sh"]
|
||||
);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue