MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / _verify_sandbox_functional

Function _verify_sandbox_functional

e2e/python/test_sandbox_policy.py:1614–1655  ·  view source on GitHub ↗

Return a closure that verifies basic sandbox functionality.

()

Source from the content-addressed store, hash-verified

1612
1613
1614def _verify_sandbox_functional():
1615 """Return a closure that verifies basic sandbox functionality."""
1616
1617 def fn():
1618 import json
1619 import os
1620 import sys
1621
1622 checks = {}
1623 # Can resolve DNS config
1624 checks["resolv_conf"] = os.path.exists("/etc/resolv.conf")
1625 # Can access shared libraries
1626 checks["lib_exists"] = os.path.isdir("/usr/lib")
1627 # Python interpreter works
1628 checks["python_version"] = sys.version
1629 # Can write to /tmp
1630 tmp_path = "/tmp/enrichment_test.txt"
1631 try:
1632 with open(tmp_path, "w") as f:
1633 f.write("ok")
1634 with open(tmp_path) as f:
1635 checks["tmp_write"] = f.read() == "ok"
1636 os.unlink(tmp_path)
1637 except Exception as e:
1638 checks["tmp_write"] = str(e)
1639 # Can write to /sandbox
1640 sb_path = "/sandbox/enrichment_test.txt"
1641 try:
1642 with open(sb_path, "w") as f:
1643 f.write("ok")
1644 with open(sb_path) as f:
1645 checks["sandbox_write"] = f.read() == "ok"
1646 os.unlink(sb_path)
1647 except Exception as e:
1648 checks["sandbox_write"] = str(e)
1649 # Can read openshell log (rolling appender writes date-stamped files)
1650 import glob
1651
1652 checks["var_log"] = len(glob.glob("/var/log/openshell*.log*")) > 0
1653 return json.dumps(checks)
1654
1655 return fn
1656
1657
1658def test_baseline_enrichment_missing_filesystem_policy(

Calls

no outgoing calls

Tested by

no test coverage detected