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

chore: centralize test native-image config #3687

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

diegomarquezp
Copy link
Contributor

to be merged once googleapis/sdk-platform-java#3674 is merged and released

@diegomarquezp diegomarquezp requested review from a team as code owners March 13, 2025 19:05
@diegomarquezp diegomarquezp added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Mar 13, 2025
@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: spanner Issues related to the googleapis/java-spanner API. labels Mar 13, 2025
diegomarquezp added a commit to googleapis/sdk-platform-java that referenced this pull request Mar 17, 2025
Fixes #3638

Moves all added `src/test/native-image` configs done in HW repos. See:
 * googleapis/java-spanner-jdbc#1908
 * googleapis/java-pubsub#2336
 * googleapis/java-bigtable#2481
 * googleapis/java-logging#1763
 * googleapis/java-firestore#2011
 * googleapis/java-spanner#3642
 * googleapis/java-storage-nio#1536

Further investigation: some JUnit classes already existed in the
production native image folder and some other JUnit classes had to be
added in those configs. We need to find out why JUnit configs need to be
in production native configs.

### Local tests
#### java-spanner
googleapis/java-spanner#3687
```
[hi on] diegomarquezp@diegomarquezp:~/google/java-spanner$ git diff
diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml
index a460cc33..3bda6564 100644
--- a/google-cloud-spanner/pom.xml
+++ b/google-cloud-spanner/pom.xml
@@ -390,6 +390,7 @@
       <artifactId>gax</artifactId>
       <classifier>testlib</classifier>
       <scope>test</scope>
+      <version>2.62.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>com.google.api</groupId>
diff --git a/google-cloud-spanner/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-spanner/native-image.properties b/google-cloud-spanner/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-spanner/native-image.properties
deleted file mode 100644
index 383f5390..00000000
--- a/google-cloud-spanner/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-spanner/native-image.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-Args=--initialize-at-build-time=org.junit.runner.RunWith \
- --initialize-at-build-time=org.junit.experimental.categories.Category \
- --initialize-at-build-time=org.junit.runners.model.FrameworkField
...
[INFO] BUILD SUCCESS
```

#### java-logging 
googleapis/java-logging#1778
```
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  07:32 min
[INFO] Finished at: 2025-03-13T16:17:22Z
[INFO] ------------------------------------------------------------------------
[hi on] diegomarquezp@diegomarquezp:~/google/java-logging$ git diff
diff --git a/google-cloud-logging/pom.xml b/google-cloud-logging/pom.xml
index 46305c67..cb24da54 100644
--- a/google-cloud-logging/pom.xml
+++ b/google-cloud-logging/pom.xml
@@ -169,6 +169,13 @@
       <classifier>testlib</classifier>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>com.google.api</groupId>
+      <artifactId>gax</artifactId>
+      <classifier>testlib</classifier>
+      <scope>test</scope>
+      <version>2.62.1-SNAPSHOT</version>
+    </dependency>
   </dependencies>

   <build>
diff --git a/google-cloud-logging/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-logging/native-image.properties b/google-cloud-logging/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-logging/native-image.properties
deleted file mode 100644
index a62f3f19..00000000
--- a/google-cloud-logging/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-logging/native-image.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-Args=--initialize-at-build-time=org.junit.Ignore,\
-java.lang.annotation.Annotation,\
-org.junit.vintage.engine.discovery.FilterableIgnoringRunnerDecorator,\
-org.junit.runners.model.FrameworkField
[hi on] diegomarquezp@diegomarquezp:~/google/java-logging$
```

