Skip to content

Commit 43a1c6d

Browse files
committed
issue-11979 - WIP - Refactored DAG tests to replace testV2 with test import aliases for consistency and removed unnecessary alias definitions
Signed-off-by: Helber Belmiro <[email protected]>
1 parent de352eb commit 43a1c6d

File tree

3 files changed

+54
-56
lines changed

3 files changed

+54
-56
lines changed

backend/test/v2/integration/dag_status_conditional_test.go

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ import (
3535
"github.com/kubeflow/pipelines/backend/src/common/util"
3636
"github.com/kubeflow/pipelines/backend/src/v2/metadata"
3737
"github.com/kubeflow/pipelines/backend/src/v2/metadata/testutils"
38-
"github.com/kubeflow/pipelines/backend/test"
39-
testV2 "github.com/kubeflow/pipelines/backend/test/v2"
38+
"github.com/kubeflow/pipelines/backend/test/v2"
4039
pb "github.com/kubeflow/pipelines/third_party/ml-metadata/go/ml_metadata"
4140
)
4241

@@ -172,9 +171,9 @@ func (s *DAGStatusConditionalTestSuite) TestSimpleIfTrue() {
172171
// DEBUG: Log upload parameters
173172
uploadParamsObj := uploadParams.NewUploadPipelineParams()
174173
t.Logf("DEBUG: NewUploadPipelineParams() returned: %+v", uploadParamsObj)
175-
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
174+
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
176175
uploadParamsObj.Description, uploadParamsObj.DisplayName, uploadParamsObj.Name, uploadParamsObj.Namespace)
177-
176+
178177
pipeline, err := s.pipelineUploadClient.UploadFile(filePath, uploadParamsObj)
179178

180179
// Detailed error logging
@@ -224,21 +223,21 @@ func (s *DAGStatusConditionalTestSuite) TestSimpleIfFalse() {
224223
// DEBUG: Log upload parameters
225224
uploadParamsObj := uploadParams.NewUploadPipelineParams()
226225
t.Logf("DEBUG: NewUploadPipelineParams() returned: %+v", uploadParamsObj)
227-
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
226+
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
228227
uploadParamsObj.Description, uploadParamsObj.DisplayName, uploadParamsObj.Name, uploadParamsObj.Namespace)
229-
228+
230229
pipeline, err := s.pipelineUploadClient.UploadFile(
231230
"../resources/dag_status/conditional_if_false.yaml",
232231
uploadParamsObj,
233232
)
234-
233+
235234
if err != nil {
236235
t.Logf("DEBUG: UploadFile failed with error: %v", err)
237236
t.Logf("DEBUG: Error type: %T", err)
238237
} else {
239238
t.Logf("DEBUG: UploadFile succeeded, pipeline: %+v", pipeline)
240239
}
241-
240+
242241
require.NoError(t, err)
243242
require.NotNil(t, pipeline)
244243

@@ -269,21 +268,21 @@ func (s *DAGStatusConditionalTestSuite) TestIfElseTrue() {
269268
// DEBUG: Log upload parameters
270269
uploadParamsObj := uploadParams.NewUploadPipelineParams()
271270
t.Logf("DEBUG: NewUploadPipelineParams() returned: %+v", uploadParamsObj)
272-
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
271+
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
273272
uploadParamsObj.Description, uploadParamsObj.DisplayName, uploadParamsObj.Name, uploadParamsObj.Namespace)
274-
273+
275274
pipeline, err := s.pipelineUploadClient.UploadFile(
276275
"../resources/dag_status/conditional_if_else_true.yaml",
277276
uploadParamsObj,
278277
)
279-
278+
280279
if err != nil {
281280
t.Logf("DEBUG: UploadFile failed with error: %v", err)
282281
t.Logf("DEBUG: Error type: %T", err)
283282
} else {
284283
t.Logf("DEBUG: UploadFile succeeded, pipeline: %+v", pipeline)
285284
}
286-
285+
287286
require.NoError(t, err)
288287
require.NotNil(t, pipeline)
289288

@@ -313,21 +312,21 @@ func (s *DAGStatusConditionalTestSuite) TestIfElseFalse() {
313312
// DEBUG: Log upload parameters
314313
uploadParamsObj := uploadParams.NewUploadPipelineParams()
315314
t.Logf("DEBUG: NewUploadPipelineParams() returned: %+v", uploadParamsObj)
316-
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
315+
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
317316
uploadParamsObj.Description, uploadParamsObj.DisplayName, uploadParamsObj.Name, uploadParamsObj.Namespace)
318-
317+
319318
pipeline, err := s.pipelineUploadClient.UploadFile(
320319
"../resources/dag_status/conditional_if_else_false.yaml",
321320
uploadParamsObj,
322321
)
323-
322+
324323
if err != nil {
325324
t.Logf("DEBUG: UploadFile failed with error: %v", err)
326325
t.Logf("DEBUG: Error type: %T", err)
327326
} else {
328327
t.Logf("DEBUG: UploadFile succeeded, pipeline: %+v", pipeline)
329328
}
330-
329+
331330
require.NoError(t, err)
332331
require.NotNil(t, pipeline)
333332

