mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-09 19:45:13 +02:00
[pitboss/grind] deferred session-0011 (20260516T052512Z-20f8)
This commit is contained in:
parent
c162c638a2
commit
d126f3c15c
15 changed files with 510 additions and 10 deletions
|
|
@ -362,6 +362,26 @@ def __nyx_install_crash_guard(sink_callee):
|
|||
signal.signal(s, _handler)
|
||||
except (OSError, ValueError):
|
||||
pass
|
||||
|
||||
# Phase 10 (Track D.3) stub helpers. When the verifier spawned a SqlStub it
|
||||
# publishes the queries-log path through NYX_SQL_LOG; a sink call site that
|
||||
# wants the host-side stub to see its query appends one record-per-call. The
|
||||
# helper is a no-op when NYX_SQL_LOG is unset so the same fixture source still
|
||||
# runs under harness modes that didn't spawn a stub.
|
||||
def __nyx_stub_sql_record(query, **detail):
|
||||
import os
|
||||
p = os.environ.get("NYX_SQL_LOG")
|
||||
if not p:
|
||||
return
|
||||
try:
|
||||
with open(p, "a") as _f:
|
||||
for k, v in detail.items():
|
||||
_f.write('# %s: %s\n' % (str(k), str(v)))
|
||||
_f.write(str(query))
|
||||
if not str(query).endswith('\n'):
|
||||
_f.write('\n')
|
||||
except OSError:
|
||||
pass
|
||||
"#
|
||||
}
|
||||
|
||||
|
|
@ -1207,6 +1227,19 @@ mod tests {
|
|||
assert!(harness.source.contains("NYX_PROBE_PATH"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn probe_shim_publishes_stub_sql_recorder() {
|
||||
let shim = probe_shim();
|
||||
assert!(
|
||||
shim.contains("def __nyx_stub_sql_record"),
|
||||
"Python probe shim must define __nyx_stub_sql_record"
|
||||
);
|
||||
assert!(
|
||||
shim.contains("NYX_SQL_LOG"),
|
||||
"stub recorder must read NYX_SQL_LOG"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shape_detect_flask() {
|
||||
let src = "from flask import Flask\napp = Flask(__name__)\n@app.route('/')\ndef index():\n pass\n";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue