Commit Graph

204 Commits

Author SHA1 Message Date
Ryan Ernst 5c8a0da1fd Build: Change rest integ tests to not have hardcoded ports
This change removes hardcoded ports from cluster formation. It passes
port 0 for http and transport, and then uses a special property to have
the node log the ports used for http and transport (just for tests).
This does not yet work for multi node tests. This brings us one step
closer to working with --parallel.
2015-12-11 17:36:08 -08:00
Ryan Ernst 47e922ba85 Add excludes and patterns as explicit inputs to forbidden patterns task 2015-12-11 08:26:38 -08:00
Jason Tedor 3383c24be0 Remove and forbid use of Collections#shuffle(List) and Random#<init>()
This commit removes and now forbids all uses of
Collections#shuffle(List) and Random#<init>() across the codebase. The
rationale for removing and forbidding these methods is to increase test
reproducibility. As these methods use non-reproducible seeds, production
code and tests that rely on these methods contribute to
non-reproducbility of tests.

Instead of Collections#shuffle(List) the method
Collections#shuffle(List, Random) can be used. All that is required then
is a reproducible source of randomness. Consequently, the utility class
Randomness has been added to assist in creating reproducible sources of
randomness.

Instead of Random#<init>(), Random#<init>(long) with a reproducible seed
or the aforementioned Randomess class can be used.

Closes #15287
2015-12-11 11:16:38 -05:00
Robert Muir bc140659a0 fail build on wildcard imports
Wildcard imports are terrible, they cause ambiguity in the code,
make it not compile with the future versions of java in many cases.

We should simply fail the build on this, it is messiness, caused by
messy Intellij configuration
2015-12-11 11:03:44 -05:00
Robert Muir 2741888498 Remove RuntimePermission("accessDeclaredMembers")
Upgrades lucene to 5.5.0-1719088, randomizedtesting to 2.3.2, and securemock to 1.2
2015-12-10 14:26:55 -05:00
Robert Muir e454fadc22 Merge branch 'master' into shave_mustache 2015-12-10 07:58:24 -05:00
Robert Muir b6fbd18e09 Merge pull request #15322 from rmuir/awesome
make slow tests more obvious
2015-12-09 15:05:53 -05:00
Ryan Ernst 46d73a13ff Merge branch 'master' into shave_mustache 2015-12-08 21:11:48 -08:00
Ryan Ernst 18698b9308 Build: Add build plugin for "messy" tests
We have some tests which have crazy dependencies, like on other plugins.
This change adds a "messy-test" gradle plugin which can be used for qa
projects that these types of tests can run in. What this adds over
regular standalone tests is the plugin properties and metadata on the
classpath, so that the plugins are properly initialized.
2015-12-08 19:48:39 -08:00
Robert Muir 2e299860e5 refactor mustache to lang-mustache plugin. No rest tests yet. 2015-12-08 22:45:21 -05:00
Robert Muir b0febc1b9f make slow tests more obvious 2015-12-08 13:05:15 -05:00
Ryan Ernst fa1c708ccd Merge branch 'master' into standalone_tests_intellij 2015-12-07 16:01:32 -08:00
Ryan Ernst 2dbd93d3b0 Tweaked module error message against non integ-test-zip and made checks
for limiting configuration to certain distributions prettier
2015-12-04 11:40:08 -08:00
Ryan Ernst 01d48e2062 Merge branch 'master' into jigsaw 2015-12-04 11:29:49 -08:00
Ryan Ernst a6752c4da9 Merge pull request #15210 from rjernst/buildsrc_test_cleanup
Cleanup integ test classes in buildSrc to be less groovyish
2015-12-04 11:24:21 -08:00
Ryan Ernst 4b1fc8ff22 Merge pull request #15226 from rjernst/fix_update_shas
Fix updateShas to not barf on disabled license checks and even compile correctly
2015-12-03 23:34:33 -08:00
Ryan Ernst f5b6b40a92 Fix distros to put modules dir int he right place and qa rest tests to
use the real zip
2015-12-03 23:03:14 -08:00
Ryan Ernst a8e9403204 added gradle checks for modules configuration, and ability to add
modules to integ test cluster
2015-12-03 20:53:06 -08:00
Ryan Ernst f2cebd9b3b Merge branch 'master' into jigsaw 2015-12-03 20:02:44 -08:00
Ryan Ernst 0be141e021 Build: Add .settings for buildSrc on gradle eclipse
We have eclipse settings added to all projects when running gradle
eclipse, but buildSrc is its own special project that is not
encapsulated by allprojects blocks. This adds eclipse settings to
buildSrc.
2015-12-03 19:56:11 -08:00
Ryan Ernst 17e6195fd6 Build: Fix updateShas to not barf on disabled license checks and even compile correctly
These were just results of not testing properly after refactoring.

