Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spark] Set spark.testing flag in tests #4119

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ctring
Copy link
Contributor

@ctring ctring commented Feb 3, 2025

Which Delta project/connector is this regarding?

  • Spark
  • Standalone
  • Flink
  • Kernel
  • Other (fill in here)

Description

Currently, the Utils.isTesting check in tests is not reliable because the spark.testing system property is not set before the suites start, so the tests are relying on this line in SparkFunSuite to set the test indicator. This is causing issues in CI because it means whether Utils.isTesting returns correct result depends on whether it is called after SparkFunSuite::beforeAll is called.

For example, some deletion vector-related suites are relying on the TEST_DV_NAME_PREFIX config to be correctly initialized in tests. However, if a previous test in the same JVM group initialized this config before spark.testing is correctly set by SparkFunSuite, the deletion vector suites would see the incorrect value of TEST_DV_NAME_PREFIX and fail (This is currently not an issue in master by luck but if a PR added new tests that changed the JVM grouping in CI job (#4039, #4040), this would incorrectly fail the PR's spark test job).

This PR fixes this by setting spark.testing to true in build file. Note that this flag is already set in the Spark repo but not here yet.

How was this patch tested?

Check that the TEST_DV_NAME_PREFIX is correctly set for tests that run Utils.testing before SparkFunSuite::beforeAll (e.g., org.apache.spark.sql.delta.DeltaWithNewTransactionWithCoordinatedCommitsBatch100Suite)

Does this PR introduce any user-facing changes?

No

@ctring ctring changed the title Add spark.testing=1 to build config [Spark] Set spark.testing in build Feb 3, 2025
@ctring ctring changed the title [Spark] Set spark.testing in build [Spark] Set spark.testing flag in tests Feb 3, 2025
@felipepessoto
Copy link
Contributor

@ctring could you help reviewing this related PR? #4074

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants