46 lines
2.3 KiB
Diff
46 lines
2.3 KiB
Diff
diff --git a/packages/cli/tests/case1-accept.test.mjs b/packages/cli/tests/case1-accept.test.mjs
|
|
index 5baddb646..b2673c325 100644
|
|
--- a/packages/cli/tests/case1-accept.test.mjs
|
|
+++ b/packages/cli/tests/case1-accept.test.mjs
|
|
@@ -97,7 +97,7 @@ const NODE_STUB = `[ "$HOME" = "$ROOT_DIR/srv/mosaic" ] || touch "$HC/node-as-ro
|
|
[ "\${1:-}" = --version ] && { cat "$HC/node-version"; exit 0; }
|
|
exec "$REAL_NODE" "$@"`;
|
|
// The real Python payload runs against a mock socket object, never an OS listener.
|
|
-const PYTHON_STUB = `[ -f "$HC/peer-output" ] && { cat "$HC/peer-output"; exit "$(cat "$HC/peer-status")"; }
|
|
+const PYTHON_STUB = `[ -f "$HC/peer-output" ] && exec /usr/bin/python3 -I -S -c 'import os,sys; root=os.environ["HC"]; sys.stdout.buffer.write(open(root+"/peer-output","rb").read()); sys.exit(int(open(root+"/peer-status").read()))'
|
|
[ -f "$HC/peer-hang" ] && {
|
|
here="$BASHPID"; read -r sid < <(/bin/ps -o sid= -p "$here")
|
|
echo "$here" > "$HC/peer-pid"; printf '%s %s\\n' "$here" "$sid" >> "$HC/query-pids"
|
|
@@ -260,11 +260,31 @@ test('row253 P10 refuses unsafe metadata, wrong peers and an unsafe Python witho
|
|
'changed-pid':h=>put(join(h.hc,'peer-pid-change'),'ActiveState=active\nUser=mosaic\nMainPID=201\n'),
|
|
floor:h=>put(join(h.root,'proc/sys/net/ipv4/ip_unprivileged_port_start'),'700\n'),
|
|
};
|
|
+ const reasons = {
|
|
+ "parent-mode": "metadata",
|
|
+ "parent-owner": "metadata",
|
|
+ "socket-mode": "metadata",
|
|
+ "socket-owner": "metadata",
|
|
+ "socket-type": "metadata",
|
|
+ "symlink": "metadata",
|
|
+ "peer": "peer",
|
|
+ "peer-pid": "peer",
|
|
+ "python-mode": "interpreter",
|
|
+ "python-missing": "interpreter",
|
|
+ "python-not-elf": "interpreter",
|
|
+ "peer-malformed": "probe",
|
|
+ "peer-error": "probe-inner-command",
|
|
+ "peer-uid-fields": "metadata",
|
|
+ "changed-inode": "changed",
|
|
+ "changed-pid": "changed",
|
|
+ "floor": "floor",
|
|
+ };
|
|
for(const [name,fault] of Object.entries(faults)){
|
|
const h=host(t);fault(h);const r=run(h);
|
|
assert.equal(r.status,name==='peer-uid-fields'?1:0,`${name}: ${r.out}${r.err}`);
|
|
assert.match(r.out,/P10 tester-socket-squat unnamed boundary=failed/,name);
|
|
assert.doesNotMatch(r.out,/boundary=observed/,name);
|
|
+ assert.match(r.out,new RegExp('^P10 tester-socket-squat unnamed boundary=failed reason='+reasons[name]+' ', 'm'),name);
|
|
}
|
|
});
|
|
|