56 lines
2.9 KiB
Diff
56 lines
2.9 KiB
Diff
--- original
|
|
+++ private
|
|
@@ -14,9 +14,12 @@
|
|
import urllib.request
|
|
from pathlib import Path
|
|
|
|
+sys.path.insert(0, 'C:\\Users\\User\\Documents\\Git\\ARCADIA-Studio\\.local\\python-deps')
|
|
from jsonschema import Draft202012Validator, FormatChecker
|
|
|
|
-ROOT = Path(__file__).resolve().parents[3]
|
|
+ROOT = Path('C:\\Users\\User\\Documents\\Git\\ARCADIA-Studio')
|
|
+EVIDENCE = Path('C:\\Users\\User\\Documents\\Git\\ARCADIA-Studio\\.local\\packaged-server-865483b-20260911')
|
|
+import contextlib
|
|
local = json.loads((ROOT / "docs/openapi.json").read_text(encoding="utf-8"))
|
|
for schema in local["components"]["schemas"].values():
|
|
Draft202012Validator.check_schema(schema)
|
|
@@ -27,14 +30,17 @@
|
|
format_checker=FormatChecker())
|
|
|
|
|
|
-with tempfile.TemporaryDirectory(prefix="arcadia-semantic-http-") as directory:
|
|
+with contextlib.nullcontext(str(EVIDENCE / "schema-store")) as directory:
|
|
env = dict(os.environ)
|
|
env.pop("ARCADIA_SERVER_TOKEN", None)
|
|
process = subprocess.Popen([sys.argv[1], "--bind", "127.0.0.1:0", "--data-dir", directory],
|
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, env=env,
|
|
creationflags=subprocess.CREATE_NO_WINDOW if os.name == "nt" else 0)
|
|
try:
|
|
+ (EVIDENCE / 'schema-launch.json').write_text(json.dumps({'pid':process.pid,'args':process.args,'cwd':os.getcwd(),'PATH':env['PATH']},indent=2))
|
|
banner = process.stderr.readline()
|
|
+ (EVIDENCE / 'schema-server.stderr.log').write_text(banner)
|
|
+ responses = []
|
|
address = re.search(r"listening on (127\.0\.0\.1:\d+)", banner)
|
|
assert address, banner
|
|
base = "http://" + address.group(1)
|
|
@@ -50,7 +56,10 @@
|
|
except urllib.error.HTTPError as error:
|
|
response = error
|
|
with response:
|
|
- data = json.load(response)
|
|
+ raw = response.read()
|
|
+ data = json.loads(raw)
|
|
+ responses.append({'method':method,'path':path,'body':body,'status':response.status,'etag':response.headers.get('ETag'),'response':raw.decode()})
|
|
+ (EVIDENCE / 'schema-http.json').write_text(json.dumps(responses,indent=2))
|
|
assert response.status == expected, (response.status, data)
|
|
return data, response.headers.get("ETag")
|
|
|
|
@@ -134,3 +143,7 @@
|
|
finally:
|
|
process.terminate()
|
|
process.wait(timeout=15)
|
|
+ stdout, stderr = process.communicate(timeout=15)
|
|
+ (EVIDENCE / 'schema-server.stdout.log').write_text(stdout)
|
|
+ with (EVIDENCE / 'schema-server.stderr.log').open('a') as log: log.write(stderr)
|
|
+ (EVIDENCE / 'schema-stop.json').write_text(json.dumps({'pid':process.pid,'exit_code':process.returncode,'has_exited':process.poll() is not None,'method':'owned process terminate in original finally'},indent=2))
|