closes #15224
2015-12-03 15:21:14 -08:00
Ryan Ernst caf77f7eea Add integ-test-zip distribution 2015-12-03 14:52:51 -08:00
Ryan Ernst b00c59398b Build: Cleanup test classes in buildSrc to be less groovyish 2015-12-03 01:49:54 -08:00
Robert Muir 1f626d3458 forbidden third-party-signatures -> core-signatures
This is a relic from shading where it was trickier to implement.
Third party signatures are already in e.g. the test list, there
is no reason to separate them out.

Instead, we could have a third party signatures that does
something different... like keep tabs on third party libraries.
2015-12-03 01:45:06 -05:00
Ryan Ernst f8026ed8fd Build: Fix dependency licenses check to correctly skip projects without dependencies 2015-12-02 11:03:56 -08:00
Jason Tedor 05430a788a Remove and forbid use of the type-unsafe empty Collections fields
This commit removes and now forbids all uses of the type-unsafe empty
Collections fields Collections#EMPTY_LIST, Collections#EMPTY_MAP, and
Collections#EMPTY_SET. The type-safe methods Collections#emptyList,
Collections#emptyMap, and Collections#emptySet should be used instead.
2015-12-02 10:41:59 -05:00
Robert Muir b7f497627f Merge pull request #15172 from rmuir/nuke_unused_deps
remove unused core dependencies
2015-12-02 07:20:11 -05:00
David Pilato 9c77cdc201 Fix build failure caused by Licenses Check in test-framework module
Typical failure:

```
:test-framework:dependencyLicenses (Thread[main,5,main]) started.
:test-framework:dependencyLicenses
Executing task ':test-framework:dependencyLicenses' (up-to-date check took 0.0 secs) due to:
  Task has not declared any outputs.
:test-framework:dependencyLicenses FAILED
:test-framework:dependencyLicenses (Thread[main,5,main]) completed. Took 0.023 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':test-framework:dependencyLicenses'.
> Licences dir /mnt/jenkins/workspace/es_core_master_strong/test-framework/licenses does not exist, but there are dependencies
```

Related to #15168
2015-12-02 10:08:35 +01:00
Ryan Ernst d68c6673a2 Build: Cleanup precommit task gradle code
This change attempts to simplify the gradle tasks for precommit. One
major part of that is using a "less groovy style", as well as being more
consistent about how tasks are created and where they are configured. It
also allows the things creating the tasks to set up inter task
dependencies, instead of assuming them (ie decoupling from tasks
eleswhere in the build).
2015-12-01 22:36:54 -08:00
Robert Muir 6e5c301739 remove unused dependencies 2015-12-01 22:22:11 -05:00
Ryan Ernst fcb6f44acf Build: Add ability to specify the compact profile for javac 2015-12-01 11:04:46 -08:00
Robert Muir f7e7a6bfad compile against compact3 profile 2015-12-01 09:40:54 -05:00
Ryan Ernst 4bb1eed766 Build: Increase the number of failed tests shown in test summary
We had increased this in maven, but it was lost in the transition to
gradle. This change adds it as a configurable setting the the logger for
randomized testing and bumps it to 25.
2015-11-30 13:40:39 -08:00
Ryan Ernst 0fa05edf03 Build: Improve output when integ test fails
This outputs a lot more info when integ tests fail to start, as well as
(should) fix windows (at least in my VM run) integ tests.
2015-11-29 19:44:43 -08:00
Robert Muir 93758874fb Merge pull request #15093 from rmuir/gradle_windoze_integ_tests
Fix integration tests and 'gradle run' to work on windoze
2015-11-29 12:15:30 -05:00
Robert Muir a01f86aaac Fix integration tests and gradle run to work on windoze 2015-11-29 07:39:18 -08:00
Ryan Ernst 8e25dc4f80 Merge pull request #15089 from rjernst/extra_config_file_delay
Fix delayed extra config file checks to be right before copy
2015-11-28 19:44:16 -08:00
Ryan Ernst 018c766bf7 Build: Fix delayed extra config file checks to be right before copy
The current delay waits until later after normal configuration, but
still just after resolution (ie when paths would be known for
dependencies but not actual execution). This delays the checks further
to be done right before we actually execute the copy task.

