fix: replace E2E test heredoc with echo commands in integration-tests.yml
INTEGRATION TESTS YAML FIX: Resolve line 292 YAML syntax error Issues Fixed: ❌ yaml: line 292: could not find expected ':' ❌ E2E test heredoc causing YAML parsing issues ❌ Multi-line Python script content being parsed as YAML ❌ Workflow config file invalid Root Cause: - Remaining heredoc syntax in E2E test section - YAML parser failing on multi-line content - Need to convert all heredocs to echo commands Solution Applied: ✅ Replaced E2E test heredoc with echo commands ✅ Line-by-line Python script creation for E2E tests ✅ Proper YAML syntax for E2E test section ✅ Maintained complete E2E test functionality Implementation Changes: - Removed E2E test heredoc syntax completely - Used echo commands for each Python line - Proper shell escaping for quotes and JSON structures - Line-by-line file construction Generated Content: - Complete E2E test script - Blockchain operations testing functions - API endpoint testing functions - End-to-end workflow validation logic Impact: - YAML file now validates completely - E2E test creation works properly - Complete YAML syntax validation achieved - Workflow config file is now valid - CI/CD execution without syntax errors This resolves the final YAML syntax error in integration-tests.yml and makes the workflow ready for CI/CD execution.
This commit is contained in:
@@ -288,57 +288,55 @@ jobs:
|
|||||||
echo "Testing blockchain operations..."
|
echo "Testing blockchain operations..."
|
||||||
|
|
||||||
# Create E2E test script
|
# Create E2E test script
|
||||||
cat > test_e2e.py << 'EOF'
|
echo 'import requests' > test_e2e.py
|
||||||
import requests
|
echo 'import json' >> test_e2e.py
|
||||||
import json
|
echo 'import time' >> test_e2e.py
|
||||||
import time
|
echo '' >> test_e2e.py
|
||||||
|
echo 'def test_blockchain_operations():' >> test_e2e.py
|
||||||
def test_blockchain_operations():
|
echo ' try:' >> test_e2e.py
|
||||||
try:
|
echo ' # Get latest block' >> test_e2e.py
|
||||||
# Get latest block
|
echo ' payload = {' >> test_e2e.py
|
||||||
payload = {
|
echo ' "jsonrpc": "2.0",' >> test_e2e.py
|
||||||
"jsonrpc": "2.0",
|
echo ' "method": "eth_getBlockByNumber",' >> test_e2e.py
|
||||||
"method": "eth_getBlockByNumber",
|
echo ' "params": ["latest", False],' >> test_e2e.py
|
||||||
"params": ["latest", False],
|
echo ' "id": 1' >> test_e2e.py
|
||||||
"id": 1
|
echo ' }' >> test_e2e.py
|
||||||
}
|
echo ' response = requests.post('"'"'http://localhost:8545'"'"', json=payload, timeout=5)' >> test_e2e.py
|
||||||
response = requests.post('http://localhost:8545', json=payload, timeout=5)
|
echo ' if response.status_code == 200:' >> test_e2e.py
|
||||||
if response.status_code == 200:
|
echo ' block = response.json().get('"'"'result'"'"', {})' >> test_e2e.py
|
||||||
block = response.json().get('result', {})
|
echo ' print(f"✅ Latest block: {block.get('"'"'number'"'"', '"'"'Unknown'"'"')}")' >> test_e2e.py
|
||||||
print(f"✅ Latest block: {block.get('number', 'Unknown')}")
|
echo ' return True' >> test_e2e.py
|
||||||
return True
|
echo ' except Exception as e:' >> test_e2e.py
|
||||||
except Exception as e:
|
echo ' print(f"❌ Blockchain operations error: {e}")' >> test_e2e.py
|
||||||
print(f"❌ Blockchain operations error: {e}")
|
echo ' return False' >> test_e2e.py
|
||||||
return False
|
echo '' >> test_e2e.py
|
||||||
|
echo 'def test_api_endpoints():' >> test_e2e.py
|
||||||
def test_api_endpoints():
|
echo ' try:' >> test_e2e.py
|
||||||
try:
|
echo ' # Test API health' >> test_e2e.py
|
||||||
# Test API health
|
echo ' response = requests.get('"'"'http://localhost:8000/'"'"', timeout=5)' >> test_e2e.py
|
||||||
response = requests.get('http://localhost:8000/', timeout=5)
|
echo ' if response.status_code == 200:' >> test_e2e.py
|
||||||
if response.status_code == 200:
|
echo ' print("✅ API health check passed")' >> test_e2e.py
|
||||||
print("✅ API health check passed")
|
echo ' return True' >> test_e2e.py
|
||||||
return True
|
echo ' except Exception as e:' >> test_e2e.py
|
||||||
except Exception as e:
|
echo ' print(f"❌ API endpoints error: {e}")' >> test_e2e.py
|
||||||
print(f"❌ API endpoints error: {e}")
|
echo ' return False' >> test_e2e.py
|
||||||
return False
|
echo '' >> test_e2e.py
|
||||||
|
echo 'if __name__ == "__main__":' >> test_e2e.py
|
||||||
if __name__ == "__main__":
|
echo ' print("🔄 Running end-to-end workflow tests...")' >> test_e2e.py
|
||||||
print("🔄 Running end-to-end workflow tests...")
|
echo ' ' >> test_e2e.py
|
||||||
|
echo ' results = []' >> test_e2e.py
|
||||||
results = []
|
echo ' results.append(test_blockchain_operations())' >> test_e2e.py
|
||||||
results.append(test_blockchain_operations())
|
echo ' results.append(test_api_endpoints())' >> test_e2e.py
|
||||||
results.append(test_api_endpoints())
|
echo ' ' >> test_e2e.py
|
||||||
|
echo ' success_count = sum(results)' >> test_e2e.py
|
||||||
success_count = sum(results)
|
echo ' total_count = len(results)' >> test_e2e.py
|
||||||
total_count = len(results)
|
echo ' ' >> test_e2e.py
|
||||||
|
echo ' print(f"\n📊 E2E Results: {success_count}/{total_count} workflows working")' >> test_e2e.py
|
||||||
print(f"\n📊 E2E Results: {success_count}/{total_count} workflows working")
|
echo ' ' >> test_e2e.py
|
||||||
|
echo ' if success_count == total_count:' >> test_e2e.py
|
||||||
if success_count == total_count:
|
echo ' print("✅ All end-to-end workflows successful")' >> test_e2e.py
|
||||||
print("✅ All end-to-end workflows successful")
|
echo ' else:' >> test_e2e.py
|
||||||
else:
|
echo ' print("⚠️ Some workflows not working properly")' >> test_e2e.py
|
||||||
print("⚠️ Some workflows not working properly")
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Run E2E test
|
# Run E2E test
|
||||||
python test_e2e.py
|
python test_e2e.py
|
||||||
|
|||||||
Reference in New Issue
Block a user