Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
fix(java): add configurations for Storage tests #1305
fix(java): add configurations for Storage tests #1305
Changes from all commits
6bc88ce
dbb033c
fbca4fc
5553f5d
ec051f6
e8a3b62
e8e817a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file that tells build-time initialization of classes of the library shouldn't be in test. Because the file is not shipped as part of the library.
As discussed today, this file being under the test directory means the users would have to write something similar to use google-cloud-storage with native-image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only reason why these configurations are initialized at build-time is because
com.google.cloud.storage.conformance.retry.ITRetryConformanceTest
which references them is initialized at build-time (following this logic). I'm not sure if this will apply to the regular application? WDYTThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's my misunderstanding then. Sorry I missed the discussion. Would you add that comment in the file about the configuration being for the test classes?
An explanation on why so many classes (not test classes) are needed here is nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion! Added a comment to summarize this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the
--initialize-at-build-time
doesn't have google-cloud-storage's main package. Nice.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that
com.google.cloud.storage.conformance.retry.ITRetryConformanceTest#testCases
is being invoked during the building of the native image?We're using
@RunWith(ParallelParameterized.class)
to resolve test cases relative to a classpath resource, and run them in parallel using a threadpool.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While standard Java initializes classes the first time they are accessed at run-time, Native image compilation tries to do some optimizations were it initializes some classes at image build time to decrease the start-up time of an application.
In our case, the
JunitFeature
which is brought in by the native-maven-plugin (plugin we use to run tests with native image compilation) explicitly initializesParameterized
at image build time. This causesParallelParameterized
and subsequentlycom.google.cloud.storage.conformance.retry.ITRetryConformanceTest
and other classesITRetryConformanceTest
references to also be initialized at build time. While the class itself is initialized at build time, it still runs at run-time (after the native image has been built).This article has been helping me understand class initialization a bit in graal.