Commit b02461b
feat: Add integration test for service_tier with openai client (#5103)
# What does this PR do?
<!-- Provide a short summary of what this PR does and why. Link to
relevant issues if applicable. -->
<!-- If resolving an issue, uncomment and update the line below -->
Related to #4817
## Test Plan
<!-- Describe the tests you ran to verify your changes with result
summaries. *Provide clear instructions so the plan can be easily
re-executed.* -->
```console
(llama-stack) gualiu@gualiu-mac llama-stack % pytest -s -v tests/integration/responses/test_openai_responses.py --stack-config=server:ci-tests --inference-mode record-if-missing -k "service_tier" --setup=gpt --suite=responses --color=yes --embedding-model=sentence-transformers/nomic-ai/nomic-embed-text-v1.5 --color=yes --capture=tee-sys
================================================================== test session starts ==================================================================
platform darwin -- Python 3.12.7, pytest-8.4.2, pluggy-1.6.0 -- /Users/gualiu/go/src/github.com/llamastack/llama-stack/.venv/bin/python3
cachedir: .pytest_cache
metadata: {'Python': '3.12.7', 'Platform': 'macOS-26.3.1-arm64-arm-64bit', 'Packages': {'pytest': '8.4.2', 'pluggy': '1.6.0'}, 'Plugins': {'anyio': '4.9.0', 'html': '4.1.1', 'socket': '0.7.0', 'asyncio': '1.1.0', 'json-report': '1.5.0', 'timeout': '2.4.0', 'metadata': '3.1.1', 'cov': '6.2.1', 'nbval': '0.11.0'}}
rootdir: /Users/gualiu/go/src/github.com/llamastack/llama-stack
configfile: pyproject.toml
plugins: anyio-4.9.0, html-4.1.1, socket-0.7.0, asyncio-1.1.0, json-report-1.5.0, timeout-2.4.0, metadata-3.1.1, cov-6.2.1, nbval-0.11.0
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collected 37 items / 26 deselected / 11 selected
tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_auto[txt=openai/gpt-4o]
instantiating llama_stack_client
Starting llama stack server with config 'ci-tests' on port 8321...
Waiting for server at http://localhost:8321... (0.0s elapsed)
Waiting for server at http://localhost:8321... (0.5s elapsed)
Server is ready at http://localhost:8321
llama_stack_client instantiated in 2.560s
PASSED [ 9%]
tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier[txt=openai/gpt-4o-default] PASSED [ 18%]
tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_flex[txt=openai/gpt-4o] PASSED [ 27%]
tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_auto_streaming[txt=openai/gpt-4o] PASSED [ 36%]
tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_streaming[txt=openai/gpt-4o-default] PASSED [ 45%]
tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_flex_streaming[txt=openai/gpt-4o] PASSED [ 54%]
tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_auto_and_previous_response[txt=openai/gpt-4o] PASSED [ 63%]
tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_and_previous_response[txt=openai/gpt-4o-default] PASSED [ 72%]
tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier[txt=openai/gpt-4o-priority] PASSED [ 81%]
tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_streaming[txt=openai/gpt-4o-priority] PASSED [ 90%]
tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_and_previous_response[txt=openai/gpt-4o-priority] PASSED [100%]Terminating llama stack server process...
Terminating process 82632 and its group...
Server process and children terminated gracefully
================================================================= slowest 10 durations ==================================================================
2.58s setup tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_auto[txt=openai/gpt-4o]
0.24s teardown tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_and_previous_response[txt=openai/gpt-4o-priority]
0.14s call tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_auto[txt=openai/gpt-4o]
0.01s call tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_auto_streaming[txt=openai/gpt-4o]
0.01s call tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_streaming[txt=openai/gpt-4o-default]
0.01s call tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_streaming[txt=openai/gpt-4o-priority]
0.01s call tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_auto_and_previous_response[txt=openai/gpt-4o]
0.01s call tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_and_previous_response[txt=openai/gpt-4o-default]
0.01s call tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier_and_previous_response[txt=openai/gpt-4o-priority]
0.01s call tests/integration/responses/test_openai_responses.py::TestOpenAIResponses::test_openai_response_with_service_tier[txt=openai/gpt-4o-default]
===================================================== 11 passed, 26 deselected, 2 warnings in 3.08s =====================================================
```
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>1 parent 85b0481 commit b02461b
16 files changed
Lines changed: 17100 additions & 4 deletions
File tree
- docs/docs/api-openai
- tests/integration/responses
- recordings
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
973 | 973 | | |
974 | 974 | | |
975 | 975 | | |
976 | | - | |
| 976 | + | |
977 | 977 | | |
978 | 978 | | |
979 | 979 | | |
| |||
988 | 988 | | |
989 | 989 | | |
990 | 990 | | |
991 | | - | |
| 991 | + | |
992 | 992 | | |
993 | 993 | | |
994 | 994 | | |
| |||
0 commit comments