Files
kuberay/ray-operator/controllers/ray/utils/fake_httpproxy_httpclient.go
9c062c5030 Add serving service for users traffic with health check (#367)
* draft for serving service

* add http proxy health check and http proxy service

* address comments

* add unit tests

* fix ut

* update ut

* update

* address comment and add TODO

Co-authored-by: Bruce Zhang <[email protected]>
2022-07-11 17:05:59 -07:00

33 lines
632 B
Go

package utils
import (
"fmt"
"net/http"
"time"
)
func GetFakeRayHttpProxyClient() RayHttpProxyClientInterface {
return &FakeRayHttpProxyClient{}
}
type FakeRayHttpProxyClient struct {
client http.Client
httpProxyURL string
}
func (r *FakeRayHttpProxyClient) InitClient() {
r.client = http.Client{
Timeout: 20 * time.Millisecond,
}
}
func (r *FakeRayHttpProxyClient) SetHostIp(hostIp string) {
r.httpProxyURL = fmt.Sprint("http://", hostIp, ":", DefaultHttpProxyPort)
}
func (r *FakeRayHttpProxyClient) CheckHealth() error {
// TODO: test check return error cases.
// Always return successful.
return nil
}