From 9d1a6db6c8452afa938193ac22a8d4bc30bf29c2 Mon Sep 17 00:00:00 2001 From: James Wu <54086668+james-jwu@users.noreply.github.com> Date: Tue, 3 May 2022 13:50:00 -0700 Subject: [PATCH] feat(conformance): adapt pipeline API tests to KF environment (#7647) --- backend/test/integration/pipeline_api_test.go | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/backend/test/integration/pipeline_api_test.go b/backend/test/integration/pipeline_api_test.go index dbe8f328c904..e40b45442ace 100644 --- a/backend/test/integration/pipeline_api_test.go +++ b/backend/test/integration/pipeline_api_test.go @@ -29,6 +29,7 @@ import ( type PipelineApiTest struct { suite.Suite namespace string + resourceNamespace string pipelineClient *api_server.PipelineClient pipelineUploadClient *api_server.PipelineUploadClient } @@ -47,13 +48,36 @@ func (s *PipelineApiTest) SetupTest() { } } s.namespace = *namespace - clientConfig := test.GetClientConfig(*namespace) + + var newPipelineUploadClient func() (*api_server.PipelineUploadClient, error) + var newPipelineClient func() (*api_server.PipelineClient, error) + + if *isKubeflowMode { + s.resourceNamespace = *resourceNamespace + + newPipelineUploadClient = func() (*api_server.PipelineUploadClient, error) { + return api_server.NewKubeflowInClusterPipelineUploadClient(s.namespace, *isDebugMode) + } + newPipelineClient = func() (*api_server.PipelineClient, error) { + return api_server.NewKubeflowInClusterPipelineClient(s.namespace, *isDebugMode) + } + } else { + clientConfig := test.GetClientConfig(*namespace) + + newPipelineUploadClient = func() (*api_server.PipelineUploadClient, error) { + return api_server.NewPipelineUploadClient(clientConfig, *isDebugMode) + } + newPipelineClient = func() (*api_server.PipelineClient, error) { + return api_server.NewPipelineClient(clientConfig, *isDebugMode) + } + } + var err error - s.pipelineUploadClient, err = api_server.NewPipelineUploadClient(clientConfig, false) + s.pipelineUploadClient, err = newPipelineUploadClient() if err != nil { glog.Exitf("Failed to get pipeline upload client. Error: %s", err.Error()) } - s.pipelineClient, err = api_server.NewPipelineClient(clientConfig, false) + s.pipelineClient, err = newPipelineClient() if err != nil { glog.Exitf("Failed to get pipeline client. Error: %s", err.Error()) }