Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 8s
CLI Tests / test-cli (push) Successful in 10s
Contract Performance Benchmarks / benchmark-gas-usage (push) Successful in 1m22s
Contract Performance Benchmarks / benchmark-execution-time (push) Successful in 1m11s
Contract Performance Benchmarks / benchmark-throughput (push) Successful in 1m13s
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Failing after 5s
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 5s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Failing after 3s
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Cross-Node Transaction Testing / transaction-test (push) Successful in 5s
Deploy to Testnet / deploy-testnet (push) Successful in 1m14s
Contract Performance Benchmarks / compare-benchmarks (push) Has been cancelled
Documentation Validation / validate-docs (push) Failing after 10s
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Node Failover Simulation / failover-test (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Smart Contract Tests / test-solidity (map[name:aitbc-contracts path:contracts]) (push) Has been cancelled
Smart Contract Tests / test-solidity (map[name:aitbc-token path:packages/solidity/aitbc-token]) (push) Has been cancelled
Smart Contract Tests / test-foundry (push) Has been cancelled
Smart Contract Tests / lint-solidity (push) Has been cancelled
Smart Contract Tests / deploy-contracts (push) Has been cancelled
Documentation Validation / validate-policies-strict (push) Successful in 3s
Integration Tests / test-service-integration (push) Failing after 45s
Multi-Chain Island Architecture Tests / test-multi-chain-island (push) Failing after 2s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 5s
P2P Network Verification / p2p-verification (push) Successful in 3s
Production Tests / Production Integration Tests (push) Failing after 7s
Python Tests / test-python (push) Failing after 46s
Staking Tests / test-staking-service (push) Failing after 2s
Staking Tests / test-staking-integration (push) Has been skipped
Staking Tests / test-staking-contract (push) Has been skipped
Staking Tests / run-staking-test-runner (push) Has been skipped
Systemd Sync / sync-systemd (push) Successful in 21s
API Endpoint Tests / test-api-endpoints (push) Failing after 12m19s
- Changed pytest calls to use `venv/bin/python -m pytest` with explicit config - Added `--rootdir "$PWD"` and `--import-mode=importlib` for consistent imports - Fixed PYTHONPATH to use absolute paths with $PWD prefix - Added smart contract security scanning for Solidity files - Added Circom circuit security checks for ZK proof circuits - Added ZK proof implementation security validation - Added contracts/** to security scanning workflow
166 lines
4.2 KiB
Python
Executable File
166 lines
4.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Test suite runner for AITBC
|
|
"""
|
|
|
|
import sys
|
|
import argparse
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def resolve_test_path(test_path: str) -> str:
|
|
path = Path(test_path)
|
|
if not path.is_absolute():
|
|
path = REPO_ROOT / path
|
|
return str(path)
|
|
|
|
|
|
def run_command(cmd, description):
|
|
"""Run a command and handle errors"""
|
|
print(f"\n{'='*60}")
|
|
print(f"Running: {description}")
|
|
print(f"Command: {' '.join(cmd)}")
|
|
print('='*60)
|
|
|
|
result = subprocess.run(cmd, capture_output=True, text=True, cwd=REPO_ROOT)
|
|
|
|
if result.stdout:
|
|
print(result.stdout)
|
|
|
|
if result.stderr:
|
|
print("STDERR:", result.stderr)
|
|
|
|
return result.returncode == 0
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description="AITBC Test Suite Runner")
|
|
parser.add_argument(
|
|
"--suite",
|
|
choices=["unit", "integration", "e2e", "security", "all"],
|
|
default="all",
|
|
help="Test suite to run"
|
|
)
|
|
parser.add_argument(
|
|
"--coverage",
|
|
action="store_true",
|
|
help="Generate coverage report"
|
|
)
|
|
parser.add_argument(
|
|
"--parallel",
|
|
action="store_true",
|
|
help="Run tests in parallel"
|
|
)
|
|
parser.add_argument(
|
|
"--verbose",
|
|
action="store_true",
|
|
help="Verbose output"
|
|
)
|
|
parser.add_argument(
|
|
"--marker",
|
|
help="Run tests with specific marker (e.g., unit, integration)"
|
|
)
|
|
parser.add_argument(
|
|
"--file",
|
|
help="Run specific test file"
|
|
)
|
|
|
|
args = parser.parse_args()
|
|
|
|
# Base pytest command
|
|
pytest_cmd = [
|
|
sys.executable,
|
|
"-m",
|
|
"pytest",
|
|
"-c",
|
|
"/dev/null",
|
|
"--rootdir",
|
|
str(REPO_ROOT),
|
|
"--import-mode=importlib",
|
|
]
|
|
|
|
# Add verbosity
|
|
if args.verbose:
|
|
pytest_cmd.append("-v")
|
|
|
|
# Add coverage if requested
|
|
if args.coverage:
|
|
pytest_cmd.extend([
|
|
"--cov=apps",
|
|
"--cov-report=html:htmlcov",
|
|
"--cov-report=term-missing"
|
|
])
|
|
|
|
# Add parallel execution if requested
|
|
if args.parallel:
|
|
pytest_cmd.extend(["-n", "auto"])
|
|
|
|
# Determine which tests to run
|
|
test_paths = []
|
|
|
|
if args.file:
|
|
test_paths.append(resolve_test_path(args.file))
|
|
elif args.marker:
|
|
pytest_cmd.extend(["-m", args.marker])
|
|
elif args.suite == "unit":
|
|
test_paths.append(resolve_test_path("tests/unit/"))
|
|
elif args.suite == "integration":
|
|
test_paths.append(resolve_test_path("tests/integration/"))
|
|
elif args.suite == "e2e":
|
|
test_paths.append(resolve_test_path("tests/e2e/"))
|
|
# E2E tests might need additional setup
|
|
pytest_cmd.extend(["--driver=Chrome"])
|
|
elif args.suite == "security":
|
|
pytest_cmd.extend(["-m", "security"])
|
|
else: # all
|
|
test_paths.append(resolve_test_path("tests/"))
|
|
|
|
# Add test paths to command
|
|
pytest_cmd.extend(test_paths)
|
|
|
|
# Add pytest configuration
|
|
pytest_cmd.extend([
|
|
"--tb=short",
|
|
"--strict-markers",
|
|
"--disable-warnings"
|
|
])
|
|
|
|
# Run the tests
|
|
success = run_command(pytest_cmd, f"{args.suite.title()} Test Suite")
|
|
|
|
if success:
|
|
print(f"\n✅ {args.suite.title()} tests passed!")
|
|
|
|
if args.coverage:
|
|
print("\n📊 Coverage report generated in htmlcov/index.html")
|
|
else:
|
|
print(f"\n❌ {args.suite.title()} tests failed!")
|
|
sys.exit(1)
|
|
|
|
# Additional checks
|
|
if args.suite in ["all", "integration"]:
|
|
print("\n🔍 Running integration test checks...")
|
|
# Add any integration-specific checks here
|
|
|
|
if args.suite in ["all", "e2e"]:
|
|
print("\n🌐 Running E2E test checks...")
|
|
# Add any E2E-specific checks here
|
|
|
|
if args.suite in ["all", "security"]:
|
|
print("\n🔒 Running security scan...")
|
|
# Run security scan
|
|
security_cmd = ["bandit", "-r", "apps/"]
|
|
run_command(security_cmd, "Security Scan")
|
|
|
|
# Run dependency check
|
|
deps_cmd = ["safety", "check"]
|
|
run_command(deps_cmd, "Dependency Security Check")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|