Skip to content

Commit e3a235e

Browse files
speedstorm1copybara-github
authored andcommitted
chore: create lightweight set of tests designed for api-level SDK verification.
PiperOrigin-RevId: 809105081
1 parent b5eed8d commit e3a235e

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

run_shared_tests.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
export GOOGLE_GENAI_CLIENT_MODE=api
4+
export GOOGLE_GENAI_TESTS_SUBDIR=shared
5+
REPLAYS_DIR="$(blaze info workspace 2>/dev/null)/google/cloud/aiplatform/sdk/genai/replays"
6+
export GOOGLE_GENAI_REPLAYS_DIRECTORY="$REPLAYS_DIR"
7+
8+
echo "Replays directory: $GOOGLE_GENAI_REPLAYS_DIRECTORY"
9+
echo "Client mode: $GOOGLE_GENAI_CLIENT_MODE"
10+
echo "Tests subdirectory: $GOOGLE_GENAI_TESTS_SUBDIR"
11+
echo "Running shared table tests in API mode..."
12+
mvn clean test -Dtest=TableTest -Djacoco.skip=true && mvn clean

src/test/java/com/google/genai/TableTest.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ private static Collection<DynamicTest> createTableTests(String path, boolean ver
5757
String testMethod = testTableFile.testMethod().get();
5858
String[] segments = testMethod.split("\\.");
5959
if (segments.length != 2) {
60-
throw new RuntimeException("Invalid test method: " + testMethod);
60+
String msg = " => Test skipped: multistep test " + testMethod + " not supported in Java";
61+
List<DynamicTest> dynamicTests = new ArrayList<>();
62+
for (TestTableItem testTableItem : testTableFile.testTable().get()) {
63+
String testName =
64+
String.format("%s.%s.%s", testMethod, testTableItem.name().get(), suffix);
65+
dynamicTests.add(DynamicTest.dynamicTest(testName + msg, () -> {}));
66+
}
67+
return dynamicTests;
6168
}
6269
String originalModuleName = segments[0];
6370
String moduleName = Common.snakeToCamel(originalModuleName);
@@ -299,6 +306,10 @@ private static String getReplayFilePath(String testName) {
299306
Collection<DynamicTest> createTests() throws IOException {
300307
String replaysPath = System.getenv("GOOGLE_GENAI_REPLAYS_DIRECTORY");
301308
String testsReplaysPath = replaysPath + "/tests";
309+
String testsSubDir = System.getenv("GOOGLE_GENAI_TESTS_SUBDIR");
310+
if (testsSubDir != null) {
311+
testsReplaysPath += "/" + testsSubDir;
312+
}
302313
Collection<DynamicTest> dynamicTests = new ArrayList<>();
303314
Files.walk(Paths.get(testsReplaysPath))
304315
.filter(Files::isRegularFile)

0 commit comments

Comments
 (0)