-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Sense for VirtualBox and $HOME when deciding to turn on vagrant testing. #24636
Conversation
plugins/repository-hdfs/build.gradle
Outdated
|
||
// Finding that HOME needs to be set when performing vagrant updates | ||
String homeLocation = System.getenv("HOME") | ||
if (homeLocation == null) { |
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.
why do we need this leniency? If vagrant fails because HOME is not set, that tails us there is a problem that needs fixing. With the logic here, we will simply not run the test and not know it is broken.
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.
I can change this to throw an exception instead. If vagrant is installed but the environment can't support calling it, we should probably break earlier in the build with clear reasoning for why.
plugins/repository-hdfs/build.gradle
Outdated
try { | ||
ByteArrayOutputStream pipe = new ByteArrayOutputStream() | ||
ExecResult runResult = exec { | ||
commandLine 'vboxmanage', '--version' |
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 really need to share this stuff...VagrantTestPlugin also does this.
Can we do this exactly once (for vagrant and vboxmanage each) and set a property on the project like vagrantSupported
? See for example in BuildPlugin how we check the java version etc in globalBuildInfo. This would also allow us to remove the tasks created by VagrantTestPlugin and just check the flag.
This keeps failing the build so I am temporarily disabling it until elastic#24636 gets merged.
This keeps failing the build so I am temporarily disabling it until #24636 gets merged.
This keeps failing the build so I am temporarily disabling it until #24636 gets merged.
This keeps failing the build so I am temporarily disabling it until #24636 gets merged.
6de733c
to
13c9e2c
Compare
I've moved the environment sensing out of the hdfs plugin build script as well as the vagrant test plugin into it's own |
The VagrantTestPlugin definitely depends on this VagrantSupportPlugin. I'm not aware of any good ways to orchestrate that dependency in the build script. @rjernst any thoughts? |
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.
I left a few comments.
"and requires \$HOME to be set to function properly.") | ||
} | ||
|
||
project.ext.vagrantInstallation = project.rootProject.ext.vagrantInstallation |
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 really need to put these on all the projects? I think this plugin can just look for the flags on the root project?
} | ||
|
||
private Installation getVagrantInstallation(Project project) { | ||
// Only do secure fixture support if the regular fixture is supported, |
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.
This comment seems to be specific to the old location of this check
} | ||
|
||
private Installation getVirtualBoxInstallation(Project project) { | ||
// Also check to see if virtualbox is installed. We need both vagrant |
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.
This comment also refers to stuff outside this plugin
* is installed, if it is the correct version, which version was found, and any | ||
* errors that were encountered when checking for the installation. | ||
*/ | ||
class Installation { |
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.
I don't think we really need this abstraction...can we just keep it simple and store a boolean property on the root project indicating whether vagrant is installed at the given version, and the same for virtualbox? You can even store this in a map, along with whatever error description you want about getting the version. eg.
rootProject.ext.vagrant = ['supported': false, 'info': 'Unsupported version of vagrant [${version}]. Need [Vagrant 1.8.6+]']
....
if (rootProject.vagrant.supported == false) {
logger.warn(rootProject.vagrant.info)
} else {
// use vagrant
}
plugins/repository-hdfs/build.gradle
Outdated
} else { | ||
logger.warn("Could not read installed vagrant version:\n" + output) | ||
if (project.virtualBoxInstallation.supported == false) { | ||
logger.warn(project.virtualBoxInstallation.error.message) |
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.
These messages are becoming noisy, and aren't actually helpful, because they are emitted even when not trying to run this task. I wonder if instead you could check emit this at runtime if the task would have run? You could do this as a doFirst, and throw a StopExecutionException if the task should be skipped.
de71a9b
to
16e668f
Compare
@rjernst How are we on the recent changes for this? I'd like to get this merged soon. |
@jbaiera I had not looked at it since I left my last comments. Please ping me in the future when it is ready for another review. I will look now. |
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.
LGTM, left a couple minor comments that can be addressed in followups if desired.
|
||
// Finding that HOME needs to be set when performing vagrant updates | ||
String homeLocation = System.getenv("HOME") | ||
if (project.rootProject.ext.vagrantSupported && homeLocation == null) { |
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.
Why does this check need to be done for every project using this instead of once inside the installation checks above?
plugins/repository-hdfs/build.gradle
Outdated
|
||
if (secureFixtureSupported) { | ||
integTestSecure.mustRunAfter(project.integTest) |
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.
I don't think this mustRunAfter will actually do anything. The integTest task is just a dummy task that depends on setting up the integTestCluster and running integTestRunner. When you run gradle check do you see tasks form the secure and regular integTest intermixed?
…hen deciding if vagrant is supported
Removing Installation and replacing with Map Removing placing the installation properties on the project Got rid of spammy log messages on the repository hdfs build
17601aa
to
5d1dfc0
Compare
…nt testing. (elastic#24636)" This reverts commit 4ed0abe.
* master: Do not swallow node lock failed exception Revert "Revert "Sense for VirtualBox and $HOME when deciding to turn on vagrant testing. (elastic#24636)"" Aggregations bug: Significant_text fails on arrays of text. (elastic#25030) Speed up sorted scroll when the index sort matches the search sort (elastic#25138) TranslogTests.testWithRandomException ignored a possible simulated OOM when trimming files Adapt TranslogTests.testWithRandomException to checkpoint syncing on trim
* master: Explicitly reject duplicate data paths Do not swallow node lock failed exception Revert "Revert "Sense for VirtualBox and $HOME when deciding to turn on vagrant testing. (elastic#24636)"" Aggregations bug: Significant_text fails on arrays of text. (elastic#25030) Speed up sorted scroll when the index sort matches the search sort (elastic#25138) TranslogTests.testWithRandomException ignored a possible simulated OOM when trimming files Adapt TranslogTests.testWithRandomException to checkpoint syncing on trim Change BWC versions on get mapping 404s Fix get mappings HEAD requests TranslogTests#commit didn't allow for a concurrent closing of a view Fix handling of exceptions thrown on HEAD requests Fix comment formatting in EvilLoggerTests Remove unneeded weak reference from prefix logger Test: remove faling test that relies on merge order
Some of the CI boxes for Elasticsearch have inconsistently configured environments when it comes to Vagrant. Vagrant requires $HOME to be set, as well as VirtualBox to be installed. This PR checks those two things are present before enabling tests with VagrantFixtures in the HDFS Repo (only place vagrant fixtures are used right now).