Includes: - Backend services: ingestion (:8001), weather API (:8002), gateway (:8003), billing (:8004) with BTCPay integration - Shared asyncpg pool, TimescaleDB hypertable, Redis, Mosquitto MQTT - React frontend: Dashboard (MapLibre) and Messaging (chat UI) - Bridge daemon for Pi + Meshtastic (Serial/TCP T-Deck support) - Production Docker Compose, Nginx reverse proxy, ops scripts - DEPLOY.md with step-by-step deployment guide
50 lines
2.1 KiB
Markdown
50 lines
2.1 KiB
Markdown
# Tests
|
|
|
|
This directory contains integration, end-to-end, and hardware-in-the-loop tests for the KosmoConnect platform.
|
|
|
|
## Structure
|
|
|
|
```
|
|
tests/
|
|
├── integration/ # Service-level integration tests
|
|
│ ├── api/ # API contract tests
|
|
│ ├── gateway/ # Message gateway flow tests
|
|
│ ├── ingestion/ # Data pipeline tests
|
|
│ └── e2e/ # Full end-to-end scenarios
|
|
└── hardware-in-loop/ # Physical hardware validation
|
|
├── enviro-node/ # Enviro-node firmware tests
|
|
├── bridge/ # Bridge daemon tests
|
|
└── fixtures/ # Shared test data and mock devices
|
|
```
|
|
|
|
## Integration Tests
|
|
|
|
Run against a local Docker Compose stack of all backend services.
|
|
|
|
**Scenarios**:
|
|
1. **Data Ingestion E2E**: Simulate a bridge publishing MQTT messages → verify data appears in API response
|
|
2. **Message Gateway E2E**: Simulate web user sending message → verify MQTT topic receives payload → simulate ACK → verify delivery status updated
|
|
3. **Subscription Enforcement**: Attempt to send message with expired subscription → verify 403 response
|
|
4. **Rate Limiting**: Send burst of messages → verify 429 response
|
|
|
|
## Hardware-in-the-Loop Tests
|
|
|
|
Requires physical test hardware on a lab bench.
|
|
|
|
**Setup**:
|
|
- 1x Enviro-Node prototype on test fixture
|
|
- 1x Infrastructure Node (T-Beam) connected to test Raspberry Pi
|
|
- Local test MQTT broker
|
|
- RF isolation box (optional, for CI)
|
|
|
|
**Scenarios**:
|
|
1. **Sensor Accuracy**: Compare enviro-node readings against calibrated reference instruments
|
|
2. **Store-and-Forward**: Disconnect bridge node, let enviro-node collect data, reconnect bridge, verify all data is transmitted
|
|
3. **Power Budget**: Run enviro-node on small battery for 72 hours, verify expected sleep currents
|
|
4. **Mesh Relay**: Send message between two handheld Meshtastic devices via the enviro-node relay
|
|
|
|
## CI Integration
|
|
|
|
- Integration tests run on every PR via GitHub Actions
|
|
- Hardware-in-the-loop tests run nightly on a self-hosted runner connected to the lab bench
|