127 lines
4.6 KiB
Python
127 lines
4.6 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Integration test for Debian Atomic workflow
|
|
Tests the complete pipeline: treefile → apt-ostree → output
|
|
"""
|
|
|
|
import subprocess
|
|
import sys
|
|
import os
|
|
from pathlib import Path
|
|
|
|
def print_step(step_num, title, description):
|
|
"""Print a test step header"""
|
|
print(f"\n{'='*60}")
|
|
print(f"Step {step_num}: {title}")
|
|
print(f"{'='*60}")
|
|
print(description)
|
|
print()
|
|
|
|
def test_debian_atomic_integration():
|
|
"""Test the complete Debian Atomic integration workflow"""
|
|
|
|
print("🧪 Testing Debian Atomic Integration Workflow")
|
|
print("Testing: treefile → apt-ostree → output")
|
|
print("=" * 60)
|
|
|
|
# Step 1: Validate treefiles
|
|
print_step(1, "Treefile Validation",
|
|
"Validating that our treefiles are compatible with apt-ostree")
|
|
|
|
treefiles_dir = Path("treefiles")
|
|
if not treefiles_dir.exists():
|
|
print("❌ Treefiles directory not found")
|
|
return False
|
|
|
|
treefiles = list(treefiles_dir.glob("*.yaml"))
|
|
if not treefiles:
|
|
print("❌ No treefiles found")
|
|
return False
|
|
|
|
print(f"✅ Found {len(treefiles)} treefiles:")
|
|
for tf in treefiles:
|
|
print(f" - {tf.name}")
|
|
|
|
# Step 2: Test apt-ostree compatibility
|
|
print_step(2, "apt-ostree Compatibility",
|
|
"Testing if apt-ostree can process our treefiles")
|
|
|
|
# Check if apt-ostree is available
|
|
apt_ostree_path = Path("/var/home/rob/Documents/Projects/overseer/apt-ostree/target/release/simple-cli")
|
|
if not apt_ostree_path.exists():
|
|
print("❌ apt-ostree binary not found")
|
|
print(" Expected: /var/home/rob/Documents/Projects/overseer/apt-ostree/target/release/simple-cli")
|
|
return False
|
|
|
|
print(f"✅ apt-ostree found: {apt_ostree_path}")
|
|
|
|
# Step 3: Test treefile processing
|
|
print_step(3, "Treefile Processing",
|
|
"Testing apt-ostree processing of our treefiles")
|
|
|
|
success_count = 0
|
|
for treefile in treefiles:
|
|
print(f"Testing: {treefile.name}")
|
|
try:
|
|
# Run apt-ostree compose tree --dry-run
|
|
result = subprocess.run([
|
|
str(apt_ostree_path), "compose", "tree", "--dry-run", str(treefile)
|
|
], capture_output=True, text=True, timeout=30)
|
|
|
|
if result.returncode == 0:
|
|
print(f" ✅ {treefile.name} processed successfully")
|
|
success_count += 1
|
|
else:
|
|
print(f" ❌ {treefile.name} failed:")
|
|
print(f" stdout: {result.stdout}")
|
|
print(f" stderr: {result.stderr}")
|
|
|
|
except subprocess.TimeoutExpired:
|
|
print(f" ❌ {treefile.name} timed out")
|
|
except Exception as e:
|
|
print(f" ❌ {treefile.name} error: {e}")
|
|
|
|
print(f"\nTreefile processing results: {success_count}/{len(treefiles)} successful")
|
|
|
|
# Step 4: Validate workflow components
|
|
print_step(4, "Workflow Component Validation",
|
|
"Checking that all required components are available")
|
|
|
|
components = {
|
|
"debian-forge": Path("/var/home/rob/Documents/Projects/overseer/debian-forge"),
|
|
"debian-atomic-configs": Path("/var/home/rob/Documents/Projects/overseer/debian-atomic-configs"),
|
|
"apt-ostree": Path("/var/home/rob/Documents/Projects/overseer/apt-ostree"),
|
|
"debian-atomic-blueprint": Path("/var/home/rob/Documents/Projects/overseer/debian-atomic-blueprint.toml")
|
|
}
|
|
|
|
component_status = {}
|
|
for name, path in components.items():
|
|
if path.exists():
|
|
print(f" ✅ {name}: {path}")
|
|
component_status[name] = True
|
|
else:
|
|
print(f" ❌ {name}: {path} (missing)")
|
|
component_status[name] = False
|
|
|
|
# Step 5: Summary
|
|
print_step(5, "Integration Test Summary",
|
|
"Overall status of Debian Atomic integration")
|
|
|
|
total_components = len(components)
|
|
working_components = sum(component_status.values())
|
|
total_treefiles = len(treefiles)
|
|
working_treefiles = success_count
|
|
|
|
print(f"📊 Component Status: {working_components}/{total_components} working")
|
|
print(f"📊 Treefile Status: {working_treefiles}/{total_treefiles} working")
|
|
|
|
if working_components == total_components and working_treefiles == total_treefiles:
|
|
print("\n🎉 All components working! Debian Atomic integration is ready.")
|
|
return True
|
|
else:
|
|
print("\n⚠️ Some components have issues. Check the details above.")
|
|
return False
|
|
|
|
if __name__ == "__main__":
|
|
success = test_debian_atomic_integration()
|
|
sys.exit(0 if success else 1)
|