Skip to content

Commit 0c4e2ae

Browse files
astefanuttiopenshift-merge-robot
authored andcommitted
test: Add step log statements
1 parent 6553bfd commit 0c4e2ae

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

test/e2e/mnist_pytorch_mcad_job_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ func TestMNISTPyTorchMCAD(t *testing.T) {
5858
}
5959
mnistScript, err = test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Create(test.Ctx(), mnistScript, metav1.CreateOptions{})
6060
test.Expect(err).NotTo(HaveOccurred())
61+
test.T().Logf("Created ConfigMap %s/%s successfully", mnistScript.Namespace, mnistScript.Name)
6162

6263
// pip requirements
6364
requirements := &corev1.ConfigMap{
@@ -80,6 +81,7 @@ torchvision==0.12.0
8081
}
8182
requirements, err = test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Create(test.Ctx(), requirements, metav1.CreateOptions{})
8283
test.Expect(err).NotTo(HaveOccurred())
84+
test.T().Logf("Created ConfigMap %s/%s successfully", requirements.Namespace, requirements.Name)
8385

8486
// Batch Job
8587
job := &batchv1.Job{
@@ -174,10 +176,13 @@ torchvision==0.12.0
174176

175177
_, err = test.Client().MCAD().ArbV1().AppWrappers(namespace.Name).Create(aw)
176178
test.Expect(err).NotTo(HaveOccurred())
179+
test.T().Logf("Created MCAD %s/%s successfully", aw.Namespace, aw.Name)
177180

181+
test.T().Logf("Waiting for MCAD %s/%s to be running", aw.Namespace, aw.Name)
178182
test.Eventually(AppWrapper(test, namespace, aw.Name), TestTimeoutMedium).
179183
Should(WithTransform(AppWrapperState, Equal(mcadv1beta1.AppWrapperStateActive)))
180184

185+
test.T().Logf("Waiting for Job %s/%s to complete successfully", job.Namespace, job.Name)
181186
test.Eventually(Job(test, namespace, job.Name), TestTimeoutLong).
182187
Should(WithTransform(ConditionStatus(batchv1.JobComplete), Equal(corev1.ConditionTrue)))
183188

@@ -191,5 +196,6 @@ torchvision==0.12.0
191196
test.Expect(pods).To(HaveLen(1))
192197

193198
// Print the job logs
199+
test.T().Logf("Printing Job %s/%s logs", job.Namespace, job.Name)
194200
test.T().Log(GetPodLogs(test, &pods[0], corev1.PodLogOptions{}))
195201
}

test/e2e/mnist_rayjob_mcad_raycluster_test.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestMNISTRayJobMCADRayCluster(t *testing.T) {
4242
mnist, err := scripts.ReadFile("mnist.py")
4343
test.Expect(err).NotTo(HaveOccurred())
4444

45-
configMap := &corev1.ConfigMap{
45+
mnistScript := &corev1.ConfigMap{
4646
TypeMeta: metav1.TypeMeta{
4747
APIVersion: corev1.SchemeGroupVersion.String(),
4848
Kind: "ConfigMap",
@@ -56,8 +56,9 @@ func TestMNISTRayJobMCADRayCluster(t *testing.T) {
5656
},
5757
Immutable: Ptr(true),
5858
}
59-
configMap, err = test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Create(test.Ctx(), configMap, metav1.CreateOptions{})
59+
mnistScript, err = test.Client().Core().CoreV1().ConfigMaps(namespace.Name).Create(test.Ctx(), mnistScript, metav1.CreateOptions{})
6060
test.Expect(err).NotTo(HaveOccurred())
61+
test.T().Logf("Created ConfigMap %s/%s successfully", mnistScript.Namespace, mnistScript.Name)
6162

6263
// RayCluster
6364
rayCluster := &rayv1alpha1.RayCluster{
@@ -126,7 +127,7 @@ func TestMNISTRayJobMCADRayCluster(t *testing.T) {
126127
VolumeSource: corev1.VolumeSource{
127128
ConfigMap: &corev1.ConfigMapVolumeSource{
128129
LocalObjectReference: corev1.LocalObjectReference{
129-
Name: configMap.Name,
130+
Name: mnistScript.Name,
130131
},
131132
},
132133
},
@@ -212,9 +213,11 @@ func TestMNISTRayJobMCADRayCluster(t *testing.T) {
212213
},
213214
}
214215

215-
_, err = test.Client().MCAD().ArbV1().AppWrappers(namespace.Name).Create(aw)
216+
aw, err = test.Client().MCAD().ArbV1().AppWrappers(namespace.Name).Create(aw)
216217
test.Expect(err).NotTo(HaveOccurred())
218+
test.T().Logf("Created MCAD %s/%s successfully", aw.Namespace, aw.Name)
217219

220+
test.T().Logf("Waiting for MCAD %s/%s to be running", aw.Namespace, aw.Name)
218221
test.Eventually(AppWrapper(test, namespace, aw.Name), TestTimeoutMedium).
219222
Should(WithTransform(AppWrapperState, Equal(mcadv1beta1.AppWrapperStateActive)))
220223

@@ -249,12 +252,15 @@ func TestMNISTRayJobMCADRayCluster(t *testing.T) {
249252
}
250253
rayJob, err = test.Client().Ray().RayV1alpha1().RayJobs(namespace.Name).Create(test.Ctx(), rayJob, metav1.CreateOptions{})
251254
test.Expect(err).NotTo(HaveOccurred())
255+
test.T().Logf("Created RayJob %s/%s successfully", rayJob.Namespace, rayJob.Name)
252256

257+
test.T().Logf("Waiting for RayJob %s/%s to complete successfully", rayJob.Namespace, rayJob.Name)
253258
test.Eventually(RayJob(test, namespace, rayJob.Name), TestTimeoutLong).
254259
Should(WithTransform(RayJobStatus, Equal(rayv1alpha1.JobStatusSucceeded)))
255260

256261
rayJob, err = test.Client().Ray().RayV1alpha1().RayJobs(namespace.Name).Get(test.Ctx(), rayJob.Name, metav1.GetOptions{})
257262
test.Expect(err).NotTo(HaveOccurred())
258263

264+
test.T().Logf("Printing RayJob %s/%s logs", rayJob.Namespace, rayJob.Name)
259265
test.T().Log(GetRayJobLogs(test, rayJob))
260266
}

0 commit comments

Comments
 (0)