This repository contains integration tests for the hardware-api project, validating the communication between client and server components using sanitized data from certified machines.
The tests ensure that specific machines remain indentified as certified regardless of changes in the client or server codebase. They use real-world data from certified machines, sanitized for testing purposes.
- Install Docker
- Configure Docker permissions
Execute the test suite using Docker Compose:
docker compose up --build --abort-on-container-exit
The test suite runs in Docker containers and consists of two main components:
-
Server Container:
- Built using the server Dockerfile
- Populated with test data using mocked C3 API responses
- Mock data location: server/scripts/c3_test_data/
-
Client Container:
- Uses
hwlib
to collect hardware information - Sends requests to the server container
- Validates responses against expected results
- Test data location: client/hwlib/test_data/
- Uses
Test Flow:
- Server container starts and populates the DB using mocked C3 responses
- Client container:
- Collects hardware information using
hwlib
- Sends requests to the server
- Compares responses with expected results in
response.json
files
- Collects hardware information using
- Tests pass if all responses match their expected values
Test Data:
- Server mock data: server/scripts/c3_test_data/
- Client test data: client/hwlib/test_data/
- Expected responses:
response.json
files in test directories
When adding new test machines data:
- Add corresponding mock data to the server
- Add test data to the client
- Create appropriate
response.json
files - Update tests as needed