Add comprehensive testing framework, performance monitoring, and plugin system
- Add complete pytest testing framework with conftest.py and test files - Add performance monitoring and benchmarking capabilities - Add plugin system with ccache plugin example - Add comprehensive documentation (API, deployment, testing, etc.) - Add Docker API wrapper for service deployment - Add advanced configuration examples - Remove old wget package file - Update core modules with enhanced functionality
This commit is contained in:
parent
4c0dcb2522
commit
c51819c836
30 changed files with 11141 additions and 105 deletions
119
test_sbuild_integration.py
Normal file
119
test_sbuild_integration.py
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test script for deb-mock sbuild integration
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
# Add the current directory to Python path
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from deb_mock.config import Config
|
||||
from deb_mock.sbuild import SbuildWrapper
|
||||
from deb_mock.exceptions import SbuildError
|
||||
|
||||
|
||||
def test_sbuild_integration():
|
||||
"""Test the sbuild integration end-to-end"""
|
||||
print("🧪 Testing deb-mock sbuild integration...")
|
||||
|
||||
# Create test configuration
|
||||
config = Config(
|
||||
chroot_name="debian-trixie-amd64",
|
||||
suite="trixie",
|
||||
architecture="amd64",
|
||||
output_dir="./test-output",
|
||||
verbose=True
|
||||
)
|
||||
|
||||
try:
|
||||
# Initialize sbuild wrapper
|
||||
print("📦 Initializing sbuild wrapper...")
|
||||
wrapper = SbuildWrapper(config)
|
||||
print("✅ Sbuild wrapper initialized successfully")
|
||||
|
||||
# Test chroot info
|
||||
print("\n🔍 Testing chroot info...")
|
||||
chroot_info = wrapper.get_chroot_info()
|
||||
print(f"Chroot info: {chroot_info}")
|
||||
|
||||
# Test dependency checking
|
||||
print("\n📋 Testing dependency checking...")
|
||||
test_package = "test-sbuild-package"
|
||||
if os.path.exists(test_package):
|
||||
deps = wrapper.check_dependencies(test_package)
|
||||
print(f"Dependencies: {deps}")
|
||||
|
||||
if not deps["satisfied"] and deps["missing"]:
|
||||
print(f"Missing dependencies: {deps['missing']}")
|
||||
print("Attempting to install missing dependencies...")
|
||||
|
||||
try:
|
||||
wrapper.install_build_dependencies(deps["missing"])
|
||||
print("✅ Dependencies installed successfully")
|
||||
except SbuildError as e:
|
||||
print(f"⚠️ Could not install dependencies: {e}")
|
||||
|
||||
# Test package building (if dependencies are satisfied)
|
||||
print("\n🔨 Testing package building...")
|
||||
if os.path.exists(test_package):
|
||||
try:
|
||||
result = wrapper.build_package(test_package)
|
||||
print(f"Build result: {result}")
|
||||
if result["success"]:
|
||||
print("✅ Package built successfully!")
|
||||
else:
|
||||
print("❌ Package build failed")
|
||||
except SbuildError as e:
|
||||
print(f"⚠️ Package build failed (expected for test): {e}")
|
||||
|
||||
print("\n🎉 Sbuild integration test completed!")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Test failed: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
return False
|
||||
|
||||
|
||||
def test_cli_commands():
|
||||
"""Test the new CLI commands"""
|
||||
print("\n🖥️ Testing CLI commands...")
|
||||
|
||||
try:
|
||||
# Test chroot info command
|
||||
print("Testing chroot-info command...")
|
||||
os.system("python3 -m deb_mock.cli chroot-info debian-trixie-amd64")
|
||||
|
||||
# Test check-deps command
|
||||
print("\nTesting check-deps command...")
|
||||
if os.path.exists("test-sbuild-package"):
|
||||
os.system("python3 -m deb_mock.cli check-deps test-sbuild-package")
|
||||
|
||||
print("✅ CLI command tests completed!")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ CLI test failed: {e}")
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("🚀 Starting deb-mock sbuild integration tests...\n")
|
||||
|
||||
# Run tests
|
||||
success = True
|
||||
success &= test_sbuild_integration()
|
||||
success &= test_cli_commands()
|
||||
|
||||
if success:
|
||||
print("\n🎯 All tests passed! Sbuild integration is working.")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print("\n💥 Some tests failed. Check the output above.")
|
||||
sys.exit(1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue