1+ #!/usr/bin/env python3
2+ """
3+ Simple test script to verify services can start properly
4+ """
5+
6+ import sys
7+ import os
8+
9+ # Add current directory to Python path for imports
10+ sys .path .insert (0 , os .path .dirname (os .path .abspath (__file__ )))
11+
12+ print ("Testing startup..." )
13+
14+ # Test imports
15+ try :
16+ print ("Testing database imports..." )
17+ from database import DatabaseHelper , Base , List , Bookmark , SyncStatus
18+ print ("✓ Database imports successful" )
19+ except Exception as e :
20+ print (f"✗ Database import failed: { e } " )
21+ sys .exit (1 )
22+
23+ try :
24+ print ("Testing sync_service imports..." )
25+ from sync_service import KaraKeepSync
26+ print ("✓ Sync service imports successful" )
27+ except Exception as e :
28+ print (f"✗ Sync service import failed: { e } " )
29+ sys .exit (1 )
30+
31+ # Test config loading
32+ try :
33+ print ("Testing config loading..." )
34+ config_path = 'config/config.json'
35+ if os .path .exists (config_path ):
36+ import json
37+ with open (config_path , 'r' ) as f :
38+ config = json .load (f )
39+ print (f"✓ Config loaded successfully" )
40+ print (f" KaraKeep URL: { config .get ('karakeepUrl' , 'NOT SET' )} " )
41+ print (f" API Key: { 'SET' if config .get ('apiKey' ) and config ['apiKey' ] != 'YOUR_KARAKEEP_API_KEY_HERE' else 'NOT SET' } " )
42+ else :
43+ print ("✗ Config file not found at config/config.json" )
44+ except Exception as e :
45+ print (f"✗ Config loading failed: { e } " )
46+
47+ # Test database connection
48+ try :
49+ print ("Testing database initialization..." )
50+ db_helper = DatabaseHelper ({'database' : {'path' : '/app/data/test.db' }})
51+ print ("✓ Database initialization successful" )
52+ except Exception as e :
53+ print (f"✗ Database initialization failed: { e } " )
54+
55+ print ("\n All basic tests passed! Services should be able to start." )
0 commit comments