Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/e2e/default_multi_worker_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright The Lightning AI team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import litserve as ls

if __name__ == "__main__":
api = ls.test_examples.SimpleLitAPI()
server = ls.LitServer(api, workers_per_device=2)
server.run(port=8000)
7 changes: 7 additions & 0 deletions tests/e2e/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ def test_e2e_default_api():
assert resp.json() == {"output": 16.0}, "tests/simple_server.py didn't return expected output"


@e2e_from_file("tests/e2e/default_multi_worker_api.py")
def test_e2e_default_multi_worker_api():
resp = requests.post("http://127.0.0.1:8000/predict", json={"input": 4.0}, headers=None)
assert resp.status_code == 200, f"Expected response to be 200 but got {resp.status_code}"
assert resp.json() == {"output": 16.0}, "tests/e2e/default_multi_worker_api.py didn't return expected output"


@e2e_from_file("tests/e2e/default_spec.py")
def test_e2e_default_spec(openai_request_data):
resp = requests.post("http://127.0.0.1:8000/v1/chat/completions", json=openai_request_data)
Expand Down
Loading