@@ -357,24 +356,24 @@ func (s *DAGStatusConditionalTestSuite) TestComplexConditional() {
357356
// DEBUG: Log upload parameters
358357
uploadParamsObj := uploadParams.NewUploadPipelineParams()
359358
t.Logf("DEBUG: NewUploadPipelineParams() returned: %+v", uploadParamsObj)
360-
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
359+
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
361360
uploadParamsObj.Description, uploadParamsObj.DisplayName, uploadParamsObj.Name, uploadParamsObj.Namespace)
362-
361+
363362
t.Logf("DEBUG: About to call UploadFile with file: ../resources/dag_status/conditional_complex.yaml")
364363
t.Logf("DEBUG: PipelineUploadClient is nil: %v", s.pipelineUploadClient == nil)
365-
364+
366365
pipeline, err := s.pipelineUploadClient.UploadFile(
367366
"../resources/dag_status/conditional_complex.yaml",
368367
uploadParamsObj,
369368
)
370-
369+
371370
if err != nil {
372371
t.Logf("DEBUG: UploadFile failed with error: %v", err)
373372
t.Logf("DEBUG: Error type: %T", err)
374373
} else {
375374
t.Logf("DEBUG: UploadFile succeeded, pipeline: %+v", pipeline)
376375
}
377-
376+
378377
require.NoError(t, err)
379378
require.NotNil(t, pipeline)
380379

@@ -831,9 +830,9 @@ func (s *DAGStatusConditionalTestSuite) TearDownSuite() {
831830

832831
func (s *DAGStatusConditionalTestSuite) cleanUp() {
833832
if s.runClient != nil {
834-
testV2.DeleteAllRuns(s.runClient, s.resourceNamespace, s.T())
833+
test.DeleteAllRuns(s.runClient, s.resourceNamespace, s.T())
835834
}
836835
if s.pipelineClient != nil {
837-
testV2.DeleteAllPipelines(s.pipelineClient, s.T())
836+
test.DeleteAllPipelines(s.pipelineClient, s.T())
838837
}
839838
}

backend/test/v2/integration/dag_status_nested_test.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"github.com/kubeflow/pipelines/backend/src/common/util"
1919
"github.com/kubeflow/pipelines/backend/src/v2/metadata"
2020
"github.com/kubeflow/pipelines/backend/src/v2/metadata/testutils"
21-
testV2 "github.com/kubeflow/pipelines/backend/test/v2"
21+
"github.com/kubeflow/pipelines/backend/test/v2"
2222
pb "github.com/kubeflow/pipelines/third_party/ml-metadata/go/ml_metadata"
2323
)
2424

@@ -40,7 +40,7 @@ func (s *DAGStatusNestedTestSuite) SetupTest() {
4040
}
4141

