-
Notifications
You must be signed in to change notification settings - Fork 10
Add Polaris Apprunner Gradle/Maven plugins #18
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
base: main
Are you sure you want to change the base?
Conversation
ae71aa5
to
6e7cdc1
Compare
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.
Could we share ASF stuff across all sub-modules?
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 @snazy for the PR. This seems a huge one. I'd suggest a dev mailing discussion first. This plugin seems to be used for integration tests. Other than adding a whole plugin in to Polaris repo, is there any alternative? For example, is there any plugin can be imported directly instead of having all source code within the project.
} | ||
``` | ||
|
||
### Groovy DSL |
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.
Do we need groovy as Polaris is using Kotlin with Gradle?
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.
We don't need Groovy as, indeed, Polaris is using Kotlin. However, I believe this project is a runner to facilitate Polaris users' life. Users can run the integration tests of their Enterprise projects in isolation without having to manually deploy a Polaris server themselves. And we cannot make any assumption as to whether they are using Groovy or Kotlin in their Gradle build.
} | ||
``` | ||
|
||
## Maven |
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.
Do we need maven doc as Polaris doesn't use maven?
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.
Same comment as my previous answer: we don't need Maven as, indeed, Polaris is using Gradle.
However, I believe this project is a runner to facilitate Polaris users' life. Users can run the integration tests of their Enterprise projects in isolation without having to manually deploy a Polaris server themselves. Maven is the other mainstream Java build system. So it only makes sense that the Apprunner comes with instructions and code to support Maven too.
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.
No explicit approval yet as there are some questions I think would be worth answering. But generally speaking, the code looks good.
|
||
## FAQ | ||
|
||
### Does it have to be a Polaris Quarkus server? |
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.
Q: This FAQ entry makes me think that, eventually, the code from this module could be extracted and donated to Quarkus. Then this module would just become a specialization of a "Quarkus Gradle Runner for IT" project. Is this correct?
} | ||
``` | ||
|
||
### Groovy DSL |
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.
We don't need Groovy as, indeed, Polaris is using Kotlin. However, I believe this project is a runner to facilitate Polaris users' life. Users can run the integration tests of their Enterprise projects in isolation without having to manually deploy a Polaris server themselves. And we cannot make any assumption as to whether they are using Groovy or Kotlin in their Gradle build.
} | ||
``` | ||
|
||
## Maven |
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.
Same comment as my previous answer: we don't need Maven as, indeed, Polaris is using Gradle.
However, I believe this project is a runner to facilitate Polaris users' life. Users can run the integration tests of their Enterprise projects in isolation without having to manually deploy a Polaris server themselves. Maven is the other mainstream Java build system. So it only makes sense that the Apprunner comes with instructions and code to support Maven too.
|
||
var any = false; | ||
while (input.ready()) { | ||
var c = input.read(); |
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.
Reading form an input stream byte by byte could result in a lot of syscalls. It seems to me that using a BufferedInputStream would be a lot better. Am I missing something ? Or, is it acceptable because we only use the InputBuffer
for a small amount of data?
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.
It's only there to capture the startup phase output from Quarkus via its stdout.
* out as fast as possible. If there's no data available, the loop will "yield" via a | ||
* Thread.sleep(1L), which is good enough. | ||
* | ||
* Note: we cannot do blocking-I/O here, because we have to read from both stdout+stderr. |
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.
Is this still true? Given that ProcessBuilder::redirectErrorStream
was called, both stdout and stderr are merged into a single stream. So it seems to me that we could do blocking I/O.
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.
Nope. It would block forever when the process doesn't yield any output.
public void accept(String line) { | ||
if (!listenUrl.isDone()) { | ||
synchronized (capturedLog) { | ||
capturedLog.add(line); |
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.
Is it possible that capturing all Quarkus output and keeping it in the heap could become a problem if, say, Polaris was started with TRACE
logging? It seems to me that capturing all logs was mostly used for debugging purposes?
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.
It's not a problem in practice. But you want to see all output in case the startup fails. So yes, it's for debugging when things don't work right w/ "your" server.
*/ | ||
class TestSimulatingTestUsingThePlugin { | ||
@Test | ||
void pingNessie() throws Exception { |
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.
void pingNessie() throws Exception { | |
void pingPolaris() throws Exception { |
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.
Well, it's Nessie in this test.
|
||
var client = NessieClientBuilder.createClientBuilderFromSystemSettings().withUri(uri).build(NessieApiV2.class); | ||
// Just some simple REST request to verify that Polaris is started - no fancy interactions w/ Nessie | ||
var config = client.getConfig(); |
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.
There are references to Nessie that can most likely be simply renamed (e.g. pingNessie()
) and others that I am less sure about (Nessie client usage). Is using the Nessie Client intended? There are mentions of Nessie's REST API in code that targets the embedded Polaris server, and that is confusing. What is the rationale for using the Nessie Client here?
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.
At the time of pushing this, there was no Polaris binary.
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.
However, it should eventually test both Polaris and Nessie. The principle (code wise) however is the same.
String uri = String.format("http://127.0.0.1:%s/api/v1", port); | ||
|
||
NessieApiV1 client = HttpClientBuilder.builder().withUri(uri).build(NessieApiV1.class); | ||
// Just some simple REST request to verify that Nessie is started - no fancy interactions w/ Nessie |
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.
More mentions of Nessie here
Co-authored-by: Pierre Laporte <[email protected]>
Heads up: this is the successor of apache/polaris#785 - it's been open for quite a while. |
Gradle and Maven plugins to run a Polaris process and "properly" terminate it for integration testing.
More information in the
README.md
in theapprunner/
directory.