Skip to content

Commit d9f46d3

Browse files
author
madanadit
committed
Fix unit tests
1 parent cb789ff commit d9f46d3

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesUtils.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ private[spark] object KubernetesUtils {
7272
hostPath = Some(hostPathV)
7373
containerPath = Some(containerPathV)
7474
readOnly = Some(false)
75+
case spec =>
76+
None
7577
}
7678
if (hostPath.isDefined && containerPath.isDefined) {
77-
podBuilder
78-
.withVolumes(new VolumeBuilder()
79+
podBuilder.addToVolumes(new VolumeBuilder()
7980
.withHostPath(new HostPathVolumeSource(hostPath.get))
8081
.withName(s"hostPath-volume-$volumeCount")
8182
.build())

resource-managers/kubernetes/core/src/test/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodFactorySuite.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@ class ExecutorPodFactorySuite extends SparkFunSuite with BeforeAndAfter with Bef
193193
assert(executor.getSpec.getContainers.size() === 1)
194194
assert(executor.getSpec.getContainers.get(0).getVolumeMounts.size() === 1)
195195
assert(executor.getSpec.getContainers.get(0).getVolumeMounts.get(0).getName
196-
=== "hostPath-volume-1")
196+
=== "hostPath-volume-0")
197197
assert(executor.getSpec.getContainers.get(0).getVolumeMounts.get(0)
198198
.getMountPath === "/opt/mount")
199199

200200
assert(executor.getSpec.getVolumes.size() === 1)
201-
assert(executor.getSpec.getVolumes.get(0).getHostPath === "/tmp/mount")
201+
assert(executor.getSpec.getVolumes.get(0).getHostPath.getPath === "/tmp/mount")
202202

203203
checkOwnerReferences(executor, driverPodUid)
204204
}
@@ -214,17 +214,17 @@ class ExecutorPodFactorySuite extends SparkFunSuite with BeforeAndAfter with Bef
214214
assert(executor.getSpec.getContainers.size() === 1)
215215
assert(executor.getSpec.getContainers.get(0).getVolumeMounts.size() === 2)
216216
assert(executor.getSpec.getContainers.get(0).getVolumeMounts.get(0).getName
217-
=== "hostPath-volume-1")
217+
=== "hostPath-volume-0")
218218
assert(executor.getSpec.getContainers.get(0).getVolumeMounts.get(1).getName
219-
=== "hostPath-volume-2")
219+
=== "hostPath-volume-1")
220220
assert(executor.getSpec.getContainers.get(0).getVolumeMounts.get(0)
221221
.getMountPath === "/opt/mount1")
222222
assert(executor.getSpec.getContainers.get(0).getVolumeMounts.get(1)
223223
.getMountPath === "/opt/mount2")
224224

225225
assert(executor.getSpec.getVolumes.size() === 2)
226-
assert(executor.getSpec.getVolumes.get(0).getHostPath === "/tmp/mount1")
227-
assert(executor.getSpec.getVolumes.get(1).getHostPath === "/tmp/mount2")
226+
assert(executor.getSpec.getVolumes.get(0).getHostPath.getPath === "/tmp/mount1")
227+
assert(executor.getSpec.getVolumes.get(1).getHostPath.getPath === "/tmp/mount2")
228228

229229
checkOwnerReferences(executor, driverPodUid)
230230
}

0 commit comments

Comments
 (0)