Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

fix(java): register test class for reflection to fix native image test #766

Merged
merged 2 commits into from
Apr 1, 2022

Conversation

mpeddada1
Copy link
Contributor

Running mvn test -Dtest=com.google.cloud.spanner.DatabaseAdminClientTest -Pnative -DfailIfNoTests=false locally in java-spanner results in the following error message:

 com.google.cloud.spanner.SpannerException: UNKNOWN: com.google.api.gax.rpc.UnknownException: io.grpc.StatusRuntimeException: UNKNOWN
       com.google.cloud.spanner.SpannerExceptionFactory.newSpannerExceptionPreformatted(SpannerExceptionFactory.java:284)
       com.google.cloud.spanner.SpannerExceptionFactory.newSpannerException(SpannerExceptionFactory.java:61)
       com.google.cloud.spanner.SpannerExceptionFactory.newSpannerException(SpannerExceptionFactory.java:181)
       com.google.cloud.spanner.spi.v1.GapicSpannerRpc.get(GapicSpannerRpc.java:1682)
       com.google.cloud.spanner.spi.v1.GapicSpannerRpc.lambda$listBackups$5(GapicSpannerRpc.java:1021)
       [...]
     Caused by: java.util.concurrent.ExecutionException: com.google.api.gax.rpc.UnknownException: io.grpc.StatusRuntimeException: UNKNOWN
       com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:588)
       com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:567)
       com.google.cloud.spanner.spi.v1.GapicSpannerRpc.get(GapicSpannerRpc.java:1676)
       [...]
     Caused by: com.google.api.gax.rpc.UnknownException: io.grpc.StatusRuntimeException: UNKNOWN
       com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:75)
       com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72)
       com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:60)
       com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:97)
       com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:68)
       [...]
     Caused by: io.grpc.StatusRuntimeException: UNKNOWN
       io.grpc.Status.asRuntimeException(Status.java:535)
       [...]

Digging through the stacktrace revealed that an inner class of com.google.cloud.spanner.MockDatabaseAdminServiceImpl wasn't accessible to the native image builder. This resulted in an Exception being thrown when (String) obj.getClass().getMethod("getName") was called here:

https://github.com/googleapis/java-spanner/blob/7de41bf96ceebe45663d07c4416c488ad4f54832/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MockDatabaseAdminServiceImpl.java#L588

cc @meltsufin

@mpeddada1 mpeddada1 requested a review from a team as a code owner March 16, 2022 22:44
Copy link
Member

@suztomo suztomo left a comment

Choose a reason for hiding this comment

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

You may want to move SpannerFeature.java to spanner repository to save your time.

@mpeddada1 mpeddada1 added kokoro:run Add this label to force Kokoro to re-run the tests. labels Apr 1, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Apr 1, 2022
@mpeddada1 mpeddada1 merged commit 6fe52c3 into main Apr 1, 2022
@mpeddada1 mpeddada1 deleted the fix-spanner-test branch April 1, 2022 19:55
gcf-merge-on-green bot pushed a commit that referenced this pull request Apr 14, 2022
🤖 I have created a release *beep* *boop*
---


## [2.6.0](v2.5.11...v2.6.0) (2022-04-14)


### Features

