Skip to content

Commit 7371e1d

Browse files
TQJADEdongjoon-hyun
authored andcommitted
[SPARK-49324] Add SparkApplication state transition e2e test
### What changes were proposed in this pull request? Add one state transition test for Spark Applications ### Why are the changes needed? For stablitiy. ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? Test from personal GitHub workflow actions ### Was this patch authored or co-authored using generative AI tooling? n/a Closes apache#97 from TQJADE/state-transition. Authored-by: Qi Tan <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 560b088 commit 7371e1d

File tree

4 files changed

+118
-0
lines changed

4 files changed

+118
-0
lines changed

.github/workflows/build_and_test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ jobs:
7272
test_group:
7373
- spark-versions
7474
- python
75+
- state-transition
7576
steps:
7677
- name: Checkout repository
7778
uses: actions/checkout@v4
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
apiVersion: spark.apache.org/v1alpha1
19+
kind: SparkApplication
20+
metadata:
21+
name: spark-job-succeeded-test
22+
namespace: default
23+
status:
24+
stateTransitionHistory:
25+
(*.currentStateSummary):
26+
- "Submitted"
27+
- "DriverRequested"
28+
- "DriverStarted"
29+
- "DriverReady"
30+
- "RunningHealthy"
31+
- "Succeeded"
32+
- "ResourceReleased"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
apiVersion: chainsaw.kyverno.io/v1alpha1
19+
kind: Test
20+
metadata:
21+
name: spark-operator-spark-application-state-transition-validation
22+
spec:
23+
scenarios:
24+
- bindings:
25+
- name: TEST_NAME
26+
value: succeeded
27+
- name: FILE_NAME
28+
value: spark-example-succeeded.yaml
29+
- name: SPARK_APPLICATION_NAME
30+
value: spark-job-succeeded-test
31+
steps:
32+
- try:
33+
- script:
34+
env:
35+
- name: FILE_NAME
36+
value: ($FILE_NAME)
37+
content: kubectl apply -f $FILE_NAME
38+
- assert:
39+
timeout: 60s
40+
file: "../assertions/spark-application/spark-state-transition.yaml"
41+
catch:
42+
- describe:
43+
apiVersion: spark.apache.org/v1alpha1
44+
kind: SparkApplication
45+
namespace: default
46+
finally:
47+
- script:
48+
env:
49+
- name: SPARK_APPLICATION_NAME
50+
value: ($SPARK_APPLICATION_NAME)
51+
timeout: 30s
52+
content: |
53+
kubectl delete sparkapplication $SPARK_APPLICATION_NAME
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
apiVersion: spark.apache.org/v1alpha1
19+
kind: SparkApplication
20+
metadata:
21+
name: spark-job-succeeded-test
22+
namespace: default
23+
spec:
24+
mainClass: "org.apache.spark.examples.SparkPi"
25+
jars: "local:///opt/spark/examples/jars/spark-examples_2.13-4.0.0-preview1.jar"
26+
sparkConf:
27+
spark.executor.instances: "1"
28+
spark.kubernetes.container.image: "spark:4.0.0-preview1-scala2.13-java17-ubuntu"
29+
spark.kubernetes.authenticate.driver.serviceAccountName: "spark"
30+
runtimeVersions:
31+
sparkVersion: 4.0.0-preview1
32+
scalaVersion: "2.13"

0 commit comments

Comments
 (0)