4242
if !*isDevMode {
43-
err := testV2.WaitForReady(*initializeTimeout)
43+
err := test.WaitForReady(*initializeTimeout)
4444
if err != nil {
4545
s.T().Logf("Failed to initialize test. Error: %s", err.Error())
4646
}
@@ -64,7 +64,7 @@ func (s *DAGStatusNestedTestSuite) SetupTest() {
6464
return apiserver.NewKubeflowInClusterRunClient(s.namespace, *isDebugMode)
6565
}
6666
} else {
67-
clientConfig := testV2.GetClientConfig(*namespace)
67+
clientConfig := test.GetClientConfig(*namespace)
6868

6969
newPipelineUploadClient = func() (*apiserver.PipelineUploadClient, error) {
7070
return apiserver.NewPipelineUploadClient(clientConfig, *isDebugMode)
@@ -107,10 +107,10 @@ func (s *DAGStatusNestedTestSuite) TearDownTest() {
107107

108108
func (s *DAGStatusNestedTestSuite) cleanUp() {
109109
if s.runClient != nil {
110-
testV2.DeleteAllRuns(s.runClient, s.resourceNamespace, s.T())
110+
test.DeleteAllRuns(s.runClient, s.resourceNamespace, s.T())
111111
}
112112
if s.pipelineClient != nil {
113-
testV2.DeleteAllPipelines(s.pipelineClient, s.T())
113+
test.DeleteAllPipelines(s.pipelineClient, s.T())
114114
}
115115
}
116116

@@ -126,21 +126,21 @@ func (s *DAGStatusNestedTestSuite) TestSimpleNested() {
126126
// DEBUG: Log upload parameters
127127
uploadParamsObj := uploadParams.NewUploadPipelineParams()
128128
t.Logf("DEBUG: NewUploadPipelineParams() returned: %+v", uploadParamsObj)
129-
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
129+
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
130130
uploadParamsObj.Description, uploadParamsObj.DisplayName, uploadParamsObj.Name, uploadParamsObj.Namespace)
131-
131+
132132
pipeline, err := s.pipelineUploadClient.UploadFile(
133133
"../resources/dag_status/nested_simple.yaml",
134134
uploadParamsObj,
135135
)
136-
136+
137137
if err != nil {
138138
t.Logf("DEBUG: UploadFile failed with error: %v", err)
139139
t.Logf("DEBUG: Error type: %T", err)
140140
} else {
141141
t.Logf("DEBUG: UploadFile succeeded, pipeline: %+v", pipeline)
142142
}
143-
143+
144144
require.NoError(t, err)
145145
require.NotNil(t, pipeline)
146146
@@ -176,21 +176,21 @@ func (s *DAGStatusNestedTestSuite) TestNestedParallelFor() {
176176
// DEBUG: Log upload parameters
177177
uploadParamsObj := uploadParams.NewUploadPipelineParams()
178178
t.Logf("DEBUG: NewUploadPipelineParams() returned: %+v", uploadParamsObj)
179-
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
179+
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
180180
uploadParamsObj.Description, uploadParamsObj.DisplayName, uploadParamsObj.Name, uploadParamsObj.Namespace)
181-
181+
182182
pipeline, err := s.pipelineUploadClient.UploadFile(
183183
"../resources/dag_status/nested_parallel_for.yaml",
184184
uploadParamsObj,
185185
)
186-
186+
187187
if err != nil {
188188
t.Logf("DEBUG: UploadFile failed with error: %v", err)
189189
t.Logf("DEBUG: Error type: %T", err)
190190
} else {
191191
t.Logf("DEBUG: UploadFile succeeded, pipeline: %+v", pipeline)
192192
}
193-
193+
194194
require.NoError(t, err)
195195
require.NotNil(t, pipeline)
196196
@@ -226,21 +226,21 @@ func (s *DAGStatusNestedTestSuite) TestNestedConditional() {
226226
// DEBUG: Log upload parameters
227227
uploadParamsObj := uploadParams.NewUploadPipelineParams()
228228
t.Logf("DEBUG: NewUploadPipelineParams() returned: %+v", uploadParamsObj)
229-
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
229+
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
230230
uploadParamsObj.Description, uploadParamsObj.DisplayName, uploadParamsObj.Name, uploadParamsObj.Namespace)
231-
231+
232232
pipeline, err := s.pipelineUploadClient.UploadFile(
233233
"../resources/dag_status/nested_conditional.yaml",
234234
uploadParamsObj,
235235
)
236-
236+
237237
if err != nil {
238238
t.Logf("DEBUG: UploadFile failed with error: %v", err)
239239
t.Logf("DEBUG: Error type: %T", err)
240240
} else {
241241
t.Logf("DEBUG: UploadFile succeeded, pipeline: %+v", pipeline)
242242
}
243-
243+
244244
require.NoError(t, err)
245245
require.NotNil(t, pipeline)
246246
@@ -276,21 +276,21 @@ func (s *DAGStatusNestedTestSuite) TestDeepNesting() {
276276
// DEBUG: Log upload parameters
277277
uploadParamsObj := uploadParams.NewUploadPipelineParams()
278278
t.Logf("DEBUG: NewUploadPipelineParams() returned: %+v", uploadParamsObj)
279-
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
279+
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
280280
uploadParamsObj.Description, uploadParamsObj.DisplayName, uploadParamsObj.Name, uploadParamsObj.Namespace)
281-
281+
282282
pipeline, err := s.pipelineUploadClient.UploadFile(
283283
"../resources/dag_status/nested_deep.yaml",
284284
uploadParamsObj,
285285
)
286-
286+
287287
if err != nil {
288288
t.Logf("DEBUG: UploadFile failed with error: %v", err)
289289
t.Logf("DEBUG: Error type: %T", err)
290290
} else {
291291
t.Logf("DEBUG: UploadFile succeeded, pipeline: %+v", pipeline)
292292
}
293-
293+
294294
require.NoError(t, err)
295295
require.NotNil(t, pipeline)
296296

backend/test/v2/integration/dag_status_parallel_for_test.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ import (
3333
"github.com/kubeflow/pipelines/backend/src/common/util"
3434
"github.com/kubeflow/pipelines/backend/src/v2/metadata"
3535
"github.com/kubeflow/pipelines/backend/src/v2/metadata/testutils"
36-
"github.com/kubeflow/pipelines/backend/test"
37-
testV2 "github.com/kubeflow/pipelines/backend/test/v2"
36+
"github.com/kubeflow/pipelines/backend/test/v2"
3837
pb "github.com/kubeflow/pipelines/third_party/ml-metadata/go/ml_metadata"
3938
)
4039

@@ -127,28 +126,28 @@ func (s *DAGStatusParallelForTestSuite) TestSimpleParallelForSuccess() {
127126
// DEBUG: Log upload parameters
128127
uploadParamsObj := uploadParams.NewUploadPipelineParams()
129128
t.Logf("DEBUG: NewUploadPipelineParams() returned: %+v", uploadParamsObj)
130-
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
129+
t.Logf("DEBUG: Upload params fields - Description: %v, DisplayName: %v, Name: %v, Namespace: %v",
131130
uploadParamsObj.Description, uploadParamsObj.DisplayName, uploadParamsObj.Name, uploadParamsObj.Namespace)
132-
131+
133132
t.Logf("DEBUG: About to call UploadFile with file: ../resources/dag_status/parallel_for_success.yaml")
134133
t.Logf("DEBUG: PipelineUploadClient is nil: %v", s.pipelineUploadClient == nil)
135-
134+
136135
pipeline, err := s.pipelineUploadClient.UploadFile(
137136
"../resources/dag_status/parallel_for_success.yaml",
138137
uploadParamsObj,
139138
)
140-
139+
141140
if err != nil {
142141
t.Logf("DEBUG: UploadFile failed with error: %v", err)
143142
t.Logf("DEBUG: Error type: %T", err)
144143
} else {
145144
t.Logf("DEBUG: UploadFile succeeded, pipeline: %+v", pipeline)
146145
}
147-
146+
148147
require.NoError(t, err)
149148
require.NotNil(t, pipeline)
150149

151-
// Upload a pipeline version explicitly like run_api_test.go does
150+
// Upload a pipeline version explicitly like run_api_test.go does
152151
pipelineVersion, err := s.pipelineUploadClient.UploadPipelineVersion(
153152
"../resources/dag_status/parallel_for_success.yaml", &uploadParams.UploadPipelineVersionParams{
154153
Name: util.StringPointer("test-version"),
@@ -182,7 +181,7 @@ func (s *DAGStatusParallelForTestSuite) TestSimpleParallelForFailure() {
182181
require.NoError(t, err)
183182
require.NotNil(t, pipeline)
184183
185-
// Upload a pipeline version explicitly like run_api_test.go does
184+
// Upload a pipeline version explicitly like run_api_test.go does
186185
pipelineVersion, err := s.pipelineUploadClient.UploadPipelineVersion(
187186
"../resources/dag_status/parallel_for_failure.yaml", &uploadParams.UploadPipelineVersionParams{
188187
Name: util.StringPointer("test-version"),
@@ -215,7 +214,7 @@ func (s *DAGStatusParallelForTestSuite) TestDynamicParallelFor() {
215214
require.NoError(t, err)
216215
require.NotNil(t, pipeline)
217216
218-
// Upload a pipeline version explicitly like run_api_test.go does
217+
// Upload a pipeline version explicitly like run_api_test.go does
219218
pipelineVersion, err := s.pipelineUploadClient.UploadPipelineVersion(
220219
"../resources/dag_status/parallel_for_dynamic.yaml", &uploadParams.UploadPipelineVersionParams{
221220
Name: util.StringPointer("test-version"),
@@ -400,9 +399,9 @@ func (s *DAGStatusParallelForTestSuite) TearDownSuite() {
400399

401400
func (s *DAGStatusParallelForTestSuite) cleanUp() {
402401
if s.runClient != nil {
403-
testV2.DeleteAllRuns(s.runClient, s.resourceNamespace, s.T())
402+
test.DeleteAllRuns(s.runClient, s.resourceNamespace, s.T())
404403
}
405404
if s.pipelineClient != nil {
406-
testV2.DeleteAllPipelines(s.pipelineClient, s.T())
405+
test.DeleteAllPipelines(s.pipelineClient, s.T())
407406
}
408407
}

0 commit comments

Comments
 (0)