R-885: script-tests gate runs every scripts/**/test_*.py on every push (decoys, red-proofs); closed (336 -> 335)
gates / gates (push) Failing after 1m17s
gates / gates (push) Failing after 1m17s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
@@ -64,6 +64,24 @@ sys.exit(98)
|
||||
'''
|
||||
|
||||
|
||||
# The CI runner carries python3 and git only (no sqlite3 CLI). When the real `sqlite3` is absent, a stand-in built on
|
||||
# Python's own sqlite3 module (the SAME SQLite library) answers exactly the calls the scripts make:
|
||||
# `sqlite3 -readonly <db> '<sql>'`, one row per line, "|"-separated, exit 1 + stderr on an error. Said out loud below.
|
||||
FAKE_SQLITE3 = r'''#!/usr/bin/env python3
|
||||
import sqlite3, sys
|
||||
a = [x for x in sys.argv[1:] if x != "-readonly"]
|
||||
try:
|
||||
db = sqlite3.connect("file:" + a[0] + "?mode=ro", uri=True)
|
||||
for row in db.execute(a[1]):
|
||||
print("|".join("" if v is None else str(v) for v in row))
|
||||
except Exception as e:
|
||||
print("Error: " + str(e), file=sys.stderr); sys.exit(1)
|
||||
'''
|
||||
REAL_SQLITE3 = shutil.which("sqlite3")
|
||||
if not REAL_SQLITE3:
|
||||
print("test_hub_db_backup: no sqlite3 CLI here — using the Python-sqlite3 stand-in (same SQLite library)")
|
||||
|
||||
|
||||
def make_db(path, hosts=2, recovery=("enc:v1:abc", "enc:v1:def"), corrupt=False):
|
||||
db = sqlite3.connect(path)
|
||||
db.execute("CREATE TABLE hosts (host_id TEXT)")
|
||||
@@ -90,7 +108,10 @@ class Base(unittest.TestCase):
|
||||
j = lambda *p: os.path.join(self.t, *p)
|
||||
for d in ("bin", "pod/snapshots", "conf", "state", "textfile", "pbs"):
|
||||
os.makedirs(j(d), exist_ok=True)
|
||||
for name, body in (("kubectl", FAKE_KUBECTL), ("proxmox-backup-client", FAKE_PBS)):
|
||||
fakes = [("kubectl", FAKE_KUBECTL), ("proxmox-backup-client", FAKE_PBS)]
|
||||
if not REAL_SQLITE3:
|
||||
fakes.append(("sqlite3", FAKE_SQLITE3))
|
||||
for name, body in fakes:
|
||||
p = j("bin", name); open(p, "w").write(body); os.chmod(p, 0o755)
|
||||
open(j("conf", "env"), "w").write(
|
||||
"PBS_REPOSITORY_PUSH='dooplex-hub@pbs!push@127.0.0.1:18007:felhom-offsite'\n"
|
||||
|
||||
Reference in New Issue
Block a user