Skip to content

Commit

Permalink
couple more sanity tests
Browse files Browse the repository at this point in the history
extra test in driver builder for sanity
  • Loading branch information
NiharS committed Nov 15, 2018
1 parent e820aa6 commit 8e89465
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ class KubernetesVolumeUtilsSuite extends SparkFunSuite {
KubernetesHostPathVolumeConf("/hostPath"))
}

test("Parses subPath correctly") {
val sparkConf = new SparkConf(false)
sparkConf.set("test.emptyDir.volumeName.mount.path", "/path")
sparkConf.set("test.emptyDir.volumeName.mount.readOnly", "true")
sparkConf.set("test.emptyDir.volumeName.mount.subPath", "subPath")

val volumeSpec = KubernetesVolumeUtils.parseVolumesWithPrefix(sparkConf, "test.").head.get
assert(volumeSpec.volumeName === "volumeName")
assert(volumeSpec.mountPath === "/path")
assert(volumeSpec.mountSubPath === "subPath")
}

test("Parses persistentVolumeClaim volumes correctly") {
val sparkConf = new SparkConf(false)
sparkConf.set("test.persistentVolumeClaim.volumeName.mount.path", "/path")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,39 @@ class KubernetesDriverBuilderSuite extends SparkFunSuite {
DRIVER_CMD_STEP_TYPE)
}

test("Apply volumes step if a mount subpath is present.") {
val volumeSpec = KubernetesVolumeSpec(
"volume",
"/tmp",
"foo",
false,
KubernetesHostPathVolumeConf("/path"))
val conf = KubernetesConf(
new SparkConf(false),
KubernetesDriverSpecificConf(
JavaMainAppResource(None),
"test-app",
"main",
Seq.empty),
"prefix",
"appId",
Map.empty,
Map.empty,
Map.empty,
Map.empty,
Map.empty,
volumeSpec :: Nil,
hadoopConfSpec = None)
validateStepTypesApplied(
builderUnderTest.buildFromFeatures(conf),
BASIC_STEP_TYPE,
CREDENTIALS_STEP_TYPE,
SERVICE_STEP_TYPE,
LOCAL_DIRS_STEP_TYPE,
MOUNT_VOLUMES_STEP_TYPE,
DRIVER_CMD_STEP_TYPE)
}

test("Apply template volume step if executor template is present.") {
val sparkConf = spy(new SparkConf(false))
doReturn(Option("filename")).when(sparkConf)
Expand Down

0 comments on commit 8e89465

Please sign in to comment.