* **java:** remove GoogleJsonClentFeature and OpenCensusFeature after relocation ([#793](#793)) ([2880112](2880112))
* **java:** remove Netty Native Image configuration after relocation to gax ([#771](#771)) ([9ba04f9](9ba04f9))
* **java:** remove protobuf Native Image configuration ([#784](#784)) ([0bc8549](0bc8549))
* remove native-image.properties settings  after relocation ([#794](#794)) ([e24bfdd](e24bfdd))
* remove resource-config after relocation ([#795](#795)) ([87e2973](87e2973))
* remove substitutions after relocation to gax ([#789](#789)) ([29291e9](29291e9))


### Bug Fixes

* **java:** register test class for reflection to fix native image test ([#766](#766)) ([6fe52c3](6fe52c3))


### Dependencies

* revert protobuf to 3.19 and common-protos 2.8.3 ([#798](#798)) ([0f36a84](0f36a84))
* update dependency com.google.api-client:google-api-client-bom to v1.34.0 ([#800](#800)) ([8430aee](8430aee))
* update dependency com.google.api:gax-bom to v2.16.0 ([#785](#785)) ([fd435b0](fd435b0))
* update dependency com.google.api.grpc:proto-google-common-protos to v2.8.1 ([#792](#792)) ([4d201ac](4d201ac))
* update dependency com.google.api.grpc:proto-google-common-protos to v2.8.2 ([#796](#796)) ([dc28a0f](dc28a0f))
* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.3.0 ([#783](#783)) ([4ed5ba4](4ed5ba4))
* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.3.1 ([#799](#799)) ([fce5315](fce5315))
* update dependency com.google.errorprone:error_prone_annotations to v2.12.1 ([#788](#788)) ([4e71f68](4e71f68))
* update dependency com.google.http-client:google-http-client-bom to v1.41.6 ([#791](#791)) ([fe006c6](fe006c6))
* update dependency com.google.http-client:google-http-client-bom to v1.41.7 ([#797](#797)) ([570f8d5](570f8d5))
* update dependency com.google.protobuf:protobuf-bom to v3.20.0 ([#787](#787)) ([19202bc](19202bc))
* update dependency io.grpc:grpc-bom to v1.45.1 ([#780](#780)) ([6e3bf35](6e3bf35))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
suztomo pushed a commit to googleapis/google-cloud-java that referenced this pull request Feb 1, 2023
🤖 I have created a release *beep* *boop*
---


## [2.6.0](googleapis/java-core@v2.5.11...v2.6.0) (2022-04-14)


### Features

* **java:** remove GoogleJsonClentFeature and OpenCensusFeature after relocation ([#793](googleapis/java-core#793)) ([cafd489](googleapis/java-core@cafd489))
* **java:** remove Netty Native Image configuration after relocation to gax ([#771](googleapis/java-core#771)) ([9cc7dba](googleapis/java-core@9cc7dba))
* **java:** remove protobuf Native Image configuration ([#784](googleapis/java-core#784)) ([7a8df66](googleapis/java-core@7a8df66))
* remove native-image.properties settings  after relocation ([#794](googleapis/java-core#794)) ([219a519](googleapis/java-core@219a519))
* remove resource-config after relocation ([#795](googleapis/java-core#795)) ([8ed3110](googleapis/java-core@8ed3110))
* remove substitutions after relocation to gax ([#789](googleapis/java-core#789)) ([85280b1](googleapis/java-core@85280b1))


### Bug Fixes

* **java:** register test class for reflection to fix native image test ([#766](googleapis/java-core#766)) ([fa07125](googleapis/java-core@fa07125))


### Dependencies

* revert protobuf to 3.19 and common-protos 2.8.3 ([#798](googleapis/java-core#798)) ([27ca70c](googleapis/java-core@27ca70c))
* update dependency com.google.api-client:google-api-client-bom to v1.34.0 ([#800](googleapis/java-core#800)) ([3abc47d](googleapis/java-core@3abc47d))
* update dependency com.google.api:gax-bom to v2.16.0 ([#785](googleapis/java-core#785)) ([bd33a76](googleapis/java-core@bd33a76))
* update dependency com.google.api.grpc:proto-google-common-protos to v2.8.1 ([#792](googleapis/java-core#792)) ([3f85e62](googleapis/java-core@3f85e62))
* update dependency com.google.api.grpc:proto-google-common-protos to v2.8.2 ([#796](googleapis/java-core#796)) ([d6ea18e](googleapis/java-core@d6ea18e))
* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.3.0 ([#783](googleapis/java-core#783)) ([48594f3](googleapis/java-core@48594f3))
* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.3.1 ([#799](googleapis/java-core#799)) ([9fe7d35](googleapis/java-core@9fe7d35))
* update dependency com.google.errorprone:error_prone_annotations to v2.12.1 ([#788](googleapis/java-core#788)) ([cfdabb4](googleapis/java-core@cfdabb4))
* update dependency com.google.http-client:google-http-client-bom to v1.41.6 ([#791](googleapis/java-core#791)) ([d9ff405](googleapis/java-core@d9ff405))
* update dependency com.google.http-client:google-http-client-bom to v1.41.7 ([#797](googleapis/java-core#797)) ([dfc3c57](googleapis/java-core@dfc3c57))
* update dependency com.google.protobuf:protobuf-bom to v3.20.0 ([#787](googleapis/java-core#787)) ([51f59fc](googleapis/java-core@51f59fc))
* update dependency io.grpc:grpc-bom to v1.45.1 ([#780](googleapis/java-core#780)) ([cd8a078](googleapis/java-core@cd8a078))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants