Repository: kubeflow/training-operator (language: python)

Issue:
Should we update MPIJob unit test CleanPodPolicy field?
Current MPIJob's unit test uses cleanPodPolicy field to test the gc logic. However, this is duplicate and in training-operator framework, runPolicy.cleanPodPolicy is used. So should we update it?
https://github.com/kubeflow/training-operator/blob/master/pkg/controller.v1/mpi/mpijob_controller_test.go#L50
<img width="986" alt="image" src="https://user-images.githubusercontent.com/13050415/159160829-2e705774-3726-42fd-b6c2-bdf467ef9e7d.png">



Discussion / hints:

Fix patch:
diff --git a/pkg/apis/mpi/v1/default.go b/pkg/apis/mpi/v1/default.go
index 81abf4ab4a..0eb97af615 100644
--- a/pkg/apis/mpi/v1/default.go
+++ b/pkg/apis/mpi/v1/default.go
@@ -50,6 +50,11 @@ func SetDefaults_MPIJob(mpiJob *MPIJob) {
 		mpiJob.Spec.CleanPodPolicy = &none
 	}
 
+	if mpiJob.Spec.RunPolicy.CleanPodPolicy == nil {
+		none := common.CleanPodPolicyNone
+		mpiJob.Spec.RunPolicy.CleanPodPolicy = &none
+	}
+
 	// set default to Launcher
 	setDefaultsTypeLauncher(mpiJob.Spec.MPIReplicaSpecs[MPIReplicaTypeLauncher])
 


Test patch:
diff --git a/pkg/controller.v1/mpi/mpijob_controller_test.go b/pkg/controller.v1/mpi/mpijob_controller_test.go
index cb427e091a..52726020a6 100644
--- a/pkg/controller.v1/mpi/mpijob_controller_test.go
+++ b/pkg/controller.v1/mpi/mpijob_controller_test.go
@@ -47,7 +47,9 @@ func newMPIJobCommon(name string, startTime, completionTime *metav1.Time) *kubef
 			Namespace: metav1.NamespaceDefault,
 		},
 		Spec: kubeflow.MPIJobSpec{
-			CleanPodPolicy: &cleanPodPolicyAll,
+			RunPolicy: common.RunPolicy{
+				CleanPodPolicy: &cleanPodPolicyAll,
+			},
 			MPIReplicaSpecs: map[common.ReplicaType]*common.ReplicaSpec{
 				kubeflow.MPIReplicaTypeWorker: {
 					Template: corev1.PodTemplateSpec{