closes #15068
2015-11-28 18:06:36 -08:00
Ryan Ernst 1ee59e4977 Merge pull request #15088 from rjernst/integ_test_command_line
Move debug options setting to before command line is logged
2015-11-28 17:19:39 -08:00
Ryan Ernst f15ee9fa54 Build: Move debug options setting to before command line is logged
Currently if running with --info, the command line for ES, along with
env vars, are logged before they may be ammended to add debug options.
This moves the adding JAVA_OPTS to before we print the command.
2015-11-28 17:05:11 -08:00
Ryan Ernst 30fe74b5df Build: Setup standalone tests to compile in intellij
This adds the standalone tests so they will compile (and thus can be
modified with import completion) within IntelliJ. It also explicitly
sets up buildSrc as a module.

Note that this does *not* mean eg evil-tests can be run from intellij.
These are special tests that require special settings (eg disabling
security manager). They need to be run from the command line.

closes #15075
2015-11-28 16:57:09 -08:00
Nik Everett eba594fc08 Remove strange checks and clean dirs 2015-11-28 19:44:53 -05:00
Nik Everett 45e71329ee [build] Fix deb and rpm tests
Gradle is causing so much trouble here! Its too cute for its own good.
2015-11-28 19:07:06 -05:00
Robert Muir 66ae46ef8b Give enough ram so javac won't OOM
Today its based on the automatic -Xmx, but this
will fail in some environments (e.g. vagrant).
2015-11-26 02:16:46 -07:00
Ryan Ernst 139d688e24 Merge pull request #14996 from rjernst/logged_exec
Add wrapper around gradle Exec task for easier logging
2015-11-25 11:26:30 -08:00
Ryan Ernst bcb4be322f Build: Add wrapper around gradle Exec task for easier logging
The Exec task outputs stdout/stderr to the standard streams by default.
However, to keep output short, we currently capture this, and only
output if the task failed. This change makes a small wrapper around Exec
to facilitate this behavior anywhere we use Exec.
2015-11-25 11:26:02 -08:00
Ryan Ernst 52f31ee14a Build: Allow extra config for integ test to be anything project.file() accepts
This change delays the lookup for whatever is passed to extra config as
the source file to happen at execution time. This allows using eg a task
which generates a file, but maintains the checks that the file is not a
dir and that it exists at runtime.
2015-11-25 00:34:56 -08:00
Ryan Ernst d6969fcf3a Build: Split extra config files for integ test into separate task
This doesn't work when there are no extra config files, since gradle
sees the copy task and says "there is nothing to do".
2015-11-24 16:37:32 -08:00
Ryan Ernst 84d6cbd32a Build: Fix extra config to create a file, not a directory for the destination file
Also added some checks to catch misconfiguration (dir or non existing file).
2015-11-24 16:09:47 -08:00
Ryan Ernst 7b0a0ce0d9 Build: Add ability to specify extra configuration files for integ test
This change allows copy extra files into the integ test cluster before
it runs. However, it explicitly forbids overwriting elasticsearch.yml,
since that is generated.
2015-11-24 15:19:51 -08:00
Ryan Ernst 3a77d993fd Build: Copy rest specs for plugins that are added to integ test cluster
This change allows having rest tests using the api spec of plugins that
the rest test is testing against.
2015-11-24 14:34:21 -08:00
Ryan Ernst 1e0f929281 Build: Simplify adding plugins that are another project in the build
The current mechanism for adding plugins to the integTest cluster is to
have a FileCollection. This works well for the integTests for a single
plugin, which automatically adds itself to be installed. However, for qa
tests where many plugins may be installed, and from other projects, it
is cumbersome to add configurations, dependencies and dependsOn
statements over and over. This simplifies installing a plugin from
another project by moving this common setup into the cluster
configuration code.
2015-11-24 12:53:11 -08:00
Ryan Ernst f0e780bf86 Merge pull request #14959 from rjernst/cluster_waiting
Allow customizing wait condition and cluster settings
2015-11-24 08:24:00 -08:00
Ryan Ernst 647f324c46 Change waitfor max time back to 30 seconds, in case jenkins is slow 2015-11-24 08:23:16 -08:00
Ryan Ernst af496f5e7f Merge pull request #14925 from rjernst/maven_test_parity
Add back leaveTemporary and ifNoTests
2015-11-24 00:53:25 -08:00
Ryan Ernst 31b7e91e5a Build: Allow customizing wait condition and cluster settings
The current wait condition for an integ test cluster being up is a
simple http get on the root path for elasticsearch. However, it is
useful to allow having arbitrary wait conditions. This change reworks
the wait task to first check that each node process started successfully
and has a socket up, followed by an arbitrary wait condition which
defaults to the current http get.

