Testing — This guide provides a complete set of tests to validate the infrastructure orchestration system end-to-end. ⬆ índice
Testing
This guide provides a complete set of tests to validate the infrastructure orchestration system end-to-end.
Table of Contents
- Prerequisites
- Test 1: Full Initial Installation
- Test 2: Permissions Management
- Test 3: Updates and Restart
- Test 4: Clean and Reinstall
- Test 5: Troubleshooting Kafka
- Test 6: Services Validation
- Validation Checklist
Prerequisites
Before running the tests, make sure you have:
# Verify Docker
docker --version
docker compose version
# Verify user permissions
groups | grep docker
# Verify the .env file exists
ls -la .env
# Verify the Docker network exists
source .env
docker network ls | grep "${DOCKER_NETWORK_NAME}"
If the network does not exist, create it:
source .env
docker network create "${DOCKER_NETWORK_NAME}"
Test 1: Full Initial Installation
Goal
Validate that the system installs correctly from scratch, respecting priorities and installation requirements.
Steps
1.1 Full system cleanup
# Stop all services
./infra down all
# Remove all data (DESTRUCTIVE)
./infra clean all --data
# Verify no containers are running
docker ps -a | grep -E "kafka|zookeeper|thingsboard|postgres"
Expected result: There should be no project-related containers.
1.2 Attempt to start services without install
# This MUST fail because ThingsBoard requires installation
./infra up all
Expected result:
Error: The following projects require installation before starting:
- thingsboard
Please run the following commands first:
./infra install thingsboard
1.3 Install ThingsBoard
# Run installation
./infra install thingsboard
# Verify the flag was created
ls -la platform/thingsboard/.installed
Expected result:
- Installation completes without errors
.installedfile exists- Database is initialized
1.4 Start all services
# This should now work
./infra up all
# Wait 30 seconds for services to stabilize
sleep 30
# Verify status
./infra status all
Expected result:
- All services are
Uporhealthy - Start order: Kafka (priority 30) → ThingsBoard (priority 50)
Test 2: Permissions Management
Goal
Validate that directory permissions are handled correctly, especially for Kafka/Zookeeper.
Steps
2.1 Verify Kafka permissions
# Stop Kafka
./infra down kafka
# Check current permissions
ls -ln infrastructure/kafka/broker/data
ls -ln infrastructure/kafka/zookeeper/data
ls -ln infrastructure/kafka/zookeeper/logs
Expected result: Directories should be owned by 1000:1000
2.2 Simulate a permissions problem
# Intentionally change ownership (requires sudo)
sudo chown -R root:root infrastructure/kafka/broker/data
sudo chown -R root:root infrastructure/kafka/zookeeper/data
sudo chown -R root:root infrastructure/kafka/zookeeper/logs
# Verify ownership is wrong
ls -ln infrastructure/kafka/broker/data
Expected result: Directories are now owned by 0:0 (root)
2.3 Start Kafka and verify auto-fix
# The script should detect and fix permissions
./infra up kafka
# Verify permissions were corrected
ls -ln infrastructure/kafka/broker/data
ls -ln infrastructure/kafka/zookeeper/data
Expected result:
- The script prints permission-fix messages
- Directories return to
1000:1000 - Kafka starts correctly
2.4 Check Kafka logs
# Verify there are no permission errors
docker logs kafka 2>&1 | grep -i "permission denied"
docker logs zookeeper 2>&1 | grep -i "permission denied"
Expected result: No permission errors should appear.
Test 3: Updates and Restart
Goal
Validate that updates and restarts work correctly without reinstalling.
Steps
3.1 Restart individual services
# Restart Kafka
./infra restart kafka
# Wait 10 seconds
sleep 10
# Verify status
./infra status kafka
Expected result: Kafka restarts without issues.
3.2 Restart ThingsBoard (without reinstall)
# Restart ThingsBoard
./infra restart thingsboard
# Wait 20 seconds
sleep 20
# Verify status
./infra status thingsboard
Expected result:
- ThingsBoard restarts correctly
- It must NOT run the install process
- Data must persist
3.3 ThingsBoard down + up
# Stop ThingsBoard
./infra down thingsboard
# Verify the .installed flag still exists
ls -la platform/thingsboard/.installed
# Start again
./infra up thingsboard
# Wait 20 seconds
sleep 20
# Verify status
./infra status thingsboard
Expected result:
.installedflag still exists- ThingsBoard starts normally (no install)
- Data persists
3.4 Full stack update
# Stop everything
./infra down all
# Start everything (simulates an update)
./infra up all
# Wait 30 seconds
sleep 30
# Verify status
./infra status all
Expected result: Everything starts correctly without reinstalling.
Test 4: Clean and Reinstall
Goal
Validate the different cleanup levels and reinstall behavior.
Steps
4.1 Clean without data (preserve data)
# Clean without deleting data
./infra clean thingsboard
# Verify data exists
ls -la platform/thingsboard/data
# Verify the .installed flag was NOT removed
ls -la platform/thingsboard/.installed
Expected result:
- Containers are removed
- Data persists
.installedflag persists