Skip to content
This repository was archived by the owner on Jan 9, 2020. It is now read-only.

Commit db17357

Browse files
committed
Address issues with multi-line code fragments
1 parent 1bd0384 commit db17357

File tree

1 file changed

+67
-30
lines changed

1 file changed

+67
-30
lines changed

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

Lines changed: 67 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,14 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
6363
private var kubernetesClient: KubernetesClient = _
6464

6565
test("basic executor pod has reasonable defaults") {
66-
val factory = new ExecutorPodFactoryImpl(baseConf,
67-
NodeAffinityExecutorPodModifierImpl, None, None, None, None, None)
66+
val factory = new ExecutorPodFactoryImpl(
67+
baseConf,
68+
NodeAffinityExecutorPodModifierImpl,
69+
None,
70+
None,
71+
None,
72+
None,
73+
None)
6874
val executor = factory.createExecutorPod(
6975
"1", "dummy", "dummy", Seq[(String, String)](), driverPod, Map[String, Int]())
7076

@@ -94,10 +100,10 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
94100
conf.set(KUBERNETES_EXECUTOR_POD_NAME_PREFIX,
95101
"loremipsumdolorsitametvimatelitrefficiendisuscipianturvixlegeresple")
96102

97-
val factory = new ExecutorPodFactoryImpl(conf,
98-
NodeAffinityExecutorPodModifierImpl, None, None, None, None, None)
99-
val executor = factory.createExecutorPod("1",
100-
"dummy", "dummy", Seq[(String, String)](), driverPod, Map[String, Int]())
103+
val factory = new ExecutorPodFactoryImpl(
104+
conf, NodeAffinityExecutorPodModifierImpl, None, None, None, None, None)
105+
val executor = factory.createExecutorPod(
106+
"1", "dummy", "dummy", Seq[(String, String)](), driverPod, Map[String, Int]())
101107

102108
assert(executor.getSpec.getHostname.length == 63)
103109
}
@@ -106,10 +112,16 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
106112
val conf = baseConf.clone()
107113

108114
val secretsBootstrap = new MountSecretsBootstrapImpl(Map("secret1" -> "/var/secret1"))
109-
val factory = new ExecutorPodFactoryImpl(conf,
110-
NodeAffinityExecutorPodModifierImpl, Some(secretsBootstrap), None, None, None, None)
111-
val executor = factory.createExecutorPod("1",
112-
"dummy", "dummy", Seq[(String, String)](), driverPod, Map[String, Int]())
115+
val factory = new ExecutorPodFactoryImpl(
116+
conf,
117+
NodeAffinityExecutorPodModifierImpl,
118+
Some(secretsBootstrap),
119+
None,
120+
None,
121+
None,
122+
None)
123+
val executor = factory.createExecutorPod(
124+
"1", "dummy", "dummy", Seq[(String, String)](), driverPod, Map[String, Int]())
113125

