incubator-graphar
incubator-graphar copied to clipboard
fix: fallback to default test data path if GAR_TEST_DATA not set
Reason for this PR
Fixes #757
Currently, the test data path for Spark testing is read solely from the GAR_TEST_DATA environment variable. This creates friction for new contributors or developers running tests locally without a custom setup.
This PR proposes a fallback to automatically detect common default locations (testing/, ../testing/, ../../testing/) in case the environment variable or system property is not set.
What changes are included in this PR?
- Enhanced the
checkTestData()method to:- First check
GAR_TEST_DATAenvironment variable - Then check Java system property
gar.test.data - Finally fallback to check common local paths for test data directories (like
testing/, etc.)
- First check
- Ensures
ldbc_sample/csv/ldbc_sample.graph.ymlexists before accepting the path
Are these changes tested?
These changes reuse the existing validation logic already in place within checkTestData(). The fallback will only apply if GAR_TEST_DATA is not set, so no changes are required in the test suite itself.
Manually tested by running without the environment variable and verifying that the fallback path works correctly.
Are there any user-facing changes?
No. This only impacts the developer testing experience. No changes to APIs or public behavior.
Hi @bhavish00007 , please note that this PR is not ready yet
@yangxk1 can u give me update when its ready
@bhavish00007, the check ci were failed, please format code (run mvn spotless:apply)
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 82.00%. Comparing base (1bb0468) to head (76f0bb8).
:warning: Report is 6 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #758 +/- ##
============================================
+ Coverage 77.77% 82.00% +4.22%
- Complexity 234 299 +65
============================================
Files 25 25
Lines 918 1000 +82
Branches 49 84 +35
============================================
+ Hits 714 820 +106
+ Misses 167 125 -42
- Partials 37 55 +18
| Flag | Coverage Δ | |
|---|---|---|
| java-info | 82.00% <ø> (?) |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Hey @bhavish00007 , I formatted the code and pass the test, It looks good. Do you have anything else to add?
Does this PR resolve the issue? @Thespica