Integrate 0.9.8 NDS read-only lab, repair upstream hook and simplify setup guidance

This commit is contained in:
2026-11-30 21:13:35 +00:00
parent b9fe2e61d2
commit c3aa4688d8
57 changed files with 2894 additions and 36 deletions

13
tests/test_nds_ncpfs.py Normal file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env python3
import json, os, pathlib, sqlite3, subprocess, sys, tempfile
from contextlib import closing
root=pathlib.Path(__file__).resolve().parents[1]
sys.path.insert(0,str(root/'nds/tools'))
import snapshot
with tempfile.TemporaryDirectory() as td:
db=pathlib.Path(td)/'directory.sqlite3'
data={'tree':'MARS_TREE','organization':'HOME','units':['SERVERS','USERS'],'placements':[{'name':'alice','type':1,'unit':'USERS'}]}
cfg=snapshot.publish(data,db,True,('MARS',['SYS','DATA']))
with closing(sqlite3.connect(db)) as c:ids=dict(c.execute('SELECT dn,id FROM nds_entries'))
env=dict(os.environ,MARS_NDS_LAB='1',MARS_NDS_LAB_READ='1',MARS_NDS_LAB_CONFIG=json.dumps(cfg),MARS_NDS_LAB_DB=str(db))
subprocess.run([str(root/'build/test-nds-ncpfs'),*[str(ids[x]) for x in ('CN=MARS_SYS.OU=SERVERS.O=HOME','OU=SERVERS.O=HOME','CN=ALICE.OU=USERS.O=HOME')]],env=env,check=True)