- File:
MontorToolApplicationTests.java - Framework: JUnit 5,
@SpringBootTest. - Implementation:
@SpringBootTest class MontorToolApplicationTests { @Test void contextLoads() { } }
- Coverage: Evaluates only whether the Spring ApplicationContext can be bootstrapped (requires an active PostgreSQL database connection to succeed).
- Gaps: Zero unit tests, controller mock tests, service integration tests, security authorization tests, or repository tests.
- Inventory: Zero test files exist under
monitor-agent/(no*_test.gofiles). - Gaps:
- No tests for Cobra CLI argument parsing or flag validation.
- No unit tests for STOMP frame serialization or parsing (
parseStompFrames). - No race detection tests (
go test -race). - No unit tests for
CollectMetrics(),collectProcessMetrics(), or command execution sanitization.
- Inventory: Zero test files exist under
frontend/(no*.test.tsxor*.spec.tsfiles). - Dependencies:
package.jsoncontains no test runner (no Jest, Vitest, Playwright, or Cypress). - Linting: ESLint configured via
eslint.config.mjs.
The repository contains an independent, comprehensive load-testing tool in loadtester/.
loadtester/
├── cmd/loadtester/main.go # CLI entrypoint with flags: --config, --preflight-only, --skip-preflight
├── internal/
│ ├── config/config.go # YAML configuration loader & validator
│ ├── api/client.go # REST API client for company & device provisioning
│ ├── company/manager.go # Company creation & authentication driver
│ ├── device/manager.go # Concurrent device registration & token association
│ ├── telemetry/generator.go # Synthetic metrics & detail snapshot payload generator
│ ├── stomp/client.go # Custom concurrent STOMP WebSocket client
│ ├── metrics/metrics.go # Collector tracking throughput, errors, p95 latencies
│ ├── load/runner.go # Master coordinator executing ramp-up, steady-state, chaos, and teardown
│ └── report/report.go # Generates markdown, CSV, and JSON benchmark summaries
└── loadtest.example.yml # Reference load testing profile
- Preflight Health Checks: Verifies backend availability, database connectivity, and WebSocket upgrade support prior to launching load routines.
- Deterministic Ramp-Up: Gradually spins up virtual agents according to a configured ramp-up profile (
rampSchedule), measuring incremental backend degradation. - Chaos Injection: Periodically terminates virtual agent WebSocket connections or injects packet stalls (
chaosLoop) to evaluate backend session recovery. - Command Latency Benchmarking: Emits remote commands and measures round-trip time from
/app/command/{id}to/topic/command-result/{id}.
- Implement
metrics_ws_test.gowith mock WebSocket servers (httptest.NewServer) testing:- Concurrent
RegisterIfNeededexecution withgo test -race ./.... - Batching threshold triggers (10 items vs 5s timer).
- Socket disconnect during batch send and verification of reconnection backoff.
- Concurrent
- Implement
@WebMvcTestand@DataJpaTestwith Testcontainers (PostgreSQL + TimescaleDB):- Multi-tenant data isolation: verify Company A user receives 403 or empty array when requesting Company B device metrics.
- WebSocket subscription authorization: verify Company A client cannot subscribe to Company B device topic.
- RateLimitFilter: verify 121st request from single IP receives HTTP 429.
- Setup Vitest + React Testing Library:
- Verify chunked command reassembly: pass simulated out-of-order chunks and verify assembled text output.
- Verify auto-refresh toggles and interval clearing.\n