feat(test): add test-schema target and SCHEMA_QUICK=1 mode for schemathesis

- Add dedicated test-schema Makefile target (xdist logical, 600s timeout,
  -m fuzz) so schemathesis runs separately from test-fuzz, which was
  spinning up competing uvicorn workers per xdist process
- Exclude all test_schemathesis*.py files from FUZZ_FLAGS via --ignore
- Add schema to _ALL_SUITES between api and fuzz
- Add SCHEMA_QUICK env var (default 0): caps every max_examples to 100
  across all four schemathesis files (4520 -> 600 total examples)
- Fix pre-push hook: use .311 venv and delegate to make test-all FAIL_FAST=0
  instead of hand-rolling five separate pytest invocations
This commit is contained in:
2026-05-16 18:25:40 -04:00
parent ac332a6ba9
commit 0fe9f895d0
5 changed files with 36 additions and 10 deletions

View File

@@ -40,6 +40,7 @@ def _free_port() -> int:
LIVE_PORT = _free_port()
LIVE_SERVER_URL = f"http://127.0.0.1:{LIVE_PORT}"
TEST_SECRET = "test-secret-for-automated-fuzzing"
_QUICK = os.getenv("SCHEMA_QUICK") == "1"
import decnet.web.auth
decnet.web.auth.SECRET_KEY = TEST_SECRET
@@ -144,7 +145,7 @@ schema = st.openapi.from_url(f"{LIVE_SERVER_URL}/openapi.json")
@pytest.mark.fuzz
@st.pytest.parametrize(api=schema)
@settings(
max_examples=3000,
max_examples=100 if _QUICK else 3000,
deadline=None,
verbosity=Verbosity.debug,
suppress_health_check=[
@@ -161,7 +162,7 @@ def test_schema_compliance(case):
@pytest.mark.fuzz
@st.pytest.parametrize(api=schema)
@settings(
max_examples=500,
max_examples=100 if _QUICK else 500,
deadline=None,
verbosity=Verbosity.normal,
suppress_health_check=[

View File

@@ -18,9 +18,12 @@ from schemathesis.specs.openapi.checks import (
response_headers_conformance,
response_schema_conformance,
)
import os
from hypothesis import settings, HealthCheck
from decnet.agent import app as _agent_app_mod
_QUICK = os.getenv("SCHEMA_QUICK") == "1"
from decnet.agent import executor as _exec
from decnet.agent import heartbeat as _heartbeat
@@ -87,7 +90,7 @@ CHECKS = (
@pytest.mark.fuzz
@SCHEMA.parametrize()
@settings(
max_examples=300,
max_examples=100 if _QUICK else 300,
deadline=None,
suppress_health_check=[
HealthCheck.filter_too_much,

View File

@@ -17,6 +17,8 @@ os.environ.setdefault("DECNET_JWT_SECRET", "schemathesis-swarm-secret-32chars-mi
import pytest
import schemathesis as st
_QUICK = os.getenv("SCHEMA_QUICK") == "1"
from schemathesis.checks import not_a_server_error
from schemathesis.specs.openapi.checks import (
status_code_conformance,
@@ -54,7 +56,7 @@ CHECKS = (
@pytest.mark.fuzz
@SCHEMA.parametrize()
@settings(
max_examples=200,
max_examples=100 if _QUICK else 200,
deadline=None,
suppress_health_check=[
HealthCheck.filter_too_much,

View File

@@ -24,7 +24,10 @@ Routes covered (all decorated ``tags=["TTP Tagging"]``):
"""
from __future__ import annotations
import os
import pytest
_QUICK = os.getenv("SCHEMA_QUICK") == "1"
import schemathesis as st
from hypothesis import HealthCheck, Verbosity, settings
@@ -46,7 +49,7 @@ TTP_SCHEMA = st.openapi.from_url(
@pytest.mark.fuzz
@TTP_SCHEMA.parametrize()
@settings(
max_examples=400,
max_examples=100 if _QUICK else 400,
deadline=None,
verbosity=Verbosity.normal,
suppress_health_check=[
@@ -63,7 +66,7 @@ def test_ttp_schema_compliance(case):
@pytest.mark.fuzz
@TTP_SCHEMA.parametrize()
@settings(
max_examples=120,
max_examples=100 if _QUICK else 120,
deadline=None,
verbosity=Verbosity.normal,
suppress_health_check=[