gapic-generator-java
gapic-generator-java copied to clipboard
Should we include test resources in `gapic-generator-java:test-jar`?
Context in https://github.com/GoogleCloudPlatform/spring-cloud-gcp/pull/2570#issuecomment-1944253401
The spring-cloud-gcp autoconfig generator tests rely on TestProtoLoader.parseShowcaseEcho()
, which has a conflicting line that tries to parse the echo_v1beta1.yaml
from src/test/resources
, which is not available in the imported test-jar
https://github.com/googleapis/sdk-platform-java/blob/2d1775139e79becfe6f78bce627f79d708cc353c/gapic-generator-java/src/test/java/com/google/api/generator/test/protoloader/TestProtoLoader.java#L166-L170
Possible solutions:
- include the test resources in the test-jar
- have our own implementation of the parsed showcase echo in spring-cloud-generator
- In order to unblock @JoeWang1127 and @alicejli 's release train, I think this could be a good workaround (draft pending)
Thanks @diegomarquezp for providing the workaround! Adding the service yamls that SpringCodeGen does not need is a signal that it may not be the long term solution. I'm considering TestProtoLoader
a public test util, so I think the proper way to fix it is to remove the assertion assertTrue(serviceYamlOpt.isPresent())
in the TestProtoLoader
, so that it works with or without the service yamls.
Including the test resources in the test-jar is also not appropriate because test-jar should only includes code, the test data in the resources folder should only live within the repo.
In addition, I think we should have a downstream check that verifies the generator changes should not break spring-cloud-gcp, created an issue https://github.com/googleapis/sdk-platform-java/issues/2534 for it.
Closing this issue as we already implemented the workaround in spring-cloud-gcp. Test resources should be independent in each repo.