Skip to content

Commit 4ff8316

Browse files
[Refactor] Improve developer experience of API server e2e-test (#3466)
* refactor: Simplify the API server launch logic Signed-off-by: jiangjiawei1103 <waynechuang97@gmail.com> * docs: Polish help msg of local-e2e-test Signed-off-by: jiangjiawei1103 <waynechuang97@gmail.com> * docs: Structure apiserver installation with Helm Signed-off-by: jiangjiawei1103 <waynechuang97@gmail.com> * docs: Update the API server setup Signed-off-by: jiangjiawei1103 <waynechuang97@gmail.com> * docs: Run apiserver smoke test with a health check endpoint Signed-off-by: jiangjiawei1103 <waynechuang97@gmail.com> * docs: Add notes for rebuilding and reploying API server Signed-off-by: jiangjiawei1103 <waynechuang97@gmail.com> * docs: Teardown the existing API server deployment Signed-off-by: jiangjiawei1103 <waynechuang97@gmail.com> * fix: Solve md lint Signed-off-by: jiangjiawei1103 <waynechuang97@gmail.com> --------- Signed-off-by: jiangjiawei1103 <waynechuang97@gmail.com> Signed-off-by: 江家瑋 <36886416+JiangJiaWei1103@users.noreply.github.com>
1 parent 52e330b commit 4ff8316

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

apiserver/DEVELOPMENT.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,28 @@ This will create or update mock files.
7878

7979
#### End to End Testing
8080

81-
There are two `make` targets provide execute the end to end test (integration between Kuberay API server and Kuberay Operator):
81+
There are two `make` targets provided to execute the end to end test (integration between Kuberay API server and Kuberay Operator):
82+
83+
* `make e2e-test` executes all the tests defined in the [test/e2e package](./test/e2e/). It uses the cluster defined in `~/.kube/config` to submit the workloads. Please make sure you have done the following before running `make e2e-test`:
84+
1. Install the KubeRay Operator into the cluster by running `make operator-image load-operator-image deploy-operator`
85+
2. Install the KubeRay API server into the cluster by running `make install`
86+
3. Verify the setup with a smoke test `curl -I localhost:31888/healthz`, and you should see a response like:
87+
88+
```bash
89+
> curl -I localhost:31888/healthz
90+
HTTP/1.1 200 OK
91+
Date: Tue, 29 Apr 2025 12:36:05 GMT
92+
```
93+
94+
> [!NOTE]
95+
> Please rerun `make uninstall && make install` whenever you make changes to the `apiserver/` codebase to ensure the KubeRay API server is rebuilt and redeployed properly. Alternatively, you can simply run `make start-local-apiserver` to spin up the API server within the kind cluster in one single command.
8296
83-
* `make e2e-test` executes all the tests defined in the [test/e2e package](./test/e2e/). It uses the cluster defined in `~/.kube/config` to submit the workloads. Please make sure you have done the following before running this:
84-
1. Install the KubeRay Operator into the cluster by `make operator-image load-operator-image deploy-operator`
85-
2. Apiserver is running (see [Build](#build))
86-
3. Set the `E2E_API_SERVER_URL` environment variable with value `http://localhost:8888`, as the local apiserver will be listening on port `8888`
8797
* `make local-e2e-test` creates a local kind cluster, builds the Kuberay operator and API server images from the current branch and deploys the operator and API server into the kind cluster. It shuts down the kind cluster upon successful execution of the end to end test. If the tests fail the cluster will be left running and will have to manually be shutdown by executing the `make clean-cluster`
8898

8999
The `e2e` test targets use two variables to control what version of Ray images to use in the end to end tests:
90100

91101
* `E2E_API_SERVER_RAY_IMAGE` -- for the ray docker image. Currently set to `rayproject/ray:2.9.0-py310`. On Apple silicon or arm64 development machines the `-aarch64` suffix is added to the image.
92-
* `E2E_API_SERVER_URL` -- for the base URL of the deployed KubeRayAPI server. The default value is: `http://localhost:31888`
102+
* `E2E_API_SERVER_URL` -- for the base URL of the deployed KubeRay API server. The default value is: `http://localhost:31888`
93103

94104
The end to end test targets share the usage of the `GO_TEST_FLAGS`. Overriding the make file variable with a `-v` option allows for both unit and end to end tests to print any output / debug messages. By default, only if there's a test failure those messages are shown.
95105

apiserver/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ help: ## Display this help.
5757
##@ Deployment
5858

5959
.PHONY: start-local-apiserver
60-
start-local-apiserver: operator-image cluster load-operator-image deploy-operator install run ## Build and start apiserver from scratch.
60+
start-local-apiserver: operator-image cluster load-operator-image deploy-operator install ## Build and start apiserver from scratch.
6161

6262
.PHONY: clear-local-apiserver
6363
clear-local-apiserver: clean-cluster ## Clear local apiserver.
@@ -110,8 +110,8 @@ test: fmt vet fumpt imports generate ## Run all unit tests.
110110
e2e-test: ## Run end to end tests using a pre-exiting cluster.
111111
go test ./test/e2e/... $(GO_TEST_FLAGS) -timeout 60m -race -coverprofile ray-kube-api-server-e2e-coverage.out -count=1 -parallel 4
112112

113-
.PHONY: local-e2e-test ## Run end to end tests on newly created cluster.
114-
local-e2e-test: operator-image cluster load-operator-image deploy-operator install load-ray-test-image e2e-test clean-cluster ## Run end to end tests, create a fresh kind cluster will all components deployed.
113+
.PHONY: local-e2e-test
114+
local-e2e-test: start-local-apiserver load-ray-test-image e2e-test clean-cluster ## Run end to end tests on a newly created kind cluster with all components deployed.
115115

116116
##@ Testing Setup
117117
KIND_CONFIG ?= hack/kind-cluster-config.yaml

apiserver/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ curl --silent -X 'GET' \
3838
-H 'accept: application/json'
3939
```
4040

41-
### Helm
41+
### Install with Helm
4242

4343
Make sure the version of Helm is v3+. Currently, [existing CI tests](https://github.com/ray-project/kuberay/blob/master/.github/workflows/helm-lint.yaml) are based on Helm v3.4.1 and v3.9.4.
4444

4545
```sh
4646
helm version
4747
```
4848

49-
### Install KubeRay Operator
49+
#### Install KubeRay Operator
5050

5151
- Install a stable version via Helm repository (only supports KubeRay v0.4.0+)
5252

@@ -63,7 +63,7 @@ helm version
6363
# kuberay-operator-7456c6b69b-t6pt7 1/1 Running 0 172m
6464
```
6565

66-
### Install KubeRay APIServer
66+
#### Install KubeRay APIServer
6767

6868
```text
6969
Please note that examples show here will only work with the nightly builds of the api-server. `v1.0.0` does not yet contain critical fixes
@@ -110,7 +110,7 @@ to the api server that would allow Kuberay Serve endpoints to work properly
110110
make docker-image cluster load-image deploy
111111
```
112112

113-
### List the chart
113+
#### List the chart
114114

115115
To list the deployments:
116116

@@ -121,7 +121,7 @@ helm ls
121121
# kuberay-operator default 1 2023-09-25 10:41:48.355831 +0300 EEST deployed kuberay-operator-1.0.0
122122
```
123123

124-
### Uninstall the Chart
124+
#### Uninstall the Chart
125125

126126
```sh
127127
# Uninstall the `kuberay-apiserver` release

0 commit comments

Comments
 (0)