114126
assert(executor.getSpec.getContainers.size() == 1)
115127
assert(executor.getSpec.getContainers.get(0).getVolumeMounts.size() == 1)
@@ -127,12 +139,25 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
127139
test("init-container bootstrap step adds an init container") {
128140
val conf = baseConf.clone()
129141

130-
val initContainerBootstrap = new SparkPodInitContainerBootstrapImpl("init-image",
131-
"IfNotPresent", "/some/path/", "some/other/path", 10, "config-map-name", "config-map-key")
132-
val factory = new ExecutorPodFactoryImpl(conf,
133-
NodeAffinityExecutorPodModifierImpl, None, None, Some(initContainerBootstrap), None, None)
134-
val executor = factory.createExecutorPod("1",
135-
"dummy", "dummy", Seq[(String, String)](), driverPod, Map[String, Int]())
142+
val initContainerBootstrap = new SparkPodInitContainerBootstrapImpl(
143+
"init-image",
144+
"IfNotPresent",
145+
"/some/path/",
146+
"some/other/path",
147+
10,
148+
"config-map-name",
149+
"config-map-key")
150+
151+
val factory = new ExecutorPodFactoryImpl(
152+
conf,
153+
NodeAffinityExecutorPodModifierImpl,
154+
None,
155+
None,
156+
Some(initContainerBootstrap),
157+
None,
158+
None)
159+
val executor = factory.createExecutorPod(
160+
"1", "dummy", "dummy", Seq[(String, String)](), driverPod, Map[String, Int]())
136161

137162
assert(executor.getMetadata.getAnnotations.size() == 1)
138163
assert(executor.getMetadata.getAnnotations.containsKey(constants.INIT_CONTAINER_ANNOTATION))
@@ -149,12 +174,18 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
149174
SparkTransportConf.fromSparkConf(conf, "shuffle"),
150175
sc.env.securityManager,
151176
sc.env.securityManager.isAuthenticationEnabled())
152-
val shuffleManager = new KubernetesExternalShuffleManagerImpl(conf,
153-
kubernetesClient, kubernetesExternalShuffleClient)
154-
val factory = new ExecutorPodFactoryImpl(conf,
155-
NodeAffinityExecutorPodModifierImpl, None, None, None, None, Some(shuffleManager))
156-
val executor = factory.createExecutorPod("1",
157-
"dummy", "dummy", Seq[(String, String)](), driverPod, Map[String, Int]())
177+
val shuffleManager = new KubernetesExternalShuffleManagerImpl(
178+
conf, kubernetesClient, kubernetesExternalShuffleClient)
179+
val factory = new ExecutorPodFactoryImpl(
180+
conf,
181+
NodeAffinityExecutorPodModifierImpl,
182+
None,
183+
None,
184+
None,
185+
None,
186+
Some(shuffleManager))
187+
val executor = factory.createExecutorPod(
188+
"1", "dummy", "dummy", Seq[(String, String)](), driverPod, Map[String, Int]())
158189

159190

160191
assert(executor.getSpec.getContainers.size() == 1)
@@ -169,10 +200,16 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
169200
val conf = baseConf.clone()
170201
val smallFiles = new MountSmallFilesBootstrapImpl("secret1", "/var/secret1")
171202

172-
val factory = new ExecutorPodFactoryImpl(conf,
173-
NodeAffinityExecutorPodModifierImpl, None, Some(smallFiles), None, None, None)
174-
val executor = factory.createExecutorPod("1",
175-
"dummy", "dummy", Seq[(String, String)](), driverPod, Map[String, Int]())
203+
val factory = new ExecutorPodFactoryImpl(
204+
conf,
205+
NodeAffinityExecutorPodModifierImpl,
206+
None,
207+
Some(smallFiles),
208+
None,
209+
None,
210+
None)
211+
val executor = factory.createExecutorPod(
212+
"1", "dummy", "dummy", Seq[(String, String)](), driverPod, Map[String, Int]())
176213

177214

178215
assert(executor.getSpec.getContainers.size() == 1)
@@ -194,10 +231,10 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
194231
conf.set(org.apache.spark.internal.config.EXECUTOR_JAVA_OPTIONS, "foo=bar")
195232
conf.set(org.apache.spark.internal.config.EXECUTOR_CLASS_PATH, "bar=baz")
196233

197-
val factory = new ExecutorPodFactoryImpl(conf,
198-
NodeAffinityExecutorPodModifierImpl, None, None, None, None, None)
199-
val executor = factory.createExecutorPod("1",
200-
"dummy", "dummy", Seq[(String, String)]("qux" -> "quux"), driverPod, Map[String, Int]())
234+
val factory = new ExecutorPodFactoryImpl(
235+
conf, NodeAffinityExecutorPodModifierImpl, None, None, None, None, None)
236+
val executor = factory.createExecutorPod(
237+
"1", "dummy", "dummy", Seq[(String, String)]("qux" -> "quux"), driverPod, Map[String, Int]())
201238

202239
checkEnv(executor, Set("SPARK_JAVA_OPT_0", "SPARK_EXECUTOR_EXTRA_CLASSPATH", "qux"))
203240
checkOwnerReferences(executor, driverPodUid)

0 commit comments

Comments
 (0)