merge: testing → main (reconcile 2-week divergence)
This commit is contained in:
@@ -5,12 +5,33 @@ Env vars required by decnet.env must be set here, at module level, before
|
||||
any test file imports decnet.* — pytest loads conftest.py first.
|
||||
"""
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
# Redirect log paths to a user-writable tempdir so unprivileged test runs
|
||||
# (CI, local sans-sudo) don't try to mkdir /var/log/decnet.
|
||||
_TEST_LOG_DIR = os.path.join(tempfile.gettempdir(), "decnet-tests-logs")
|
||||
os.makedirs(_TEST_LOG_DIR, exist_ok=True)
|
||||
os.environ.setdefault("DECNET_LOG_FILE", os.path.join(_TEST_LOG_DIR, "decnet.log"))
|
||||
os.environ.setdefault("DECNET_INGEST_LOG_FILE", os.path.join(_TEST_LOG_DIR, "decnet.log"))
|
||||
os.environ.setdefault("DECNET_AGENT_LOG_FILE", os.path.join(_TEST_LOG_DIR, "agent.log"))
|
||||
|
||||
os.environ["DECNET_JWT_SECRET"] = "stable-test-secret-key-at-least-32-chars-long"
|
||||
os.environ["DECNET_ADMIN_PASSWORD"] = "test-password-123"
|
||||
os.environ["DECNET_DEVELOPER"] = "true"
|
||||
os.environ["DECNET_DEVELOPER_TRACING"] = "false"
|
||||
os.environ["DECNET_DB_TYPE"] = "sqlite"
|
||||
|
||||
# GeoIP enrichment is offline-by-design (RIR delegated-stats) but the
|
||||
# first access triggers a background file fetch. Unit tests must never
|
||||
# hit the network and don't care about country codes — disable
|
||||
# enrichment globally. The geoip-specific tests re-enable it via
|
||||
# monkeypatch + a temp DECNET_GEOIP_ROOT.
|
||||
os.environ["DECNET_GEOIP_ENABLED"] = "false"
|
||||
# Same posture for PTR resolution — tests that cover the resolver
|
||||
# re-enable it explicitly via monkeypatch; everyone else gets the
|
||||
# short-circuit (returns None without touching socket.gethostbyaddr).
|
||||
os.environ["DECNET_PTR_ENABLED"] = "false"
|
||||
|
||||
import pytest
|
||||
from typing import Any
|
||||
|
||||
|
||||
Reference in New Issue
Block a user