Skip to content

Commit

Permalink
Test against Spark Connect server, add to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoMi committed Aug 1, 2024
1 parent 4ba4159 commit 152bbff
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
22 changes: 20 additions & 2 deletions .github/actions/test-python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,22 @@ runs:
find python/test -name 'test*.py' > tests
while read test
do
if ! $SPARK_HOME/bin/spark-submit --master "local[2]" --packages uk.co.gresearch.spark:spark-extension_${{ inputs.scala-compat-version }}:$SPARK_EXTENSION_VERSION "$test" test-results
if ! $SPARK_HOME/bin/spark-submit --master "local[2]" --packages uk.co.gresearch.spark:spark-extension_${{ inputs.scala-compat-version }}:$SPARK_EXTENSION_VERSION "$test" test-results-submit
then
state="fail"
fi
done < tests
if [[ "$state" == "fail" ]]; then exit 1; fi
shell: bash

- name: Python Integration Tests (Spark Connect)
env:
PYTHONPATH: python:python/test
run: |
find python/test -name 'test*.py' > tests
while read test
do
if ! $SPARK_HOME/bin/spark-submit --master "local[2]" --packages uk.co.gresearch.spark:spark-extension_${{ inputs.scala-compat-version }}:$SPARK_EXTENSION_VERSION "$test" test-results-connect
then
state="fail"
fi
Expand All @@ -135,7 +150,10 @@ runs:
uses: actions/upload-artifact@v4
with:
name: Python Test Results (Spark ${{ inputs.spark-version }} Scala ${{ inputs.scala-version }} Python ${{ inputs.python-version }})
path: test-results/*.xml
path: |
test-results/*.xml
test-results-submit/*.xml
test-results-connect/*.xml
branding:
icon: 'check-circle'
Expand Down
4 changes: 3 additions & 1 deletion python/test/spark_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def get_spark_config(path) -> SparkConf:
def get_spark_session(cls) -> SparkSession:
builder = SparkSession.builder

if 'PYSPARK_GATEWAY_PORT' in os.environ:
if 'TEST_SPARK_CONNECT_SERVER' in os.environ:
builder.remote(os.environ['TEST_SPARK_CONNECT_SERVER'])
elif 'PYSPARK_GATEWAY_PORT' in os.environ:
logging.info('Running inside existing Spark environment')
else:
logging.info('Setting up Spark environment')
Expand Down

0 comments on commit 152bbff

Please sign in to comment.