Also, cluster settings are allowed to be added, and overriden. Finally,
custom setup commands are made relative to the elasticsearch home dir
for each node.
2015-11-24 00:48:58 -08:00
Ryan Ernst 529e442e2a Merge branch 'master' into attach_without_subdir 2015-11-23 15:01:55 -08:00
Ryan Ernst 5a62282150 Build: Rework extra plugins support to be through sibling directories
This change removes the subdirectory support for extra-plugins, and
replaces it with an iteration of sibling directories with the prefix
"extra-plugin-".
2015-11-23 14:15:45 -08:00
Michael McCandless e13b0d4bde upgrade lucene to 5.4.0-snapshot-1715952 2015-11-23 17:13:49 -05:00
Ryan Ernst 503d836ee4 Build: Add back leaveTemporary and ifNoTests
This change adds back the last of the missing test options to the juni4
wrapper. leaveTemporary is important in that setting it to true (which
is how we had it set in maven) removes the warnings we currently get
about a leftover file that cannot be deleted (from jna).
2015-11-22 22:18:42 -08:00
Ryan Ernst 7d3da7e6ee Build: Get multi node smoke tests working
This change adds back the multi node smoke test, as well as making the
cluster formation for any test allow multiple nodes. The main changes in
cluster formation are abstracting out the node specific configuration to
a helper struct, as well as making a single wait task that waits for all
nodes after their start tasks have run. The output on failure was also
improved to log which node's info is being printed.
2015-11-22 14:49:05 -08:00
Robert Muir 30529c008d Ban write access to system properties
* Forbid System.setProperties & co in forbidden APIs.
* Ban property write access at runtime with security manager.

Plugins that need to modify system properties will need to request permission in their plugin-security.policy
2015-11-21 22:33:06 -05:00
Ryan Ernst a2ef228d12 Build: Add precommit checks to standalone tests 2015-11-21 11:50:43 -08:00
Nik Everett 9b6e59bd57 [build] Survive missing directories 2015-11-20 17:38:50 -05:00
Ryan Ernst 61d62078f5 Merge pull request #14779 from rjernst/fork_compile
Use JDK at JAVA_HOME for compiling/testing, and improve build info output
2015-11-20 12:12:49 -08:00
Ryan Ernst df9cd96e9f Merge pull request #14858 from rjernst/check_jarhell
Add jar hell check before tests run
2015-11-20 11:35:49 -08:00
Ryan Ernst 6b734dc009 Remove debugging output from running jjs scripts 2015-11-20 11:31:46 -08:00
Ryan Ernst 63a7b155d8 Merge branch 'master' into fork_compile 2015-11-20 11:30:36 -08:00
Ryan Ernst c650d31ef1 Build: Improve integ test startup behavior
As part of the refactoring to allow --debug-jvm with gradle run, the way
java options are passed for integ tests was changed. However, we need to
make sure the jvm argline passed goes to ES_GC_OPTS because this
allows overriding things like which garbage collector we run, which we
do for testing from jenkins. This change adds back ES_GC_OPTS.
2015-11-19 13:06:47 -08:00
Ryan Ernst 1952b06cfe Merge pull request #14854 from rjernst/trick_ant
Fix integTest output if the elasticsearch script fails
2015-11-19 12:03:03 -08:00
Ryan Ernst e832fc6000 Make tmp file handling for jjs scripts better 2015-11-19 11:24:31 -08:00
Ryan Ernst d1a27aed16 Make the tmp file created for jjs scripts be deleted when gradle exits 2015-11-19 10:33:31 -08:00
Ryan Ernst c93f074183 Merge branch 'master' into fork_compile 2015-11-19 10:26:06 -08:00
Ryan Ernst 0e8958d1e8 Fix jarhell marker to be written on info logging, and document how the
marker file works.
2015-11-19 10:21:25 -08:00
Ryan Ernst fce0052fd9 Build: Add jar hell check before tests run
Because jar hell checks run during static initialization of tests, a
failure will result in all tests failing. However, only the first test
within each jvm shows the jarhell failure, and later tests get a class
not found exception for the class that failed to load when static init
failed.