#### java-bigtable
googleapis/java-bigtable#2521
```
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  15:43 min
[INFO] Finished at: 2025-03-13T16:24:19Z
[INFO] ------------------------------------------------------------------------
[hi on] diegomarquezp@diegomarquezp:~/google/java-bigtable$ git diff
diff --git a/google-cloud-bigtable-emulator/pom.xml b/google-cloud-bigtable-emulator/pom.xml
index 1d063a65..8f5be6df 100644
--- a/google-cloud-bigtable-emulator/pom.xml
+++ b/google-cloud-bigtable-emulator/pom.xml
@@ -120,6 +120,13 @@
       <groupId>com.google.api</groupId>
       <artifactId>gax-grpc</artifactId>
     </dependency>
+    <dependency>
+      <groupId>com.google.api</groupId>
+      <artifactId>gax</artifactId>
+      <version>2.62.1-SNAPSHOT</version>
+      <classifier>testlib</classifier>
+      <scope>test</scope>
+    </dependency>

     <dependency>
       <groupId>junit</groupId>
diff --git a/google-cloud-bigtable-emulator/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-bigtable-emulator/native-image.properties b/google-cloud-bigtable-emulator/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-bigtable-emulator/native-image.properties
deleted file mode 100644
index 0c5258dc..00000000
--- a/google-cloud-bigtable-emulator/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-bigtable-emulator/native-image.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-Args=--initialize-at-build-time=org.junit.runners.model.FrameworkField \
---initialize-at-build-time=org.junit.runner.RunWith \
---initialize-at-build-time=java.lang.annotation.Annotation
diff --git a/google-cloud-bigtable/pom.xml b/google-cloud-bigtable/pom.xml
index e36416b2..1204339a 100644
--- a/google-cloud-bigtable/pom.xml
+++ b/google-cloud-bigtable/pom.xml
@@ -81,6 +81,7 @@
     <dependency>
       <groupId>com.google.api</groupId>
       <artifactId>gax</artifactId>
+      <version>2.62.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>com.google.api.grpc</groupId>
@@ -248,6 +249,7 @@
       <artifactId>gax</artifactId>
       <classifier>testlib</classifier>
       <scope>test</scope>
+      <version>2.62.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <!-- Need testing utility classes for generated gRPC clients tests -->
```

#### java-pubsub
googleapis/java-pubsub#2368
```
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  05:43 min
[INFO] Finished at: 2025-03-13T18:05:32Z
[INFO] ------------------------------------------------------------------------
[hi on] diegomarquezp@diegomarquezp:~/google/java-pubsub$ git diff
diff --git a/google-cloud-pubsub/pom.xml b/google-cloud-pubsub/pom.xml
index 1364c066..d0919326 100644
--- a/google-cloud-pubsub/pom.xml
+++ b/google-cloud-pubsub/pom.xml
@@ -61,6 +61,7 @@
     <dependency>
       <groupId>com.google.api</groupId>
       <artifactId>gax</artifactId>
+      <version>2.62.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>com.google.api</groupId>
@@ -175,6 +176,7 @@
       <artifactId>gax</artifactId>
       <classifier>testlib</classifier>
       <scope>test</scope>
+      <version>2.62.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>com.google.api</groupId>
```

#### java-firestore
googleapis/java-firestore#2041
```
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  18:50 min
[INFO] Finished at: 2025-03-13T18:53:36Z
[INFO] ------------------------------------------------------------------------
[hi on] diegomarquezp@diegomarquezp:~/google/java-firestore$ git status
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   google-cloud-firestore/pom.xml
        modified:   google-cloud-firestore/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-firestore/native-image.properties

no changes added to commit (use "git add" and/or "git commit -a")
[hi on] diegomarquezp@diegomarquezp:~/google/java-firestore$ git diff
diff --git a/google-cloud-firestore/pom.xml b/google-cloud-firestore/pom.xml
index 87579cce..716e7e77 100644
--- a/google-cloud-firestore/pom.xml
+++ b/google-cloud-firestore/pom.xml
@@ -162,6 +162,7 @@
       <artifactId>gax</artifactId>
       <classifier>testlib</classifier>
       <scope>test</scope>
+      <version>2.62.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>com.google.api</groupId>
diff --git a/google-cloud-firestore/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-firestore/native-image.properties b/google-cloud-firestore/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-firestore/native-image.properties
index 96207424..45007824 100644
--- a/google-cloud-firestore/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-firestore/native-image.properties
+++ b/google-cloud-firestore/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-firestore/native-image.properties
@@ -1,5 +1,3 @@
 # FirestoreImpl uses a random number generator so it needs to be initialized at
 # run-time.
-Args = --initialize-at-run-time=com.google.cloud.firestore.FirestoreImpl \
---initialize-at-build-time=org.junit.runner.RunWith,java.lang.annotation.Annotation \
---initialize-at-build-time=org.junit.Ignore,org.junit.runners.model.FrameworkField
\ No newline at end of file
+Args = --initialize-at-run-time=com.google.cloud.firestore.FirestoreImpl
\ No newline at end of file
```

