Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pyspark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Install Poetry
working-directory: pyspark
run: |
yes | sudo python3 -m pip install poetry --quiet
yes | python3 -m pip install poetry --quiet
poetry env use python3

- name: Lint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,36 @@
import org.junit.Test;

public class GraphInfoTest {
public static final String root = System.getenv("GAR_TEST_DATA") + "/java";
private static String resolveTestData() {
String path = System.getenv("GAR_TEST_DATA");
if (path == null) {
path = System.getProperty("gar.test.data");
}
if (path == null) {
String[] candidates = {"../../testing", "../testing", "testing"};
for (String p : candidates) {
java.io.File dir = new java.io.File(p).getAbsoluteFile();
if (new java.io.File(dir, "ldbc_sample/csv/ldbc_sample.graph.yml").exists()) {
path = dir.getAbsolutePath();
break;
}
}
if (path == null) {
throw new RuntimeException(
"GAR_TEST_DATA not found or invalid. Please set GAR_TEST_DATA environment variable to point to the testing directory or ensure the testing directory exists with ldbc_sample/csv/ldbc_sample.graph.yml");
}
}
java.io.File baseDir = new java.io.File(path).getAbsoluteFile();
java.io.File markerFile =
new java.io.File(baseDir, "ldbc_sample/csv/ldbc_sample.graph.yml");
if (!baseDir.isDirectory() || !markerFile.exists()) {
throw new RuntimeException(
"GAR_TEST_DATA not found or invalid. Please set GAR_TEST_DATA environment variable to point to the testing directory or ensure the testing directory exists with ldbc_sample/csv/ldbc_sample.graph.yml");
}
return baseDir.getAbsolutePath();
}

public static final String root = resolveTestData() + "/java";

@Test
public void test1() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,42 @@ abstract class BaseTestSuite extends AnyFunSuite with BeforeAndAfterAll {
var spark: SparkSession = _

override def beforeAll(): Unit = {
if (System.getenv("GAR_TEST_DATA") == null) {
throw new IllegalArgumentException("GAR_TEST_DATA is not set")
def resolveTestData(): String = {
var testDataPath: String =
Option(System.getenv("GAR_TEST_DATA"))
.orElse(Option(System.getProperty("gar.test.data")))
.orNull

if (testDataPath == null) {
val candidates = Seq("../../testing", "../testing", "testing")
candidates.foreach { p =>
val dir = new java.io.File(p).getAbsoluteFile
val marker =
new java.io.File(dir, "ldbc_sample/csv/ldbc_sample.graph.yml")
if (dir.exists() && dir.isDirectory && marker.isFile) {
testDataPath = dir.getAbsolutePath
return testDataPath
}
}
}

if (testDataPath != null) {
val dir = new java.io.File(testDataPath)
val marker =
new java.io.File(dir, "ldbc_sample/csv/ldbc_sample.graph.yml")
if (dir.exists() && dir.isDirectory && marker.isFile) {
return testDataPath
}
}

throw new RuntimeException(
"GAR_TEST_DATA not found or invalid. " +
"Please set GAR_TEST_DATA environment variable to point to the testing directory " +
"or ensure the testing directory exists with ldbc_sample/csv/ldbc_sample.graph.yml"
)
}
testData = System.getenv("GAR_TEST_DATA")

testData = resolveTestData()
Comment on lines 32 to 67
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation approach differs from TestUtil.java which performs additional verification after finding a path. TestUtil.java re-validates the chosen path to ensure both the directory and the marker file exist. This double-checking approach is more robust and catches edge cases. Consider adding a final validation step after selecting a path to ensure it's valid before returning it.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shivendra-dev54 Please consider this comment, it looks good

spark = SparkSession
.builder()
.enableHiveSupport()
Expand Down