-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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
Windows support to run integration tests with Gradle #14051
Windows support to run integration tests with Gradle #14051
Conversation
@rjernst can you have a look? |
@@ -44,14 +45,18 @@ class ClusterConfiguration { | |||
|
|||
@Input | |||
void plugin(String name, FileCollection file) { | |||
setupCommands.put(name, ['bin/plugin', 'install', new LazyFileUri(file: file)]) | |||
if (Os.isFamily(Os.FAMILY_WINDOWS)) { | |||
setupCommands.put(name, ['call', 'bin/plugin', 'install', new LazyFileUri(file: file)]) |
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.
In the ant integ tests, we do this logic within the exec code. I think we should do the same (ie in ClusterFormationTasks, where we set the exec args, we can prepend call
)?
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.
Agree, but I would like to go one step further: The method void plugin(String name, FileCollection file)
should just store the <String, FileCollection>
pairs. The method void setupCommand(String name, Object... args)
can be removed (as it is too broad and OS-dependent). This leaves it up to ClusterFormationTasks.groovy
to implement how plugins are actually installed.
This is my main concern. We need to find a way to have the output of the current command (ie starting ES since this is the only one that needs to spawn) output when there is a failure. There is a longstanding gradle issue for this: And from that, it seems there is a plugin to do exactly what we want? |
Nevermind about that plugin, it has some inherent flaws in the api (eg it expects the process to emit something on stdout when it is "ready", and it is meant to just support unix). Maybe it is worthwhile to use the ant impl as a template? It is not much code and self contained. Even better would be to try and fix this in gradle...the code already has an "isDaemon" flag, but it is completely internal (looks like it is used for the gradle daemon). |
My understanding of the original implementation is as follows (please correct me if I'm wrong). The daemon flag is added as a parameter to the Gradle Exec task. This means that the Unix shell script spawns the Elasticsearch Java process with The question now is: Why can't we just do the same thing on Windows? First of all, the Windows
I see two solutions here:
|
http(url: "http://localhost:${config.httpPort}") | ||
} | ||
} | ||
if (ant.properties["failed${task.name}#start"]) { |
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 condition was not properly working before with
if (ant.properties.containsKey("failed${task.name}#start")) {
because containsKey
is called with a GString
which does not equal to the represented String
.
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.
Can we do an actual check like .isEmpty() == false
? I don't like relying on groovyness here..
LGTM, thank you for this! |
Maybe add a longer comment in the windows exec block explaining why it is different (and maybe create an issue to follow up on this)? |
627fd95
to
1816af5
Compare
…-integrationtests Windows support to run integration tests with Gradle
Implementation note:
The Windows
elasticsearch.bat
start script does not provide a daemon mode (nor is it easy to add one). As Gradle'sExec
task does not support spawning a process in the background, I had to fall back to Ant'sexec
task. To make things uniform for Windows and Unix, I removed the daemon flag from the Unix shell script invocation. As consequence, the error output is a bit reduced.Relates to #13930.