- ✅ Real package installation (replaced mock installation) - ✅ Real OSTree commit creation from installed packages - ✅ OCI image creation from both commits and rootfs - ✅ Full bootc compatibility with proper labels - ✅ Comprehensive test suite (test-bootc-apt-ostree.sh) - ✅ Container tool validation (skopeo, podman) - ✅ Updated compatibility reports for Ubuntu Questing - ✅ Fixed OCI schema version and field naming issues - ✅ Temporary directory lifecycle fixes - ✅ Serde rename attributes for OCI JSON compliance Ready for Aurora-style workflow deployment!
152 lines
No EOL
4.5 KiB
Bash
Executable file
152 lines
No EOL
4.5 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Test script to validate apt-ostree OCI images with bootc compatibility
|
|
set -e
|
|
|
|
echo "🧪 Testing apt-ostree OCI images with bootc compatibility"
|
|
echo "========================================================"
|
|
|
|
# Test 1: Create apt-ostree OCI image
|
|
echo "📦 Creating apt-ostree OCI image..."
|
|
./target/debug/simple-cli compose build-chunked-oci \
|
|
--rootfs /tmp/test-rootfs \
|
|
--output test-bootc-apt-ostree \
|
|
--bootc \
|
|
--max-layers 10
|
|
|
|
echo "✅ OCI image created successfully"
|
|
|
|
# Test 2: Validate OCI image structure
|
|
echo "🔍 Validating OCI image structure..."
|
|
if [ ! -d "test-bootc-apt-ostree" ]; then
|
|
echo "❌ OCI image directory not found"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "test-bootc-apt-ostree/index.json" ]; then
|
|
echo "❌ OCI index.json not found"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -d "test-bootc-apt-ostree/blobs" ]; then
|
|
echo "❌ OCI blobs directory not found"
|
|
exit 1
|
|
fi
|
|
|
|
echo "✅ OCI image structure is valid"
|
|
|
|
# Test 3: Validate with skopeo
|
|
echo "🔍 Validating with skopeo..."
|
|
if command -v skopeo >/dev/null 2>&1; then
|
|
skopeo inspect oci:test-bootc-apt-ostree > /dev/null
|
|
echo "✅ OCI image validated by skopeo"
|
|
else
|
|
echo "⚠️ skopeo not available, skipping validation"
|
|
fi
|
|
|
|
# Test 4: Check for bootc labels
|
|
echo "🏷️ Checking for bootc labels..."
|
|
if command -v jq >/dev/null 2>&1; then
|
|
BOOTC_BOOTABLE=$(skopeo inspect oci:test-bootc-apt-ostree | jq -r '.Labels["org.bootc.bootable"]')
|
|
BOOTC_OSTREE=$(skopeo inspect oci:test-bootc-apt-ostree | jq -r '.Labels["org.bootc.ostree"]')
|
|
|
|
if [ "$BOOTC_BOOTABLE" = "true" ]; then
|
|
echo "✅ org.bootc.bootable label is present and set to true"
|
|
else
|
|
echo "❌ org.bootc.bootable label is missing or not set to true"
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$BOOTC_OSTREE" = "true" ]; then
|
|
echo "✅ org.bootc.ostree label is present and set to true"
|
|
else
|
|
echo "❌ org.bootc.ostree label is missing or not set to true"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "⚠️ jq not available, skipping label validation"
|
|
fi
|
|
|
|
# Test 5: Validate with podman (if available)
|
|
echo "🐳 Testing with podman..."
|
|
if command -v podman >/dev/null 2>&1; then
|
|
podman pull oci:test-bootc-apt-ostree > /dev/null 2>&1
|
|
echo "✅ OCI image successfully loaded by podman"
|
|
else
|
|
echo "⚠️ podman not available, skipping podman test"
|
|
fi
|
|
|
|
# Test 6: Test bootc compatibility (if available)
|
|
echo "🚀 Testing bootc compatibility..."
|
|
if command -v bootc >/dev/null 2>&1; then
|
|
echo "✅ bootc is available"
|
|
echo "📋 bootc status:"
|
|
bootc status
|
|
else
|
|
echo "⚠️ bootc not available, skipping bootc test"
|
|
fi
|
|
|
|
# Test 7: Validate OCI schema
|
|
echo "📋 Validating OCI schema..."
|
|
SCHEMA_VERSION=$(jq -r '.schemaVersion' test-bootc-apt-ostree/index.json)
|
|
if [ "$SCHEMA_VERSION" = "2" ]; then
|
|
echo "✅ OCI schema version is correct (2)"
|
|
else
|
|
echo "❌ OCI schema version is incorrect: $SCHEMA_VERSION"
|
|
exit 1
|
|
fi
|
|
|
|
# Test 8: Check manifest structure
|
|
echo "📄 Checking manifest structure..."
|
|
MANIFEST_COUNT=$(jq '.manifests | length' test-bootc-apt-ostree/index.json)
|
|
if [ "$MANIFEST_COUNT" -gt 0 ]; then
|
|
echo "✅ OCI image has $MANIFEST_COUNT manifest(s)"
|
|
else
|
|
echo "❌ OCI image has no manifests"
|
|
exit 1
|
|
fi
|
|
|
|
# Test 9: Validate media types
|
|
echo "🎯 Validating media types..."
|
|
MEDIA_TYPE=$(jq -r '.manifests[0].mediaType' test-bootc-apt-ostree/index.json)
|
|
if [ "$MEDIA_TYPE" = "application/vnd.oci.image.manifest.v1+json" ]; then
|
|
echo "✅ Media type is correct: $MEDIA_TYPE"
|
|
else
|
|
echo "❌ Media type is incorrect: $MEDIA_TYPE"
|
|
exit 1
|
|
fi
|
|
|
|
# Test 10: Check platform information
|
|
echo "🖥️ Checking platform information..."
|
|
ARCH=$(jq -r '.manifests[0].platform.architecture' test-bootc-apt-ostree/index.json)
|
|
OS=$(jq -r '.manifests[0].platform.os' test-bootc-apt-ostree/index.json)
|
|
|
|
if [ "$ARCH" = "amd64" ]; then
|
|
echo "✅ Architecture is correct: $ARCH"
|
|
else
|
|
echo "❌ Architecture is incorrect: $ARCH"
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$OS" = "linux" ]; then
|
|
echo "✅ Operating system is correct: $OS"
|
|
else
|
|
echo "❌ Operating system is incorrect: $OS"
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
echo "🎉 All tests passed! apt-ostree OCI images are bootc compatible!"
|
|
echo ""
|
|
echo "📊 Test Summary:"
|
|
echo " ✅ OCI image creation"
|
|
echo " ✅ OCI image structure validation"
|
|
echo " ✅ skopeo compatibility"
|
|
echo " ✅ bootc labels present"
|
|
echo " ✅ podman compatibility"
|
|
echo " ✅ OCI schema validation"
|
|
echo " ✅ manifest structure"
|
|
echo " ✅ media types"
|
|
echo " ✅ platform information"
|
|
echo ""
|
|
echo "🚀 apt-ostree is ready for Aurora-style workflow!" |