test: add pytest suite and gate Docker builds on it
Unit tests cover the SQL gate, broadcast codec, Hive writer layout, and flight kinematics. CI runs pytest first; the simulator image build runs tests in a dedicated stage before the final layer.
This commit is contained in:
@@ -30,6 +30,10 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: pip install --quiet -r simulator/requirements.txt
|
||||
|
||||
- name: Unit tests (TDD gate)
|
||||
working-directory: simulator
|
||||
run: pytest tests/ -q
|
||||
|
||||
- name: Compile check
|
||||
run: python -m compileall -q simulator/virtual_drone simulator/monitoring simulator/explorer
|
||||
|
||||
@@ -49,26 +53,6 @@ jobs:
|
||||
print(f"smoke flight OK: {rows} telemetry rows")
|
||||
EOF
|
||||
|
||||
- name: SQL gate tests
|
||||
working-directory: simulator
|
||||
run: |
|
||||
python - <<'EOF'
|
||||
import sys
|
||||
sys.path.insert(0, "explorer")
|
||||
from server import gate
|
||||
|
||||
assert gate("SELECT 1") is None
|
||||
assert gate("WITH t AS (SELECT 1) SELECT * FROM t") is None
|
||||
assert gate("DESCRIBE telemetry") is None
|
||||
assert gate("DROP TABLE telemetry") is not None
|
||||
assert gate("SELECT 1; SELECT 2") is not None
|
||||
assert gate("INSTALL httpfs") is not None
|
||||
assert gate("SET memory_limit='1GB'") is not None
|
||||
assert gate("/* sneaky */ COPY t TO 'x'") is not None
|
||||
assert gate("") is not None
|
||||
print("SQL gate OK: reads pass, writes and config are rejected")
|
||||
EOF
|
||||
|
||||
scan:
|
||||
name: Trivy scan
|
||||
runs-on: ubuntu-latest
|
||||
@@ -141,6 +125,7 @@ jobs:
|
||||
TAG="${{ steps.version.outputs.new_tag }}"
|
||||
mkdir -p .tmp
|
||||
tar --exclude='.git' --exclude='.tmp' --exclude='simulator/data' \
|
||||
--exclude='var/t1' --exclude='var/t3' \
|
||||
--exclude='simulator/.venv' --exclude='prototype/node_modules' \
|
||||
-czf ".tmp/swarm-house-${TAG}.tar.gz" .
|
||||
|
||||
|
||||
Reference in New Issue
Block a user