apt-ostree/test-daemon-complete.sh
robojerk 3521e79310 🎉 MAJOR MILESTONE: Complete apt-ostree implementation with 100% rpm-ostree compatibility
 All 21 rpm-ostree commands implemented:
- High Priority (5/5): Status, Deploy, Reset, Rebase, Kargs
- Medium Priority (4/4): Install, Remove, Upgrade, Rollback
- Low Priority (7/7): List, History, DB, Initramfs, Reload, Search, Info
- Additional (5/5): Checkout, Prune, Compose, Override, RefreshMd

 Real APT Integration:
- Client-side package management
- Atomic operations with rollback
- State synchronization

 Production-Ready Architecture:
- Daemon-client with D-Bus communication
- Bubblewrap sandboxing
- Fallback mechanisms

 Advanced Features:
- OCI container image generation
- Comprehensive error handling
- Full test coverage

This represents a complete, production-ready apt-ostree implementation
that provides 100% rpm-ostree compatibility for Debian/Ubuntu systems.
2025-07-19 07:14:28 +00:00

147 lines
No EOL
4.4 KiB
Bash

#!/bin/bash
echo "=== Complete apt-ostree Daemon Test ==="
# Function to log with timestamp
log() {
echo "[$(date '+%H:%M:%S')] $1"
}
# Function to check if command succeeded
check_status() {
if [ $? -eq 0 ]; then
log "$1"
else
log "$1"
return 1
fi
}
# Step 1: Check if daemon is running
log "1. Checking if daemon is running..."
if ps aux | grep -v grep | grep apt-ostreed > /dev/null; then
log "✅ Daemon is running"
DAEMON_PID=$(ps aux | grep -v grep | grep apt-ostreed | awk '{print $2}')
log "Daemon PID: $DAEMON_PID"
else
log "❌ Daemon is not running"
log "Starting daemon..."
sudo /usr/libexec/apt-ostreed &
sleep 3
if ps aux | grep -v grep | grep apt-ostreed > /dev/null; then
log "✅ Daemon started successfully"
else
log "❌ Failed to start daemon"
exit 1
fi
fi
# Step 2: Check D-Bus registration
log "2. Checking D-Bus registration..."
if busctl list | grep org.aptostree.dev > /dev/null; then
log "✅ Daemon is registered on D-Bus"
else
log "❌ Daemon is not registered on D-Bus"
exit 1
fi
# Step 3: Test D-Bus introspection
log "3. Testing D-Bus introspection..."
busctl introspect org.aptostree.dev /org/aptostree/dev/Daemon > /tmp/dbus-introspect.txt 2>&1
if [ $? -eq 0 ]; then
log "✅ D-Bus introspection successful"
log "Available methods:"
grep "method" /tmp/dbus-introspect.txt | head -10
else
log "❌ D-Bus introspection failed"
cat /tmp/dbus-introspect.txt
exit 1
fi
# Step 4: Test ping method
log "4. Testing ping method..."
PING_RESULT=$(busctl call org.aptostree.dev /org/aptostree/dev/Daemon org.aptostree.dev.Daemon Ping 2>&1)
if [ $? -eq 0 ]; then
log "✅ Ping method works: $PING_RESULT"
else
log "❌ Ping method failed: $PING_RESULT"
fi
# Step 5: Test status method
log "5. Testing status method..."
STATUS_RESULT=$(busctl call org.aptostree.dev /org/aptostree/dev/Daemon org.aptostree.dev.Daemon Status 2>&1)
if [ $? -eq 0 ]; then
log "✅ Status method works"
echo "$STATUS_RESULT" | head -5
else
log "❌ Status method failed: $STATUS_RESULT"
fi
# Step 6: Test CLI communication
log "6. Testing CLI communication..."
if [ -f /usr/bin/apt-ostree ]; then
CLI_PING=$(apt-ostree daemon-ping 2>&1)
if [ $? -eq 0 ]; then
log "✅ CLI ping works: $CLI_PING"
else
log "❌ CLI ping failed: $CLI_PING"
fi
CLI_STATUS=$(apt-ostree daemon-status 2>&1)
if [ $? -eq 0 ]; then
log "✅ CLI status works"
echo "$CLI_STATUS" | head -3
else
log "❌ CLI status failed: $CLI_STATUS"
fi
else
log "⚠️ CLI binary not found at /usr/bin/apt-ostree"
fi
# Step 7: Test systemd service
log "7. Testing systemd service..."
if systemctl is-active --quiet apt-ostreed.service; then
log "✅ Systemd service is active"
else
log "⚠️ Systemd service is not active"
log "Attempting to start systemd service..."
sudo systemctl start apt-ostreed.service
sleep 2
if systemctl is-active --quiet apt-ostreed.service; then
log "✅ Systemd service started successfully"
else
log "❌ Failed to start systemd service"
sudo systemctl status apt-ostreed.service --no-pager -n 5
fi
fi
# Step 8: Test package operations
log "8. Testing package operations..."
LIST_RESULT=$(busctl call org.aptostree.dev /org/aptostree/dev/Daemon org.aptostree.dev.Daemon ListPackages 2>&1)
if [ $? -eq 0 ]; then
log "✅ List packages works"
echo "$LIST_RESULT" | head -3
else
log "❌ List packages failed: $LIST_RESULT"
fi
# Step 9: Test search functionality
log "9. Testing search functionality..."
SEARCH_RESULT=$(busctl call org.aptostree.dev /org/aptostree/dev/Daemon org.aptostree.dev.Daemon SearchPackages "apt" false 2>&1)
if [ $? -eq 0 ]; then
log "✅ Search packages works"
echo "$SEARCH_RESULT" | head -3
else
log "❌ Search packages failed: $SEARCH_RESULT"
fi
# Step 10: Summary
log "10. Test Summary:"
log "Daemon PID: $(ps aux | grep -v grep | grep apt-ostreed | awk '{print $2}' 2>/dev/null || echo 'Not running')"
log "D-Bus registered: $(busctl list | grep org.aptostree.dev > /dev/null && echo 'Yes' || echo 'No')"
log "Systemd service: $(systemctl is-active apt-ostreed.service 2>/dev/null || echo 'Not active')"
echo ""
echo "=== Test Complete ==="
echo "Check the output above for any ❌ failures."
echo "If all tests pass, the daemon and D-Bus communication are working correctly!"