remove emojis from console
This commit is contained in:
@@ -27,7 +27,7 @@ if os.path.exists(static_path):
|
||||
app.mount("/static", StaticFiles(directory=static_path), name="static")
|
||||
# Serve index.html at root for dashboard
|
||||
app.mount("/", StaticFiles(directory=static_path, html=True), name="dashboard")
|
||||
🚀 To access the dashboard:
|
||||
To access the dashboard:
|
||||
Start the application: python COBY/main.py --debug
|
||||
Open browser: Navigate to http://localhost:8080/
|
||||
API health check: http://localhost:8080/health
|
||||
@@ -77,7 +77,7 @@ COBY/
|
||||
└── README.md
|
||||
```
|
||||
|
||||
## 🚀 Features
|
||||
## Features
|
||||
|
||||
- **Multi-Exchange Support**: Connect to 10+ major cryptocurrency exchanges
|
||||
- **Real-Time Data**: High-frequency order book and trade data collection
|
||||
|
||||
@@ -15,7 +15,7 @@ This directory contains Docker Compose configurations and scripts for deploying
|
||||
- At least 4GB RAM available for containers
|
||||
- 50GB+ disk space for data storage
|
||||
|
||||
## 🚀 Quick Start
|
||||
## Quick Start
|
||||
|
||||
1. **Copy environment file**:
|
||||
```bash
|
||||
@@ -264,7 +264,7 @@ For issues related to:
|
||||
- Redis: Check [Redis docs](https://redis.io/documentation)
|
||||
- Docker: Check [Docker docs](https://docs.docker.com/)
|
||||
|
||||
## 🔄 Updates
|
||||
## Updates
|
||||
|
||||
This infrastructure supports:
|
||||
- Rolling updates with zero downtime
|
||||
|
||||
@@ -32,9 +32,9 @@ docker exec market_data_timescaledb pg_dump \
|
||||
> "$BACKUP_DIR/timescaledb_backup_$TIMESTAMP.dump"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ TimescaleDB backup completed: timescaledb_backup_$TIMESTAMP.dump"
|
||||
echo " TimescaleDB backup completed: timescaledb_backup_$TIMESTAMP.dump"
|
||||
else
|
||||
echo "❌ TimescaleDB backup failed"
|
||||
echo " TimescaleDB backup failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -52,9 +52,9 @@ sleep 5
|
||||
docker cp market_data_redis:/data/redis_backup_$TIMESTAMP.rdb "$BACKUP_DIR/"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ Redis backup completed: redis_backup_$TIMESTAMP.rdb"
|
||||
echo " Redis backup completed: redis_backup_$TIMESTAMP.rdb"
|
||||
else
|
||||
echo "❌ Redis backup failed"
|
||||
echo " Redis backup failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -88,7 +88,7 @@ rm "$BACKUP_DIR/timescaledb_backup_$TIMESTAMP.dump"
|
||||
rm "$BACKUP_DIR/redis_backup_$TIMESTAMP.rdb"
|
||||
rm "$BACKUP_DIR/backup_$TIMESTAMP.info"
|
||||
|
||||
echo "✅ Compressed backup created: market_data_backup_$TIMESTAMP.tar.gz"
|
||||
echo " Compressed backup created: market_data_backup_$TIMESTAMP.tar.gz"
|
||||
|
||||
# Clean up old backups
|
||||
echo "🧹 Cleaning up old backups (older than $RETENTION_DAYS days)..."
|
||||
@@ -102,7 +102,7 @@ echo " File: market_data_backup_$TIMESTAMP.tar.gz"
|
||||
echo " Size: $BACKUP_SIZE"
|
||||
echo " Location: $BACKUP_DIR"
|
||||
echo ""
|
||||
echo "🔄 To restore from this backup:"
|
||||
echo " To restore from this backup:"
|
||||
echo " ./restore.sh market_data_backup_$TIMESTAMP.tar.gz"
|
||||
echo ""
|
||||
echo "✅ Backup process completed successfully!"
|
||||
echo " Backup process completed successfully!"
|
||||
@@ -14,7 +14,7 @@ echo "📡 Testing connection to TimescaleDB..."
|
||||
PGPASSWORD="market_data_secure_pass_2024" psql -h 192.168.0.10 -p 5432 -U market_user -d market_data -c "SELECT version();"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ Connection successful!"
|
||||
echo " Connection successful!"
|
||||
|
||||
echo "🏗️ Creating database schema..."
|
||||
|
||||
@@ -22,16 +22,16 @@ if [ $? -eq 0 ]; then
|
||||
PGPASSWORD="market_data_secure_pass_2024" psql -h 192.168.0.10 -p 5432 -U market_user -d market_data -f ../docker/init-scripts/01-init-timescaledb.sql
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ Database schema initialized successfully!"
|
||||
echo " Database schema initialized successfully!"
|
||||
|
||||
echo "📊 Verifying tables..."
|
||||
PGPASSWORD="market_data_secure_pass_2024" psql -h 192.168.0.10 -p 5432 -U market_user -d market_data -c "\dt market_data.*"
|
||||
|
||||
else
|
||||
echo "❌ Schema initialization failed"
|
||||
echo " Schema initialization failed"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "❌ Cannot connect to database"
|
||||
echo " Cannot connect to database"
|
||||
exit 1
|
||||
fi
|
||||
@@ -7,7 +7,7 @@ set -e
|
||||
|
||||
# Check if backup file is provided
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "❌ Usage: $0 <backup_file.tar.gz>"
|
||||
echo " Usage: $0 <backup_file.tar.gz>"
|
||||
echo "Available backups:"
|
||||
ls -la ./backups/market_data_backup_*.tar.gz 2>/dev/null || echo "No backups found"
|
||||
exit 1
|
||||
@@ -22,12 +22,12 @@ if [ -f .env ]; then
|
||||
source .env
|
||||
fi
|
||||
|
||||
echo "🔄 Starting restore process..."
|
||||
echo " Starting restore process..."
|
||||
echo "📁 Backup file: $BACKUP_FILE"
|
||||
|
||||
# Check if backup file exists
|
||||
if [ ! -f "$BACKUP_FILE" ]; then
|
||||
echo "❌ Backup file not found: $BACKUP_FILE"
|
||||
echo " Backup file not found: $BACKUP_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -44,7 +44,7 @@ REDIS_BACKUP=$(find "$RESTORE_DIR" -name "redis_backup_*.rdb" | head -1)
|
||||
BACKUP_INFO=$(find "$RESTORE_DIR" -name "backup_*.info" | head -1)
|
||||
|
||||
if [ -z "$TIMESCALE_BACKUP" ] || [ -z "$REDIS_BACKUP" ]; then
|
||||
echo "❌ Invalid backup file structure"
|
||||
echo " Invalid backup file structure"
|
||||
rm -rf "$RESTORE_DIR"
|
||||
exit 1
|
||||
fi
|
||||
@@ -57,10 +57,10 @@ if [ -f "$BACKUP_INFO" ]; then
|
||||
fi
|
||||
|
||||
# Confirm restore
|
||||
read -p "⚠️ This will replace all existing data. Continue? (y/N): " -n 1 -r
|
||||
read -p " This will replace all existing data. Continue? (y/N): " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo "❌ Restore cancelled"
|
||||
echo " Restore cancelled"
|
||||
rm -rf "$RESTORE_DIR"
|
||||
exit 1
|
||||
fi
|
||||
@@ -85,7 +85,7 @@ sleep 30
|
||||
|
||||
# Check if TimescaleDB is ready
|
||||
if ! docker exec market_data_timescaledb pg_isready -U market_user -d market_data; then
|
||||
echo "❌ TimescaleDB is not ready"
|
||||
echo " TimescaleDB is not ready"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -105,9 +105,9 @@ docker exec market_data_timescaledb pg_restore \
|
||||
/tmp/restore.dump
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ TimescaleDB restore completed"
|
||||
echo " TimescaleDB restore completed"
|
||||
else
|
||||
echo "❌ TimescaleDB restore failed"
|
||||
echo " TimescaleDB restore failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -136,7 +136,7 @@ echo "🔍 Verifying restore..."
|
||||
|
||||
# Check TimescaleDB
|
||||
if docker exec market_data_timescaledb pg_isready -U market_user -d market_data; then
|
||||
echo "✅ TimescaleDB is ready"
|
||||
echo " TimescaleDB is ready"
|
||||
|
||||
# Show table counts
|
||||
echo "📊 Database table counts:"
|
||||
@@ -150,19 +150,19 @@ if docker exec market_data_timescaledb pg_isready -U market_user -d market_data;
|
||||
ORDER BY tablename;
|
||||
"
|
||||
else
|
||||
echo "❌ TimescaleDB verification failed"
|
||||
echo " TimescaleDB verification failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check Redis
|
||||
if docker exec market_data_redis redis-cli -a "$REDIS_PASSWORD" ping | grep -q PONG; then
|
||||
echo "✅ Redis is ready"
|
||||
echo " Redis is ready"
|
||||
|
||||
# Show Redis info
|
||||
echo "📦 Redis database info:"
|
||||
docker exec market_data_redis redis-cli -a "$REDIS_PASSWORD" INFO keyspace
|
||||
else
|
||||
echo "❌ Redis verification failed"
|
||||
echo " Redis verification failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -178,7 +178,7 @@ echo " Source: $BACKUP_FILE"
|
||||
echo " Timestamp: $TIMESTAMP"
|
||||
echo " Safety backup: ./backups/pre_restore_$TIMESTAMP/"
|
||||
echo ""
|
||||
echo "⚠️ If you encounter any issues, you can restore the safety backup:"
|
||||
echo " If you encounter any issues, you can restore the safety backup:"
|
||||
echo " docker-compose -f timescaledb-compose.yml down"
|
||||
echo " docker volume rm market_data_timescale_data market_data_redis_data"
|
||||
echo " docker volume create market_data_timescale_data"
|
||||
|
||||
@@ -50,22 +50,22 @@ class BinanceExample:
|
||||
|
||||
def on_status_changed(self, exchange, status):
|
||||
"""Handle status changes"""
|
||||
logger.info(f"🔄 {exchange} status changed to: {status.value}")
|
||||
logger.info(f" {exchange} status changed to: {status.value}")
|
||||
|
||||
async def run_example(self):
|
||||
"""Run the example"""
|
||||
try:
|
||||
logger.info("🚀 Starting Binance connector example")
|
||||
logger.info(" Starting Binance connector example")
|
||||
|
||||
# Connect to Binance
|
||||
logger.info("🔌 Connecting to Binance...")
|
||||
connected = await self.connector.connect()
|
||||
|
||||
if not connected:
|
||||
logger.error("❌ Failed to connect to Binance")
|
||||
logger.error(" Failed to connect to Binance")
|
||||
return
|
||||
|
||||
logger.info("✅ Connected to Binance successfully")
|
||||
logger.info(" Connected to Binance successfully")
|
||||
|
||||
# Get available symbols
|
||||
logger.info("📋 Getting available symbols...")
|
||||
@@ -94,12 +94,12 @@ class BinanceExample:
|
||||
if 'BTCUSDT' in symbols:
|
||||
await self.connector.subscribe_orderbook('BTCUSDT')
|
||||
await self.connector.subscribe_trades('BTCUSDT')
|
||||
logger.info("✅ Subscribed to BTCUSDT order book and trades")
|
||||
logger.info(" Subscribed to BTCUSDT order book and trades")
|
||||
|
||||
# Subscribe to ETH order book
|
||||
if 'ETHUSDT' in symbols:
|
||||
await self.connector.subscribe_orderbook('ETHUSDT')
|
||||
logger.info("✅ Subscribed to ETHUSDT order book")
|
||||
logger.info(" Subscribed to ETHUSDT order book")
|
||||
|
||||
# Let it run for a while
|
||||
logger.info("⏳ Collecting data for 30 seconds...")
|
||||
@@ -111,7 +111,7 @@ class BinanceExample:
|
||||
logger.info(f" 📊 Order books received: {self.orderbook_count}")
|
||||
logger.info(f" 💰 Trades received: {self.trade_count}")
|
||||
logger.info(f" 📡 Total messages: {stats['message_count']}")
|
||||
logger.info(f" ❌ Errors: {stats['error_count']}")
|
||||
logger.info(f" Errors: {stats['error_count']}")
|
||||
logger.info(f" 🔗 Active streams: {stats['active_streams']}")
|
||||
logger.info(f" 📋 Subscriptions: {list(stats['subscriptions'].keys())}")
|
||||
|
||||
@@ -126,12 +126,12 @@ class BinanceExample:
|
||||
await self.connector.unsubscribe_orderbook('ETHUSDT')
|
||||
|
||||
await self.connector.disconnect()
|
||||
logger.info("✅ Disconnected successfully")
|
||||
logger.info(" Disconnected successfully")
|
||||
|
||||
except KeyboardInterrupt:
|
||||
logger.info("⏹️ Interrupted by user")
|
||||
except Exception as e:
|
||||
logger.error(f"❌ Example failed: {e}")
|
||||
logger.error(f" Example failed: {e}")
|
||||
finally:
|
||||
# Ensure cleanup
|
||||
try:
|
||||
@@ -164,5 +164,5 @@ if __name__ == "__main__":
|
||||
except KeyboardInterrupt:
|
||||
print("\n👋 Example stopped by user")
|
||||
except Exception as e:
|
||||
print(f"\n❌ Example failed: {e}")
|
||||
print(f"\n Example failed: {e}")
|
||||
sys.exit(1)
|
||||
@@ -78,11 +78,11 @@ class MultiExchangeManager:
|
||||
# Report results
|
||||
for i, (name, result) in enumerate(zip(self.connectors.keys(), results)):
|
||||
if isinstance(result, Exception):
|
||||
logger.error(f"❌ Failed to connect to {name}: {result}")
|
||||
logger.error(f" Failed to connect to {name}: {result}")
|
||||
elif result:
|
||||
logger.info(f"✅ Connected to {name}")
|
||||
logger.info(f" Connected to {name}")
|
||||
else:
|
||||
logger.warning(f"⚠️ Connection to {name} returned False")
|
||||
logger.warning(f" Connection to {name} returned False")
|
||||
|
||||
async def _connect_exchange(self, name: str, connector) -> bool:
|
||||
"""Connect to a single exchange."""
|
||||
@@ -111,7 +111,7 @@ class MultiExchangeManager:
|
||||
# Small delay between subscriptions
|
||||
await asyncio.sleep(0.5)
|
||||
else:
|
||||
logger.warning(f"⚠️ {name} not connected, skipping {symbol}")
|
||||
logger.warning(f" {name} not connected, skipping {symbol}")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error subscribing to {symbol} on {name}: {e}")
|
||||
@@ -152,7 +152,7 @@ class MultiExchangeManager:
|
||||
for name, connector in self.connectors.items():
|
||||
try:
|
||||
await connector.disconnect()
|
||||
logger.info(f"✅ Disconnected from {name}")
|
||||
logger.info(f" Disconnected from {name}")
|
||||
except Exception as e:
|
||||
logger.error(f"Error disconnecting from {name}: {e}")
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ def check_health():
|
||||
health_data = response.json()
|
||||
|
||||
# Basic health check passed
|
||||
print(f"✅ API Health Check: PASSED")
|
||||
print(f" API Health Check: PASSED")
|
||||
print(f" Status: {health_data.get('status', 'unknown')}")
|
||||
print(f" Timestamp: {health_data.get('timestamp', 'unknown')}")
|
||||
|
||||
@@ -30,30 +30,30 @@ def check_health():
|
||||
|
||||
for component, status in components.items():
|
||||
if status.get('healthy', False):
|
||||
print(f"✅ {component}: HEALTHY")
|
||||
print(f" {component}: HEALTHY")
|
||||
else:
|
||||
print(f"❌ {component}: UNHEALTHY - {status.get('error', 'unknown error')}")
|
||||
print(f" {component}: UNHEALTHY - {status.get('error', 'unknown error')}")
|
||||
all_healthy = False
|
||||
|
||||
if all_healthy:
|
||||
print("\n🎉 Overall Health: HEALTHY")
|
||||
return 0
|
||||
else:
|
||||
print("\n⚠️ Overall Health: DEGRADED")
|
||||
print("\n Overall Health: DEGRADED")
|
||||
return 1
|
||||
|
||||
else:
|
||||
print(f"❌ API Health Check: FAILED (HTTP {response.status_code})")
|
||||
print(f" API Health Check: FAILED (HTTP {response.status_code})")
|
||||
return 1
|
||||
|
||||
except requests.exceptions.ConnectionError:
|
||||
print("❌ API Health Check: FAILED (Connection refused)")
|
||||
print(" API Health Check: FAILED (Connection refused)")
|
||||
return 1
|
||||
except requests.exceptions.Timeout:
|
||||
print("❌ API Health Check: FAILED (Timeout)")
|
||||
print(" API Health Check: FAILED (Timeout)")
|
||||
return 1
|
||||
except Exception as e:
|
||||
print(f"❌ API Health Check: FAILED ({str(e)})")
|
||||
print(f" API Health Check: FAILED ({str(e)})")
|
||||
return 1
|
||||
|
||||
def check_websocket():
|
||||
@@ -67,14 +67,14 @@ def check_websocket():
|
||||
sock.close()
|
||||
|
||||
if result == 0:
|
||||
print("✅ WebSocket Server: ACCESSIBLE")
|
||||
print(" WebSocket Server: ACCESSIBLE")
|
||||
return True
|
||||
else:
|
||||
print("❌ WebSocket Server: NOT ACCESSIBLE")
|
||||
print(" WebSocket Server: NOT ACCESSIBLE")
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ WebSocket Server: ERROR ({str(e)})")
|
||||
print(f" WebSocket Server: ERROR ({str(e)})")
|
||||
return False
|
||||
|
||||
def main():
|
||||
@@ -94,10 +94,10 @@ def main():
|
||||
print("🎉 COBY System: FULLY HEALTHY")
|
||||
return 0
|
||||
elif api_healthy:
|
||||
print("⚠️ COBY System: PARTIALLY HEALTHY (API only)")
|
||||
print(" COBY System: PARTIALLY HEALTHY (API only)")
|
||||
return 1
|
||||
else:
|
||||
print("❌ COBY System: UNHEALTHY")
|
||||
print(" COBY System: UNHEALTHY")
|
||||
return 1
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -148,7 +148,7 @@ async def main():
|
||||
print("🎉 All tests passed! COBY system should work correctly.")
|
||||
return 0
|
||||
else:
|
||||
print("❌ Some tests failed. Please check the issues above.")
|
||||
print(" Some tests failed. Please check the issues above.")
|
||||
return 1
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -33,9 +33,9 @@ async def test_database_connection():
|
||||
# Test health check
|
||||
is_healthy = await manager.health_check()
|
||||
if is_healthy:
|
||||
logger.info("✅ Database connection: HEALTHY")
|
||||
logger.info(" Database connection: HEALTHY")
|
||||
else:
|
||||
logger.error("❌ Database connection: UNHEALTHY")
|
||||
logger.error(" Database connection: UNHEALTHY")
|
||||
return False
|
||||
|
||||
# Test storage stats
|
||||
@@ -49,7 +49,7 @@ async def test_database_connection():
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"❌ Database test failed: {e}")
|
||||
logger.error(f" Database test failed: {e}")
|
||||
return False
|
||||
|
||||
|
||||
@@ -80,17 +80,17 @@ async def test_data_storage():
|
||||
# Test storing order book
|
||||
result = await manager.store_orderbook(test_orderbook)
|
||||
if result:
|
||||
logger.info("✅ Order book storage: SUCCESS")
|
||||
logger.info(" Order book storage: SUCCESS")
|
||||
else:
|
||||
logger.error("❌ Order book storage: FAILED")
|
||||
logger.error(" Order book storage: FAILED")
|
||||
return False
|
||||
|
||||
# Test retrieving order book
|
||||
retrieved = await manager.get_latest_orderbook("BTCUSDT", "test_exchange")
|
||||
if retrieved:
|
||||
logger.info(f"✅ Order book retrieval: SUCCESS (mid_price: {retrieved.mid_price})")
|
||||
logger.info(f" Order book retrieval: SUCCESS (mid_price: {retrieved.mid_price})")
|
||||
else:
|
||||
logger.error("❌ Order book retrieval: FAILED")
|
||||
logger.error(" Order book retrieval: FAILED")
|
||||
return False
|
||||
|
||||
# Create test trade
|
||||
@@ -107,16 +107,16 @@ async def test_data_storage():
|
||||
# Test storing trade
|
||||
result = await manager.store_trade(test_trade)
|
||||
if result:
|
||||
logger.info("✅ Trade storage: SUCCESS")
|
||||
logger.info(" Trade storage: SUCCESS")
|
||||
else:
|
||||
logger.error("❌ Trade storage: FAILED")
|
||||
logger.error(" Trade storage: FAILED")
|
||||
return False
|
||||
|
||||
await manager.close()
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"❌ Data storage test failed: {e}")
|
||||
logger.error(f" Data storage test failed: {e}")
|
||||
return False
|
||||
|
||||
|
||||
@@ -144,9 +144,9 @@ async def test_batch_operations():
|
||||
# Test batch storage
|
||||
result = await manager.batch_store_orderbooks(orderbooks)
|
||||
if result == 5:
|
||||
logger.info(f"✅ Batch order book storage: SUCCESS ({result} records)")
|
||||
logger.info(f" Batch order book storage: SUCCESS ({result} records)")
|
||||
else:
|
||||
logger.error(f"❌ Batch order book storage: PARTIAL ({result}/5 records)")
|
||||
logger.error(f" Batch order book storage: PARTIAL ({result}/5 records)")
|
||||
return False
|
||||
|
||||
# Create batch of trades
|
||||
@@ -166,16 +166,16 @@ async def test_batch_operations():
|
||||
# Test batch trade storage
|
||||
result = await manager.batch_store_trades(trades)
|
||||
if result == 10:
|
||||
logger.info(f"✅ Batch trade storage: SUCCESS ({result} records)")
|
||||
logger.info(f" Batch trade storage: SUCCESS ({result} records)")
|
||||
else:
|
||||
logger.error(f"❌ Batch trade storage: PARTIAL ({result}/10 records)")
|
||||
logger.error(f" Batch trade storage: PARTIAL ({result}/10 records)")
|
||||
return False
|
||||
|
||||
await manager.close()
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"❌ Batch operations test failed: {e}")
|
||||
logger.error(f" Batch operations test failed: {e}")
|
||||
return False
|
||||
|
||||
|
||||
@@ -186,31 +186,31 @@ async def test_configuration():
|
||||
try:
|
||||
# Test database configuration
|
||||
db_url = config.get_database_url()
|
||||
logger.info(f"✅ Database URL: {db_url.replace(config.database.password, '***')}")
|
||||
logger.info(f" Database URL: {db_url.replace(config.database.password, '***')}")
|
||||
|
||||
# Test Redis configuration
|
||||
redis_url = config.get_redis_url()
|
||||
logger.info(f"✅ Redis URL: {redis_url.replace(config.redis.password, '***')}")
|
||||
logger.info(f" Redis URL: {redis_url.replace(config.redis.password, '***')}")
|
||||
|
||||
# Test bucket sizes
|
||||
btc_bucket = config.get_bucket_size('BTCUSDT')
|
||||
eth_bucket = config.get_bucket_size('ETHUSDT')
|
||||
logger.info(f"✅ Bucket sizes: BTC=${btc_bucket}, ETH=${eth_bucket}")
|
||||
logger.info(f" Bucket sizes: BTC=${btc_bucket}, ETH=${eth_bucket}")
|
||||
|
||||
# Test configuration dict
|
||||
config_dict = config.to_dict()
|
||||
logger.info(f"✅ Configuration loaded: {len(config_dict)} sections")
|
||||
logger.info(f" Configuration loaded: {len(config_dict)} sections")
|
||||
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"❌ Configuration test failed: {e}")
|
||||
logger.error(f" Configuration test failed: {e}")
|
||||
return False
|
||||
|
||||
|
||||
async def run_all_tests():
|
||||
"""Run all integration tests"""
|
||||
logger.info("🚀 Starting COBY Integration Tests")
|
||||
logger.info(" Starting COBY Integration Tests")
|
||||
logger.info("=" * 50)
|
||||
|
||||
tests = [
|
||||
@@ -228,11 +228,11 @@ async def run_all_tests():
|
||||
result = await test_func()
|
||||
results.append((test_name, result))
|
||||
if result:
|
||||
logger.info(f"✅ {test_name}: PASSED")
|
||||
logger.info(f" {test_name}: PASSED")
|
||||
else:
|
||||
logger.error(f"❌ {test_name}: FAILED")
|
||||
logger.error(f" {test_name}: FAILED")
|
||||
except Exception as e:
|
||||
logger.error(f"❌ {test_name}: ERROR - {e}")
|
||||
logger.error(f" {test_name}: ERROR - {e}")
|
||||
results.append((test_name, False))
|
||||
|
||||
# Summary
|
||||
@@ -244,7 +244,7 @@ async def run_all_tests():
|
||||
total = len(results)
|
||||
|
||||
for test_name, result in results:
|
||||
status = "✅ PASSED" if result else "❌ FAILED"
|
||||
status = " PASSED" if result else " FAILED"
|
||||
logger.info(f"{test_name:20} {status}")
|
||||
|
||||
logger.info(f"\nOverall: {passed}/{total} tests passed")
|
||||
@@ -253,7 +253,7 @@ async def run_all_tests():
|
||||
logger.info("🎉 All tests passed! System is ready.")
|
||||
return True
|
||||
else:
|
||||
logger.error("⚠️ Some tests failed. Check configuration and database connection.")
|
||||
logger.error(" Some tests failed. Check configuration and database connection.")
|
||||
return False
|
||||
|
||||
|
||||
@@ -269,6 +269,6 @@ if __name__ == "__main__":
|
||||
print("The system is ready for the next development phase.")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print("\n❌ Integration tests failed!")
|
||||
print("\n Integration tests failed!")
|
||||
print("Please check the logs and fix any issues before proceeding.")
|
||||
sys.exit(1)
|
||||
@@ -226,10 +226,10 @@ async def test_connector_compatibility():
|
||||
status = connector.get_connection_status()
|
||||
print(f" ✓ Connection status: {status.value}")
|
||||
|
||||
print(f" ✅ {name.upper()} connector passed all tests")
|
||||
print(f" {name.upper()} connector passed all tests")
|
||||
|
||||
except Exception as e:
|
||||
print(f" ❌ {name.upper()} connector failed: {e}")
|
||||
print(f" {name.upper()} connector failed: {e}")
|
||||
|
||||
print("\n=== All Connector Tests Completed ===")
|
||||
return True
|
||||
@@ -278,6 +278,6 @@ if __name__ == "__main__":
|
||||
async def run_all_tests():
|
||||
await test_connector_compatibility()
|
||||
await test_multi_connector_data_flow()
|
||||
print("✅ All connector tests completed successfully")
|
||||
print(" All connector tests completed successfully")
|
||||
|
||||
asyncio.run(run_all_tests())
|
||||
Reference in New Issue
Block a user