From 06857d108df072790e50fbfdb8b70e4e80a8b02a Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 30 Aug 2024 17:02:24 -0700 Subject: [PATCH] fix /spend logs call --- .circleci/config.yml | 2 +- tests/pass_through_tests/test_vertex_ai.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6a99d2a449..bddba054af 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -251,7 +251,7 @@ jobs: command: | pwd ls - python -m pytest -vv tests/ -x --junitxml=test-results/junit.xml --durations=5 --ignore=tests/otel_tests --ignore=tests/pass_through_tests + python -m pytest -s -vv tests/ -x --junitxml=test-results/junit.xml --durations=5 --ignore=tests/otel_tests --ignore=tests/pass_through_tests no_output_timeout: 120m # Store test results diff --git a/tests/pass_through_tests/test_vertex_ai.py b/tests/pass_through_tests/test_vertex_ai.py index 0b980b3342..675557098f 100644 --- a/tests/pass_through_tests/test_vertex_ai.py +++ b/tests/pass_through_tests/test_vertex_ai.py @@ -10,6 +10,7 @@ import tempfile import json import os import pytest +import asyncio # Path to your service account JSON file @@ -59,13 +60,13 @@ def load_vertex_ai_credentials(): async def call_spend_logs_endpoint(): """ Call this - curl -X GET "http://0.0.0.0:4000/spend/logs?start_date={}" -H "Authorization: Bearer sk-1234" + curl -X GET "http://0.0.0.0:4000/spend/logs" -H "Authorization: Bearer sk-1234" """ import datetime import requests todays_date = datetime.datetime.now().strftime("%Y-%m-%d") - url = f"http://0.0.0.0:4000/spend/logs?start_date={todays_date}" + url = f"http://0.0.0.0:4000/global/spend/logs" headers = {"Authorization": f"Bearer sk-1234"} response = requests.get(url, headers=headers) print("response from call_spend_logs_endpoint", response) @@ -91,6 +92,7 @@ async def test_basic_vertex_ai_pass_through_with_spendlog(): print("response", response) + await asyncio.sleep(3) _spend_logs_response = await call_spend_logs_endpoint() print("spend logs response", _spend_logs_response)