#### java-spanner-jdbc
googleapis/java-spanner-jdbc#1954
Fails locally (may need further investigation on local) both using the
in-repo config and the config in this PR via gax, __after__ initializing
the image, meaning that the configuration works but the failures are due
to a separate issue.

#### java-storage-nio
googleapis/java-storage-nio#1559

```
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  06:21 min
[INFO] Finished at: 2025-03-17T17:45:18Z
[INFO] ------------------------------------------------------------------------
[hi on] diegomarquezp@diegomarquezp:~/google/java-storage-nio$ git diff
diff --git a/google-cloud-nio/pom.xml b/google-cloud-nio/pom.xml
index e7989ac..3bf727a 100644
--- a/google-cloud-nio/pom.xml
+++ b/google-cloud-nio/pom.xml
@@ -33,6 +33,7 @@
     <dependency>
       <groupId>com.google.api</groupId>
       <artifactId>gax</artifactId>
+      <version>2.62.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>com.google.cloud</groupId>
@@ -61,6 +62,13 @@
       <groupId>com.google.code.findbugs</groupId>
       <artifactId>jsr305</artifactId>
     </dependency>
+    <dependency>
diff --git a/google-cloud-nio/pom.xml b/google-cloud-nio/pom.xml
index e7989ac..3bf727a 100644
--- a/google-cloud-nio/pom.xml
+++ b/google-cloud-nio/pom.xml
@@ -33,6 +33,7 @@
     <dependency>
       <groupId>com.google.api</groupId>
       <artifactId>gax</artifactId>
+      <version>2.62.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>com.google.cloud</groupId>
@@ -61,6 +62,13 @@
       <groupId>com.google.code.findbugs</groupId>
       <artifactId>jsr305</artifactId>
     </dependency>
+    <dependency>
+      <groupId>com.google.api</groupId>
+      <artifactId>gax</artifactId>
+      <version>2.62.1-SNAPSHOT</version>
+      <classifier>testlib</classifier>
+      <scope>test</scope>
+    </dependency>

     <dependency>
       <groupId>junit</groupId>
diff --git a/google-cloud-nio/src/main/resources/META-INF/native-image/com/google/cloud/google-cloud-nio/native-image.properties b/google-cloud-nio/src/main/resources/META-INF/native-image/com/google/cloud/google-cloud-nio/native-image.properties
index 1449dc0..be1730e 100644
--- a/google-cloud-nio/src/main/resources/META-INF/native-image/com/google/cloud/google-cloud-nio/native-image.properties
+++ b/google-cloud-nio/src/main/resources/META-INF/native-image/com/google/cloud/google-cloud-nio/native-image.properties
@@ -7,6 +7,3 @@
 Args = --initialize-at-build-time=com.google.cloud.storage.contrib.nio.CloudStorageFileSystemProvider,\
   com.google.cloud.storage.contrib.nio.CloudStorageConfiguration,\
   com.google.cloud.storage.contrib.nio.AutoValue_CloudStorageConfiguration,\
-  com.google.common.collect.RegularImmutableList,\
-  org.junit.runner.RunWith,java.lang.annotation.Annotation,\
-  org.junit.runners.model.FrameworkField
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/java-spanner API. do not merge Indicates a pull request not ready for merge, due to either quality or timing. size: xs Pull request size is extra small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant