test(fix, path): chanhgr path to project

This commit is contained in:
Голиков Maximillian Антон
2026-12-01 10:38:12 +03:00
parent e569e12ae7
commit 908d49d5d8
+7 -7
View File
@@ -14,8 +14,6 @@ import sys
import time import time
from urllib.parse import quote, unquote, urlsplit from urllib.parse import quote, unquote, urlsplit
ROOT = Path(__file__).resolve().parents[1]
CERTS = ROOT / "certs/private"
ROLES = ("grafana", "prometheus", "collector", "api") ROLES = ("grafana", "prometheus", "collector", "api")
@@ -212,11 +210,13 @@ def run(*args, **kwargs):
def main(): def main():
import base64 import base64
sys.path.insert(0, str(ROOT / "tests")) root = Path(__file__).resolve().parents[1]
certs = root / "certs/private"
sys.path.insert(0, str(root / "tests"))
from client import Client from client import Client
os.environ.setdefault("COMPOSE_FILE", str(ROOT / "compose.yaml")) os.environ.setdefault("COMPOSE_FILE", str(root / "compose.yaml"))
client = Client("https://localhost:8443", str(CERTS / "ingress/ca.crt")) client = Client("https://localhost:8443", str(certs / "ingress/ca.crt"))
actor = client.user("audit") actor = client.user("audit")
trace = secrets.token_hex(16) trace = secrets.token_hex(16)
response = client.call("GET", "/api/v1/users/me", actor=actor, schema="User", response = client.call("GET", "/api/v1/users/me", actor=actor, schema="User",
@@ -242,11 +242,11 @@ def main():
spec[key] = run("docker", "compose", "exec", "-T", "worker", "printenv", name, spec[key] = run("docker", "compose", "exec", "-T", "worker", "printenv", name,
text=True, capture_output=True).stdout.strip() text=True, capture_output=True).stdout.strip()
mounts = [] mounts = []
for source, dest in [(Path(__file__).resolve(), "/audit.py"), (CERTS / "ingress/ca.crt", "/audit/ca.crt")]: for source, dest in [(Path(__file__).resolve(), "/audit.py"), (certs / "ingress/ca.crt", "/audit/ca.crt")]:
mounts += ["--mount", f"type=bind,src={source},dst={dest},readonly"] mounts += ["--mount", f"type=bind,src={source},dst={dest},readonly"]
for role in ROLES: for role in ROLES:
for ext in ("crt", "key"): for ext in ("crt", "key"):
source = CERTS / f"telemetry/{role}-client.{ext}" source = certs / f"telemetry/{role}-client.{ext}"
mounts += ["--mount", f"type=bind,src={source},dst=/audit/{role}.{ext},readonly"] mounts += ["--mount", f"type=bind,src={source},dst=/audit/{role}.{ext},readonly"]
run("docker", "run", "--rm", "-i", "--read-only", "--cap-drop=ALL", run("docker", "run", "--rm", "-i", "--read-only", "--cap-drop=ALL",
"--security-opt=no-new-privileges", "--network", network, *mounts, "--security-opt=no-new-privileges", "--network", network, *mounts,