#!/bin/bash # Test script for debos backend integration set -e echo "๐Ÿงช Testing Debian Bootc Image Builder - debos Backend" echo "======================================================" # Check if debos is available if ! command -v debos >/dev/null 2>&1; then echo "โŒ debos is not installed. Please install it first:" echo " sudo apt install debos" exit 1 fi echo "โœ… debos is available" # Check if we have a test image if ! sudo podman image exists localhost/debian-bootc-example:latest; then echo "โŒ Test image not found. Please ensure you have a local test image." exit 1 fi echo "โœ… Test image found: localhost/debian-bootc-example:latest" # Test 1: Dry run with debos backend echo "" echo "๐Ÿ” Test 1: Dry run with debos backend" echo "--------------------------------------" if sudo ./bootc-image-builder --use-debos --debos-dry-run localhost/debian-bootc-example:latest; then echo "โœ… Dry run test passed" else echo "โŒ Dry run test failed" exit 1 fi # Test 2: Help output shows debos flags echo "" echo "๐Ÿ” Test 2: Help output shows debos flags" echo "----------------------------------------" if ./bootc-image-builder build --help | grep -q "use-debos"; then echo "โœ… Help output test passed" else echo "โŒ Help output test failed" exit 1 fi # Test 3: Suite detection echo "" echo "๐Ÿ” Test 3: Suite detection" echo "---------------------------" if sudo ./bootc-image-builder --use-debos --debos-dry-run --verbose localhost/debian-bootc-example:latest 2>&1 | grep -q "Detected Debian suite: trixie"; then echo "โœ… Suite detection test passed" else echo "โŒ Suite detection test failed" exit 1 fi # Test 4: Architecture detection echo "" echo "๐Ÿ” Test 4: Architecture detection" echo "---------------------------------" if sudo ./bootc-image-builder --use-debos --debos-dry-run --verbose localhost/debian-bootc-example:latest 2>&1 | grep -q "Architecture: x86_64"; then echo "โœ… Architecture detection test passed" else echo "โŒ Architecture detection test failed" exit 1 fi echo "" echo "๐ŸŽ‰ All tests passed! The debos backend integration is working correctly." echo "" echo "๐Ÿš€ Next steps:" echo " 1. Test with real debos builds (remove --debos-dry-run)" echo " 2. Test with different Debian suites" echo " 3. Test with different architectures" echo " 4. Test OSTree integration" echo "" echo "๐Ÿ“š Usage examples:" echo " # Basic debos build" echo " sudo ./bootc-image-builder --use-debos debian:trixie" echo "" echo " # Custom suite" echo " sudo ./bootc-image-builder --use-debos --debos-suite bookworm debian:bookworm" echo "" echo " # Custom packages" echo " sudo ./bootc-image-builder --use-debos --debos-packages vim,htop debian:trixie" echo "" echo " # Dry run first" echo " sudo ./bootc-image-builder --use-debos --debos-dry-run debian:trixie"