Demonstrates how to test a Ray serve deployment class directly without spinning up a Ray cluster.
The key method: func_or_class
, allows accessing the underlying class directly where normally, the class would be revised to a Ray serve deployment type due to the @serve.deployment
decorator.
Example pattern to test issuing http requests to a mock Ray serve server which includes the deployment under test. Implementing an end to end test asserting the request and response of the server are as expected.
It's suggested to include the conftest.py
in your setup to make injection of the Ray serve resource straightforward. Ray serve internal unit tests are a great reference for how to test these objects.
@bewestphal DAGDriver seems to be removed from Ray Serve as per this ray-project/ray#41243 when I try running
_setup_endpoint
without theDAGDriver
_get_url
fails asroot_url
is not present.