This change adds a task to run as part of precommit, which checks the
test runtime classpath for jarhell.

closes #14721
2015-11-19 02:07:15 -08:00
Ryan Ernst d44dbd4757 Build: Fix integTest output if the elasticsearch script fails
If there is a failure in the elasticsearch start script, we currently
completely lose the failure. This is due to how spawning works with ant.
This change avoids the issue by introducing an intermediate script,
built dynamically before running ant exec, which runs elasticsearch and
redirects the output to a log file. This essentially causes us to run
elasticsearch in the foreground and capture the output, but at the same
time keep a running script which ant can pump streams from (which will
always be empty).
2015-11-18 23:30:33 -08:00
Ryan Ernst c273327246 Build: Improve test output on errors and when debugging
There were a number of subtle issues with the existing logging that
wraps events from Junit4 and ant. This change:
* Tweaks at what level certain events are logged
* Fixes -Dtests.output=always to force everything to be logged
* Makes -Dtests.class imply -Dtests.output=always
* Captures ant logging from junit4, so that direct jvm output will be
  logged on failure when not using gradle info logging
2015-11-18 16:36:07 -08:00
Nik Everett 8ffb63a177 Merge pull request #14718 from nik9000/gradle_deb
Get packaging working in gradle
2015-11-18 14:17:11 -05:00
Nik Everett 9b0a47d8e3 Fix rpm and deb distributions
and test them with vagrant
2015-11-18 14:16:42 -05:00
Nik Everett 19919a53a5 [build] Log launch command before starting ES 2015-11-18 12:25:27 -05:00
Nik Everett 1f67ef2526 [build] Log more information when es doesn't start 2015-11-18 10:58:52 -05:00
Nik Everett 22873dc952 [build] Output a message when can't find log file
When the build tries to start an elasticsearch instance but the start fails
if it fails to find the log file then we log a line about how we can't find
the file.
2015-11-18 10:43:01 -05:00
Ryan Ernst 9f59ba5abf Tweak debug startup message for run command, per PR comment 2015-11-17 17:18:44 -08:00
Ryan Ernst 0e8d605e2d Build: Add --debug-jvm option to run and integTest tasks
Sometimes when running elasticsearch, it is useful to attach a remote
debugger. This change adds a --debug-jvm option (the same name gradle
uses for its tests debug option), which adds java agent config for a
remote debugger. The configuration is set to hava java suspend until the
remove debugger is attached.

closes #14772
2015-11-17 16:29:01 -08:00
Nik Everett e0646eeb89 Merge pull request #14754 from nik9000/build
Make Build work without git
2015-11-17 13:30:23 -05:00
Nik Everett 0119caa4a6 Make Build work without git
If you build elasticsearch without a git repository it was creating a null
shortHash which was causing Elasticsearch not to be able to form transport
connections.

Closes #14748
2015-11-17 13:25:09 -05:00
Nik Everett 74aa18088c [build] Update progress logger after each test
This makes the rest tests **tons** more responsive.

Also stop test progress output from jumping by using formating. The progess
now looks like:
Suites [004/549], Tests [0019|0|0], in 1.58s J2 completed UpdateNumberOfReplicasTests

