test_ods_sync.py
973 Bytes
import requests
import time
BASE_URL = "http://localhost:9500/api"
def test_scheduler_config():
print("[*] Testing scheduler config...")
resp = requests.get(f"{BASE_URL}/etl/scheduler-config?task_id=sync_ods_data")
print(f"Status: {resp.status_code}")
print(f"Response: {resp.json()}")
def test_run_ods_sync():
print("\n[*] Testing manual ODS sync trigger...")
resp = requests.post(f"{BASE_URL}/etl/run-ods")
print(f"Status: {resp.status_code}")
print(f"Response: {resp.json()}")
def test_etl_history():
print("\n[*] Testing ETL history...")
resp = requests.get(f"{BASE_URL}/etl/history?task_id=sync_ods_data")
print(f"Status: {resp.status_code}")
print(f"Response: {resp.json()}")
if __name__ == "__main__":
try:
test_scheduler_config()
test_run_ods_sync()
time.sleep(1) # 等待历史记录写入
test_etl_history()
except Exception as e:
print(f"[X] Test failed: {e}")