forked from mtusi2026/mtusi2026lab3
Prepare verified laboratory 3 implementation and evidence
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { resolve } from "node:path";
|
||||
const root = resolve(import.meta.dir, "..");
|
||||
const p = Bun.spawn(
|
||||
[
|
||||
resolve(root, "scripts/kube.sh"),
|
||||
"exec",
|
||||
"-i",
|
||||
"deployment/postgres",
|
||||
"--",
|
||||
"psql",
|
||||
"-X",
|
||||
"-qAt",
|
||||
"-U",
|
||||
"messenger",
|
||||
"-d",
|
||||
"messenger",
|
||||
"-v",
|
||||
"ON_ERROR_STOP=1",
|
||||
],
|
||||
{ cwd: root, stdin: "pipe", stdout: "pipe", stderr: "pipe" },
|
||||
);
|
||||
p.stdin.write("SELECT 'stdin-boundary-ok';\n");
|
||||
p.stdin.end();
|
||||
const [out, err] = await Promise.all([
|
||||
new Response(p.stdout).text(),
|
||||
new Response(p.stderr).text(),
|
||||
]);
|
||||
if ((await p.exited) !== 0 || out.trim() !== "stdin-boundary-ok")
|
||||
throw new Error("Kubernetes wrapper did not execute the stdin query");
|
||||
console.log(
|
||||
"PASS: SQL stdin reaches PostgreSQL through the real scoped wrapper",
|
||||
);
|
||||
Reference in New Issue
Block a user