The changes included are:
1. The suites, total tests, and JVM id are now padded based on their maximum
size. The maximum number of tests is just a guess because that data isn't
easily available when the suite starts. JVM id rarely matters because only
the most crazy individuals use more than 10 JVMs.

2. The suite information is reordered. Now its runtime, jvm id, suite name,
and, optionally, method name. This reordering is useful because the thing
that varies in length, the suite and method name, are on the right hand
side. This means that nothing jumps around during the test run.
2015-11-17 13:16:17 -05:00
Ryan Ernst e837140385 Merge pull request #14791 from rjernst/run_away
Build: Make run command work within plugins
2015-11-17 09:09:26 -08:00
Ryan Ernst 50b48e7d8c Build: Make run command work within plugins
We recently got a run command with gradle, but it is sometimes useful to
run ES with a specific plugin. This is a start, by making each esplugin
have a run command which installs the plugin and runs elasticsearch in
the foreground.
2015-11-16 17:29:01 -08:00
Ryan Ernst 176f9e9d89 Build: Use a marker file to indicate forbidden patterns has run
This makes forbidden patterns a little smarter, so it does not need to
run on every build. It works because the marker file timestamp will be
compared against the source files (which are the inputs to forbidden
patterns).

closes #14788
2015-11-16 16:48:56 -08:00
Michael McCandless 01f12fc8d5 Merge pull request #14784 from mikemccand/upgrade_lucene_1714615
Upgrade Lucene to 5.4.0-snapshot-1714615
2015-11-16 16:07:46 -05:00
Michael McCandless a0bf253d16 upgrade lucene 5.4 snapshot 2015-11-16 14:38:05 -05:00
Ryan Ernst d872e2c527 Build: Use JDK at JAVA_HOME for compiling/testing, and improve build info output
We currently enforce JAVA_HOME is set, but use gradle's java version to
compile, and JAVA_HOME version to test. This change makes the compile
and test both use JAVA_HOME, and clarifies which java version is used by
gradle and that used for the compile/test.
2015-11-16 09:15:31 -08:00
Ryan Ernst 759fc94947 Build: Override Build-Date in jar manifest to be iso 8601 2015-11-14 22:38:10 -08:00
Ryan Ernst 5eb5480ea6 Improve wording of transitive deps hack explanation 2015-11-13 15:05:40 -08:00
Ryan Ernst 24d306c2f4 Add explanation of the configuration trick used to find transitive deps
for exclusion
2015-11-13 14:59:45 -08:00
Ryan Ernst be147719ff Remove artifacts left from testing 2015-11-13 14:20:14 -08:00
Ryan Ernst 1d38f0ac8e Remove forgotten println 2015-11-13 14:18:14 -08:00
Ryan Ernst 837c593ec2 Build: Effectively remove transitive deps from generated maven poms
With gradle, deploying to maven means first generating poms. These are
filled in based on dependencies of the project. Recently, we started
disallowing transitive dependencies. However, this configuration does
not translate to maven poms because maven has no concept of excluding
all transitive dependencies.

This change adds exclusions for each of the transitive deps of each
dependency being added to the maven pom. It does so by creating dummy
configurations for each direct dependency (which does not have
transitive deps excluded), so that we can iterate the transitive deps
when building the pom.

Note, this should be simpler (just modifying maven's pom model), but
gradle tries to hide that from their api, causing us to need to
manipulate the xml directly.
https://discuss.gradle.org/t/modifying-maven-pom-generation-to-add-excludes/12744
2015-11-13 14:10:17 -08:00
Ryan Ernst 9373382155 Build: Use ant exec for starting elasticsearch in integ tests
Currently elasticsearch in integ tests is started using an ant task on
windows, or gradle exec on everything else. However, gradle exec has
some flaws, one being Ctrl-C does not run finalizedBy tasks, which means
interrupting integ tests will leak a jvm. This change makes all systems
use ant exec. One caveat is, if there is any output by the jvm, we lose
it in ant bit heaven. But this is no different than what we had with
gradle. In the future, we should look at using a separate thread to
pump streams from the elasticsearch process.

closes #14701
2015-11-12 22:43:38 -08:00