fix(conformance): enable healthz test in full Kubeflow. (#9297)
* Enable healthz test in full Kubeflow. This change will also be ported to release-2.0-alpha branch to support conformance tests for KF 1.7, which is using alpha.7 version of KFP. * Fix build break due to recent refactoring.
This commit is contained in:
parent
2d8bcdf3f1
commit
2cfc4283d2
|
|
@ -17,6 +17,7 @@ package api_server
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
apiclient "github.com/kubeflow/pipelines/backend/api/v1beta1/go_http_client/healthz_client"
|
||||
params "github.com/kubeflow/pipelines/backend/api/v1beta1/go_http_client/healthz_client/healthz_service"
|
||||
|
|
@ -31,7 +32,8 @@ type HealthzInterface interface {
|
|||
}
|
||||
|
||||
type HealthzClient struct {
|
||||
apiClient *apiclient.Healthz
|
||||
apiClient *apiclient.Healthz
|
||||
authInfoWriter runtime.ClientAuthInfoWriter
|
||||
}
|
||||
|
||||
func NewHealthzClient(clientConfig clientcmd.ClientConfig, debug bool) (*HealthzClient, error) {
|
||||
|
|
@ -48,6 +50,20 @@ func NewHealthzClient(clientConfig clientcmd.ClientConfig, debug bool) (*Healthz
|
|||
}, nil
|
||||
}
|
||||
|
||||
func NewKubeflowInClusterHealthzClient(namespace string, debug bool) (
|
||||
*HealthzClient, error) {
|
||||
|
||||
runtime := api_server.NewKubeflowInClusterHTTPRuntime(namespace, debug)
|
||||
|
||||
apiClient := apiclient.New(runtime, strfmt.Default)
|
||||
|
||||
// Creating experiment client
|
||||
return &HealthzClient{
|
||||
apiClient: apiClient,
|
||||
authInfoWriter: api_server.SATokenVolumeProjectionAuth,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *HealthzClient) GetHealthz() (*model.APIGetHealthzResponse, error) {
|
||||
parameters := params.NewGetHealthzParamsWithTimeout(api_server.APIServerDefaultTimeout)
|
||||
response, err := c.apiClient.HealthzService.GetHealthz(parameters, api_server.PassThroughAuth)
|
||||
|
|
|
|||
|
|
@ -26,8 +26,9 @@ import (
|
|||
|
||||
type HealthzApiTest struct {
|
||||
suite.Suite
|
||||
namespace string
|
||||
healthzClient *api_server.HealthzClient
|
||||
namespace string
|
||||
resourceNamespace string
|
||||
healthzClient *api_server.HealthzClient
|
||||
}
|
||||
|
||||
// Check the namespace have ML job installed and ready
|
||||
|
|
@ -43,10 +44,27 @@ func (s *HealthzApiTest) SetupTest() {
|
|||
glog.Exitf("Failed to initialize test. Error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
s.namespace = *namespace
|
||||
clientConfig := test.GetClientConfig(*namespace)
|
||||
|
||||
var newHealthzClient func() (*api_server.HealthzClient, error)
|
||||
|
||||
if *isKubeflowMode {
|
||||
s.resourceNamespace = *resourceNamespace
|
||||
|
||||
newHealthzClient = func() (*api_server.HealthzClient, error) {
|
||||
return api_server.NewKubeflowInClusterHealthzClient(s.namespace, *isDebugMode)
|
||||
}
|
||||
} else {
|
||||
clientConfig := test.GetClientConfig(*namespace)
|
||||
|
||||
newHealthzClient = func() (*api_server.HealthzClient, error) {
|
||||
return api_server.NewHealthzClient(clientConfig, *isDebugMode)
|
||||
}
|
||||
}
|
||||
|
||||
var err error
|
||||
s.healthzClient, err = api_server.NewHealthzClient(clientConfig, false)
|
||||
s.healthzClient, err = newHealthzClient()
|
||||
if err != nil {
|
||||
glog.Exitf("Failed to get healthz client. Error: %v", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue