.PHONY: test test-unit test-integration test-all otoroshi-start otoroshi-stop otoroshi-logs check build fmt clean
build:
cargo build --release
test-unit:
cargo test --test config_tests --test smoke_tests
otoroshi-start:
docker compose -f docker/docker-compose.test.yaml up -d
@echo "Waiting for Otoroshi to start (timeout: 2 minutes)..."
@count=0; \
while ! curl -sf "http://localhost:8080/.well-known/otoroshi/monitoring/health?access_key=test-health-key" > /dev/null 2>&1; do \
count=$$((count + 1)); \
if [ $$count -ge 40 ]; then \
echo "Error: Otoroshi failed to start within 2 minutes"; \
$(MAKE) otoroshi-stop; \
exit 1; \
fi; \
echo " Waiting... ($$count/40)"; \
sleep 3; \
done
@echo "Otoroshi is ready!"
otoroshi-stop:
docker compose -f docker/docker-compose.test.yaml down -v
otoroshi-logs:
docker compose -f docker/docker-compose.test.yaml logs -f
test-integration:
cargo test --test '*' -- --ignored --test-threads=1
test-all: build otoroshi-start
cargo test --test '*' -- --ignored --test-threads=1 || ($(MAKE) otoroshi-stop && exit 1)
$(MAKE) otoroshi-stop
test: test-unit
check:
cargo fmt -- --check || echo "Warning: formatting issues found (run 'make fmt' to fix)"
cargo clippy || echo "Warning: clippy issues found"
cargo test --test config_tests --test smoke_tests
fmt:
cargo fmt
clean:
cargo clean
$(MAKE) otoroshi-stop 2>/dev/null || true