|
1 | 1 | # test case for aggregating status of SparkApplication |
2 | 2 | # case1. SparkApplication with three status items |
| 3 | +# case2. SparkApplication with single status item |
| 4 | +# case3. SparkApplication with no status items |
| 5 | +# case4. SparkApplication with missing attempts fields |
| 6 | +# case5. SparkApplication with missing executorState |
| 7 | +# case6. SparkApplication with missing lastSubmissionAttemptTime |
| 8 | +# case7. SparkApplication with missing terminationTime |
3 | 9 |
|
4 | 10 | name: "SparkApplication with three status items" |
5 | 11 | description: "Test aggregating status of SparkApplication with three status items" |
@@ -114,3 +120,234 @@ statusItems: |
114 | 120 | terminationTime: "2025-10-12T14:12:30Z" |
115 | 121 | operation: AggregateStatus |
116 | 122 | output: |
| 123 | + aggregatedStatus: |
| 124 | + apiVersion: sparkoperator.k8s.io/v1beta2 |
| 125 | + kind: SparkApplication |
| 126 | + metadata: |
| 127 | + name: spark-pi |
| 128 | + namespace: default |
| 129 | + spec: |
| 130 | + type: Java |
| 131 | + mode: cluster |
| 132 | + image: spark:3.5.0 |
| 133 | + imagePullPolicy: Always |
| 134 | + mainClass: org.apache.spark.examples.SparkPi |
| 135 | + mainApplicationFile: local:///opt/spark/examples/jars/spark-examples_2.12-3.5.0.jar |
| 136 | + sparkVersion: "3.5.0" |
| 137 | + sparkUIOptions: |
| 138 | + serviceLabels: |
| 139 | + test-label/v1: "true" |
| 140 | + restartPolicy: |
| 141 | + type: Never |
| 142 | + volumes: |
| 143 | + - name: test-volume |
| 144 | + hostPath: |
| 145 | + path: /tmp |
| 146 | + type: Directory |
| 147 | + driver: |
| 148 | + cores: 2 |
| 149 | + memory: 512m |
| 150 | + labels: |
| 151 | + version: 3.5.0 |
| 152 | + serviceAccount: spark-operator-spark |
| 153 | + volumeMounts: |
| 154 | + - name: test-volume |
| 155 | + mountPath: /tmp |
| 156 | + executor: |
| 157 | + cores: 1 |
| 158 | + instances: 2 |
| 159 | + memory: 1g |
| 160 | + memoryOverhead: 512m |
| 161 | + labels: |
| 162 | + version: 3.5.0 |
| 163 | + volumeMounts: |
| 164 | + - name: test-volume |
| 165 | + mountPath: /tmp |
| 166 | + dynamicAllocation: |
| 167 | + enabled: true |
| 168 | + initialExecutors: 3 |
| 169 | + minExecutors: 3 |
| 170 | + maxExecutors: 10 |
| 171 | + status: |
| 172 | + applicationState: |
| 173 | + state: FAILED |
| 174 | + executionAttempts: 6 |
| 175 | + submissionAttempts: 4 |
| 176 | + lastSubmissionAttemptTime: "2025-10-12T14:10:00Z" |
| 177 | + terminationTime: "2025-10-12T14:12:30Z" |
| 178 | + executorState: |
| 179 | + spark-pi-b5777a99d8b732a7-exec-1: COMPLETED |
| 180 | + spark-pi-b5777a99d8b732a7-exec-2: COMPLETED |
| 181 | + spark-pi-b5777a99d8b732a8-exec-1: RUNNING |
| 182 | + spark-pi-b5777a99d8b732a8-exec-2: RUNNING |
| 183 | + spark-pi-b5777a99d8b732a9-exec-1: FAILED |
| 184 | + spark-pi-b5777a99d8b732a9-exec-2: FAILED |
| 185 | +--- |
| 186 | +name: "SparkApplication with single status item" |
| 187 | +description: "AggregateStatus should directly copy single member status" |
| 188 | +desiredObj: |
| 189 | + apiVersion: sparkoperator.k8s.io/v1beta2 |
| 190 | + kind: SparkApplication |
| 191 | + metadata: |
| 192 | + name: spark-pi |
| 193 | + namespace: default |
| 194 | +statusItems: |
| 195 | + - status: |
| 196 | + applicationState: |
| 197 | + state: RUNNING |
| 198 | + executionAttempts: 2 |
| 199 | + submissionAttempts: 1 |
| 200 | + executorState: |
| 201 | + exec-1: RUNNING |
| 202 | +operation: AggregateStatus |
| 203 | +output: |
| 204 | + aggregatedStatus: |
| 205 | + apiVersion: sparkoperator.k8s.io/v1beta2 |
| 206 | + kind: SparkApplication |
| 207 | + metadata: |
| 208 | + name: spark-pi |
| 209 | + namespace: default |
| 210 | + status: |
| 211 | + applicationState: |
| 212 | + state: RUNNING |
| 213 | + executionAttempts: 2 |
| 214 | + submissionAttempts: 1 |
| 215 | + executorState: |
| 216 | + exec-1: RUNNING |
| 217 | +--- |
| 218 | +name: "SparkApplication with no status items" |
| 219 | +description: "AggregateStatus should return desiredObj unchanged" |
| 220 | +desiredObj: |
| 221 | + apiVersion: sparkoperator.k8s.io/v1beta2 |
| 222 | + kind: SparkApplication |
| 223 | + metadata: |
| 224 | + name: spark-pi |
| 225 | + namespace: default |
| 226 | +operation: AggregateStatus |
| 227 | +output: |
| 228 | + aggregatedStatus: |
| 229 | + apiVersion: sparkoperator.k8s.io/v1beta2 |
| 230 | + kind: SparkApplication |
| 231 | + metadata: |
| 232 | + name: spark-pi |
| 233 | + namespace: default |
| 234 | +--- |
| 235 | +name: "SparkApplication with missing attempts fields" |
| 236 | +description: "AggregateStatus should handle missing executionAttempts and submissionAttempts" |
| 237 | +desiredObj: |
| 238 | + apiVersion: sparkoperator.k8s.io/v1beta2 |
| 239 | + kind: SparkApplication |
| 240 | + metadata: |
| 241 | + name: spark-pi |
| 242 | + namespace: default |
| 243 | +statusItems: |
| 244 | + - status: |
| 245 | + applicationState: |
| 246 | + state: RUNNING |
| 247 | + executionAttempts: 2 |
| 248 | + - status: |
| 249 | + applicationState: |
| 250 | + state: RUNNING |
| 251 | +operation: AggregateStatus |
| 252 | +output: |
| 253 | + aggregatedStatus: |
| 254 | + apiVersion: sparkoperator.k8s.io/v1beta2 |
| 255 | + kind: SparkApplication |
| 256 | + metadata: |
| 257 | + name: spark-pi |
| 258 | + namespace: default |
| 259 | + status: |
| 260 | + applicationState: |
| 261 | + state: RUNNING |
| 262 | + executionAttempts: 2 |
| 263 | + submissionAttempts: 0 |
| 264 | + lastSubmissionAttemptTime: "" |
| 265 | + terminationTime: "" |
| 266 | +--- |
| 267 | +name: "SparkApplication picks latest lastSubmissionAttemptTime" |
| 268 | +description: "AggregateStatus should pick the latest submission attempt time" |
| 269 | +desiredObj: |
| 270 | + apiVersion: sparkoperator.k8s.io/v1beta2 |
| 271 | + kind: SparkApplication |
| 272 | + metadata: |
| 273 | + name: spark-pi |
| 274 | + namespace: default |
| 275 | +statusItems: |
| 276 | + - status: |
| 277 | + lastSubmissionAttemptTime: "2025-10-12T13:00:00Z" |
| 278 | + - status: |
| 279 | + lastSubmissionAttemptTime: "2025-10-12T14:30:00Z" |
| 280 | +operation: AggregateStatus |
| 281 | +output: |
| 282 | + aggregatedStatus: |
| 283 | + apiVersion: sparkoperator.k8s.io/v1beta2 |
| 284 | + kind: SparkApplication |
| 285 | + metadata: |
| 286 | + name: spark-pi |
| 287 | + namespace: default |
| 288 | + status: |
| 289 | + executionAttempts: 0 |
| 290 | + submissionAttempts: 0 |
| 291 | + lastSubmissionAttemptTime: "2025-10-12T14:30:00Z" |
| 292 | + terminationTime: "" |
| 293 | +--- |
| 294 | +name: "SparkApplication picks latest terminationTime" |
| 295 | +description: "AggregateStatus should pick the latest termination time" |
| 296 | +desiredObj: |
| 297 | + apiVersion: sparkoperator.k8s.io/v1beta2 |
| 298 | + kind: SparkApplication |
| 299 | + metadata: |
| 300 | + name: spark-pi |
| 301 | + namespace: default |
| 302 | +statusItems: |
| 303 | + - status: |
| 304 | + terminationTime: "2025-10-12T14:00:00Z" |
| 305 | + - status: |
| 306 | + terminationTime: "2025-10-12T15:45:00Z" |
| 307 | +operation: AggregateStatus |
| 308 | +output: |
| 309 | + aggregatedStatus: |
| 310 | + apiVersion: sparkoperator.k8s.io/v1beta2 |
| 311 | + kind: SparkApplication |
| 312 | + metadata: |
| 313 | + name: spark-pi |
| 314 | + namespace: default |
| 315 | + status: |
| 316 | + executionAttempts: 0 |
| 317 | + submissionAttempts: 0 |
| 318 | + lastSubmissionAttemptTime: "" |
| 319 | + terminationTime: "2025-10-12T15:45:00Z" |
| 320 | +--- |
| 321 | +name: "SparkApplication worst state selected by priority" |
| 322 | +description: "FAILED should override RUNNING and COMPLETED" |
| 323 | +desiredObj: |
| 324 | + apiVersion: sparkoperator.k8s.io/v1beta2 |
| 325 | + kind: SparkApplication |
| 326 | + metadata: |
| 327 | + name: spark-pi |
| 328 | + namespace: default |
| 329 | +statusItems: |
| 330 | + - status: |
| 331 | + applicationState: |
| 332 | + state: COMPLETED |
| 333 | + - status: |
| 334 | + applicationState: |
| 335 | + state: RUNNING |
| 336 | + - status: |
| 337 | + applicationState: |
| 338 | + state: FAILED |
| 339 | +operation: AggregateStatus |
| 340 | +output: |
| 341 | + aggregatedStatus: |
| 342 | + apiVersion: sparkoperator.k8s.io/v1beta2 |
| 343 | + kind: SparkApplication |
| 344 | + metadata: |
| 345 | + name: spark-pi |
| 346 | + namespace: default |
| 347 | + status: |
| 348 | + applicationState: |
| 349 | + state: FAILED |
| 350 | + executionAttempts: 0 |
| 351 | + submissionAttempts: 0 |
| 352 | + lastSubmissionAttemptTime: "" |
| 353 | + terminationTime: "" |
0 commit comments