mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-13 18:15:02 +00:00
Clear bot-flagged test nits and annotate the sandbox workspace path
Wrap a storage read in a context manager (close the file handle), add a comment on the expected SandboxCapacityError in the churn test, and unify the artifacts-routes test on a single import style. Also annotate the intentional per-session sandbox workspace path with # nosec B108 (controlled dir inside the runner container, not an insecure shared temp file).
This commit is contained in:
1 parent
0d67734fdd
commit
00896eb828
4 files changed
+5
-3
No files matched your search
@@ -25,7 +25,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
# Per-session workspace root inside the runner container. The kernel sets its
|
||||
# cwd here so relative paths from LLM code and file in/out share one directory.
|
||||
_WORKSPACE_ROOT = "/tmp/docsgpt-sandbox"
|
||||
_WORKSPACE_ROOT = "/tmp/docsgpt-sandbox" # nosec B108 - controlled per-session sandbox workspace dir
|
||||
|
||||
# Marker the get_file helper prints around the base64 payload so we can extract
|
||||
# it from interleaved stdout without a contents API (the gateway has none).
|
||||
|
||||
@@ -177,7 +177,8 @@ def test_attachments_bridge_to_run_scoped_artifacts(pg_engine, tmp_path, monkeyp
|
||||
# The bytes round-trip from storage (never entered state).
|
||||
with pg_engine.connect() as conn:
|
||||
v = ArtifactsRepository(conn).get_version(refs[0]["artifact_id"], 1)
|
||||
assert storage.get_file(v["storage_path"]).read() == a1
|
||||
with storage.get_file(v["storage_path"]) as fh:
|
||||
assert fh.read() == a1
|
||||
|
||||
|
||||
def test_attachments_capped_per_run(pg_engine, tmp_path, monkeypatch):
|
||||
|
||||
@@ -486,7 +486,7 @@ class TestMalformedArtifactId:
|
||||
self, _patch_db, flask_app, token_owner, resource_name,
|
||||
extra_args, method, json_body,
|
||||
):
|
||||
import application.api.user.artifacts.routes as routes_mod
|
||||
from application.api.user.artifacts import routes as routes_mod
|
||||
|
||||
resource_cls = getattr(routes_mod, resource_name)
|
||||
resp = _call(
|
||||
|
||||
@@ -385,6 +385,7 @@ def test_concurrent_open_close_stays_consistent(backend):
|
||||
mgr.open(sid)
|
||||
mgr.exec(sid, "x")
|
||||
except SandboxCapacityError:
|
||||
# capacity is expected under churn; skip this session
|
||||
pass
|
||||
mgr.reap_expired()
|
||||
mgr.close(sid)
|
||||
|
||||
Reference in new issue
Block a user