@@ -56,7 +56,11 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
56
56
.endStatus()
57
57
.build()
58
58
private var baseConf : SparkConf = _
59
- // private var sc: SparkContext = mock(classOf[SparkContext])
59
+
60
+ private val nodeAffinityExecutorPodModifier = mock(classOf [NodeAffinityExecutorPodModifier ])
61
+ when(nodeAffinityExecutorPodModifier.addNodeAffinityAnnotationIfUseful(
62
+ any(classOf [Pod ]),
63
+ any(classOf [Map [String , Int ]]))).thenAnswer(AdditionalAnswers .returnsFirstArg())
60
64
61
65
before {
62
66
SparkContext .clearActiveContext()
@@ -65,14 +69,13 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
65
69
.set(KUBERNETES_DRIVER_POD_NAME , driverPodName)
66
70
.set(KUBERNETES_EXECUTOR_POD_NAME_PREFIX , executorPrefix)
67
71
.set(EXECUTOR_DOCKER_IMAGE , executorImage)
68
- // sc = new SparkContext("local", "test")
69
72
}
70
73
private var kubernetesClient : KubernetesClient = _
71
74
72
75
test(" basic executor pod has reasonable defaults" ) {
73
76
val factory = new ExecutorPodFactoryImpl (
74
77
baseConf,
75
- NodeAffinityExecutorPodModifierImpl ,
78
+ nodeAffinityExecutorPodModifier ,
76
79
None ,
77
80
None ,
78
81
None ,
@@ -108,7 +111,7 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
108
111
" loremipsumdolorsitametvimatelitrefficiendisuscipianturvixlegeresple" )
109
112
110
113
val factory = new ExecutorPodFactoryImpl (
111
- conf, NodeAffinityExecutorPodModifierImpl , None , None , None , None , None )
114
+ conf, nodeAffinityExecutorPodModifier , None , None , None , None , None )
112
115
val executor = factory.createExecutorPod(
113
116
" 1" , " dummy" , " dummy" , Seq [(String , String )](), driverPod, Map [String , Int ]())
114
117
@@ -121,7 +124,7 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
121
124
val secretsBootstrap = new MountSecretsBootstrapImpl (Map (" secret1" -> " /var/secret1" ))
122
125
val factory = new ExecutorPodFactoryImpl (
123
126
conf,
124
- NodeAffinityExecutorPodModifierImpl ,
127
+ nodeAffinityExecutorPodModifier ,
125
128
Some (secretsBootstrap),
126
129
None ,
127
130
None ,
@@ -157,7 +160,7 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
157
160
158
161
val factory = new ExecutorPodFactoryImpl (
159
162
conf,
160
- NodeAffinityExecutorPodModifierImpl ,
163
+ nodeAffinityExecutorPodModifier ,
161
164
None ,
162
165
None ,
163
166
Some (initContainerBootstrap),
@@ -205,7 +208,7 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
205
208
206
209
val factory = new ExecutorPodFactoryImpl (
207
210
conf,
208
- NodeAffinityExecutorPodModifierImpl ,
211
+ nodeAffinityExecutorPodModifier ,
209
212
None ,
210
213
None ,
211
214
None ,
@@ -229,7 +232,7 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
229
232
230
233
val factory = new ExecutorPodFactoryImpl (
231
234
conf,
232
- NodeAffinityExecutorPodModifierImpl ,
235
+ nodeAffinityExecutorPodModifier ,
233
236
None ,
234
237
Some (smallFiles),
235
238
None ,
@@ -259,7 +262,7 @@ class ExecutorPodFactoryImplSuite extends SparkFunSuite with BeforeAndAfter {
259
262
conf.set(org.apache.spark.internal.config.EXECUTOR_CLASS_PATH , " bar=baz" )
260
263
261
264
val factory = new ExecutorPodFactoryImpl (
262
- conf, NodeAffinityExecutorPodModifierImpl , None , None , None , None , None )
265
+ conf, nodeAffinityExecutorPodModifier , None , None , None , None , None )
263
266
val executor = factory.createExecutorPod(
264
267
" 1" , " dummy" , " dummy" , Seq [(String , String )](" qux" -> " quux" ), driverPod, Map [String , Int ]())
265
268
0 commit comments