Commit graph

253 commits

Author SHA1 Message Date
Rob Bavey
61edaaffd6 [Build] Clear JAVA_HOME to use bundled JDK for Elasticsearch
This commit clears the `JAVA_HOME` variable when starting Elasticsearch
to force it to use the bundled version of the JDK, rather than the
default `JAVA_HOME` from the machine Logstash integration tests are being
run on, and removes the likelihood of tests failing to run due to `JAVA_HOME`
being set to a non-compliant JDK.
2020-07-08 06:01:42 -07:00
Rob Bavey
5fc70e31f2 Add wait functionality to stop_es integration test helper function
Integration tests may fail during elasticsearch teardown, as currently
the stop_es function sends a `SIGTERM` to Elasticsearch, but does not
wait for the process to exit. That can lead to issues when deleting
data directories from a still running process. This commit adds
wait functionality to `stop_es` to wait for a short period of time,
sending a `SIGKILL` if Elasticsearch does not terminate in time.
2020-06-30 14:07:01 -07:00
Rob Bavey
8df9d2c045 Use branch appropriate version of Elasticsearch
Carrying on from the work done in #11958, update the gradle build to download
the same version of Elasticsearch as is specified in the logstash version.yml file.
This commit updates the standard integration tests to use the same version of
Elasticsearch that is already downloaded for x-pack integration tests, and also
fixes integration tests to allow for the different responses around hits generated
by different versions of Elasticsearch.
2020-06-16 06:32:16 -07:00
Joao Duarte
34f7151411 remove uses of JSON.load in favor or JSON.parse
JSON.load allows the creation of complex objects, and should not
be given untrusted input. This commit changes the only three uses
of JSON.load in the codebase, which aren't user facing or present
in bundled product, so not really an attact vector.
2020-06-12 07:48:05 -07:00
Rob Bavey
2b0ae1aac9
Retrieve branch version of Filebeat via gradle (#11958)
This commit changes the download to pull the version of beats based on the version pulled from the branch rather than from an environment variable, or 6.5.4.
This commit also moves the download logic of Filebeat fromfilebeat_setup.sh to build.gradle in order to use the artifacts API in the same way as the downloadEs task, and does some refactoring to DRY up the artifact download tasks.
This commit also fixes the beats integration test to replace the use of a removed setting.
This commit also sets retries to 3 for the download tasks, using 'retries' functionality from gradle download task plugin
2020-06-11 11:27:10 -04:00
Joao Duarte
a7ae0d55e6 update log4j script routes definition
fixes the change introduced with https://issues.apache.org/jira/browse/LOG4J2-2647
2020-06-09 06:26:31 -07:00
Rob Bavey
6712be9a58 Give more options for testing with ruby while waiting for port
Try system ruby, then LS_HOME/bin/ruby, then relative path from
script to LS_HOME/bin/ruby. Use LS_RUBY_HOME variable to avoid
testing again on subsequent attempts to wait for port.
2020-06-08 07:36:31 -07:00
Rob Bavey
e47426de3e
[Test] Set beats permission checking to strict=false (#11949)
When running filebeats integration tests on centos-7, the tests
fail due to permsisions checks on the temporary configuration file
created for the test. This commit sets strict permissions checks
to false in order for the tests to be able to succeed.
2020-06-01 14:40:18 -04:00
Rob Bavey
71a6a36b18
[Test] Fix service script execution when path includes && (#11944)
A previous commit attempted to fix this issue by adding Shellwords.escape to setup_script and teardown_script locations, but File.exists? returns false when called against a filename escaped by Shellwords.escape. This commit localizes the escaping to where the
file is executed.

This commit also adds Shellwords.escape to teardown script runner and the method used to execute logstash to retrieve version. This is to enable tests to run correctly when Jenkins creates execution environments with folders named with &&, eg centos-7&&immutable
2020-06-01 09:27:35 -04:00
Rob Bavey
81faf8e1dd
[Test] Enable fallback to sleep if nc not installed (#11942)
Fixture test scripts use `nc` to wait for the port to determine
whether a test fixture is up and running. This commit adds a fall
back option to use ruby if `nc` is not available - it is not installed
on Jenkins centos worker nodes.
2020-05-29 12:46:24 -04:00
Rob Bavey
ac95667c11
Use task avoidance API in gradle scripts (#11914)
* Use task avoidance API in gradle scripts

This commit uses the task avoidance api (tasks.register vs task.create/
task DSL), as recommended since Gradle 5.1

This should reduce the execution of unnecessary tasks in build jobs, and
hopefully improve build resiliency and execution time.
2020-05-29 10:25:52 -04:00
Andrea Selva
9f56b468f2 merge 2020-05-27 15:28:33 +00:00
Rob Bavey
728251a43c
Fix prepare_offline_spec.rb test (#11933)
The 'prepare_offline_spec.rb' is failing due to a change in the warning message
from JDK11 to JDK14, and JAVA_TOOL_OPTIONS being passed in as an environment
variable by Jenkins, which was not happening before due to the dockerized
environment.
2020-05-27 10:53:10 -04:00
Rob Bavey
cdd37bfa83
Escape test fixture service scripts (#11931)
Escape test fixture service scripts to avoid test failures when run in
Jenkins using multiple yaml configuration files, which causes directories
to be constructed like `centos-7&&immutable` which cause issues with
the service runners cutting off directory locations before '&&'
2020-05-27 10:52:55 -04:00
andsel
821f85e73f Fix integration tests related to logs when persistent_queue FEATURE_FLAG is enabled
Updated log4j definitions used when FEATURE_FLAG=persistent_queue is used.

Closes #11924
2020-05-26 18:40:32 +02:00
Rob Bavey
c75260d5b5 Quieten down kafka teardown script
Kafka teardown script can exit with failure, typically when trying to
stop the broker. This commit logs the error code if the scripts fail
rather than crash out causing build failure.

Fixes #11905
2020-05-19 09:48:31 -04:00
Joao Duarte
e2d48b4e61 download kafka from another mirror
the current mirror now refuses connections for the past 36 hours

Fixes #11887
2020-05-11 08:15:37 +00:00
Rob Bavey
d35677aefa
Fail fast when integration test fixtures cannot be setup. (#11855)
* Fail fast when integration test fixtures cannot be setup.

Currently when integration test fixture setup fails, the tests proceed as usual,
resulting in noisy logs where the source of the error is not easy to discover.
This commit will raise an exception and log the exit status if the script fails to
setup or teardown.
2020-05-04 12:15:52 -04:00
Rob Bavey
df92df0237 Update kafka version for integration tests.
Fixes #11806
2020-04-17 21:00:07 +00:00
Rob Bavey
58314a7f0e
Update gradle version to 6.3 (#11742)
* Update gradle version to 6.3

Gradle versions prior to 6.3 cannot run under JDK14.
This commit upgrades the version of Gradle to 6.3, and removes all deprecation warnings that can currently be removed.

Changes include:
* Increase gradle memory to 2g
* Increase gradle memory in the license check job to 2g
* Replace use of `testCompile`
* Replace `runtime` with `runtimeOnly`
* Remove`compile` depedencies from gradle files
* Replace deprecated archive methods
* Fix dependencies report build
* Make jruby dependencies 'api', fix archiveVersion
* Set `duplicatesStrategy` for all tasks of type Copy
* Use `configureEach` for global 'withType' calls
** Use the recommended Tasks API calls
(https://blog.gradle.org/preview-avoiding-task-configuration-time)
* Run `./gradlew wrapper` earlier to improve caching
* Use copy with chown for resources that need to be run during `./gradlew wrapper`
2020-04-07 12:49:36 -04:00
andsel
b2d1b880a6 Introduced JDK environment variable to explicitly pass the JAVA_HOME to use, expanded Xmx usable by Gradle
Fixes #11708
2020-03-30 10:53:18 +00:00
João Duarte
e9c9865f40
Add apache and elastic license headers to source code files (#11673)
* add license header to ruby and java files
* add license header to erb and rake files
* add license headers to gradle files
2020-03-11 11:53:38 +00:00
Karol Bucek
7b4808bd10 Fix: broken --help due sinatra 2.x upgrade
Fixes #11634
2020-03-03 21:00:10 +00:00
andsel
6eb25173e0 Added plugin.id to fish tag log lines related to plugins
Fixes #11078
2020-01-23 15:33:31 +00:00
Rob Bavey
879ec5ba2b Update offline pack tests for integration plugins
Fix wildcard "logstash-filter-*" test
Add test for offline packaging of integaration plugins

Fixes #11406
2020-01-10 19:07:54 +00:00
andsel
f554930e81 Introduced DeprecationLogger for use in core code and exposed to Java and Ruby plugins. Closes 11049
Fixes #11260
2019-11-14 10:49:27 +00:00
João Duarte
10d62f0168 Disable dlq integration tests due to multiple intermittent failures
Fixes #11244
2019-10-18 16:09:25 +00:00
andsel
f3fac29d55 Fixes intermittent failing build due to Puma server going down bad on shutdown request
Fixes #11242
2019-10-18 11:28:45 +00:00
Joao Duarte
1e461dee22 more resilient testing of logging level setting
Fixes #11230
2019-10-17 13:04:14 +00:00
Ry Biesemeyer
f6fa136b84 plugins: replace kafka input/output with integration
Fixes #11218
2019-10-16 01:46:49 +00:00
andsel
e58a6e01ce Added LS configuration variable 'pipeline.separate_logs' to separate logs per pipelines - use log4j RoutingAppender - avoid output to main log files when log per pipeline is enabled - closes 10427
Fixes #11108
2019-10-08 14:07:17 +00:00
andsel
0e622cc744 Added origins of pipeline's configuration (es config string, the paths of config files used, module).
closes 9630
2019-09-12 16:02:36 +02:00
andsel
cda592f659 Add pipeline.id to log lines
fixes #8290, #10521
2019-08-28 17:57:28 +02:00
Dan Hermann
ed91408ffd Integration test for Java plugins
Fixes #11054
2019-08-20 19:22:06 +00:00
Dan Hermann
dae3eecca5 Expand config variables for Java plugins
Fixes #11043
2019-08-13 19:36:41 +00:00
Dan Hermann
73346d20f5 Update Reflections library
Fixes #10951
2019-07-16 11:59:29 +00:00
João Duarte
d15f6c3631
Rename filebeat.prospectors to filebeat.inputs (#10711)
In filebeat prospectors settings have been renamed to inputs. When
prospectors is used a deprecation warning is printed. With 7.0
`filebeat.prospectors` will be removed.

This change updates all uses of prospectors with inputs. For now
filebeat events report `prospector.type` and `input.type` for
compatibility reasons.
2019-04-23 18:37:28 +01:00
Rob Bavey
03edd76abd Update Kafka version to fix build
Fixes #10608
2019-03-28 19:37:17 +00:00
Joao Duarte
0e115d31a6 cleanup many rakelib tasks that aren't used anymore
* simplify the plugins-metadata.json file
* sort and update the plugin list in the rakelib/plugins-metadata.json
* remove dependency on twitter input for testing
* sorted Gemfile.template (grouped by group)
* remove default plugins from Gemfile.template

Fixes #10509
2019-03-15 16:26:58 +00:00
Guy Boertje
8605760d97 Mute CI integration DLQ acceptance test
Fixes #10504
2019-02-27 17:44:57 +00:00
Ry Biesemeyer
583ec6b625
Java 11 support (#10279)
* bump jruby to 9.2

* don't rely on logstash-base docker image

* work around webmock ruby 2.5 support

* ensure data folder exists in docker

* change fixnum and bignum to integer

* FileUtils.rmdir to rm_rf

this is because from 2.3 to 2.5 FileUtils.rmdir will throw an exception
if the directory isn't empty. On 2.3 the operation will just not delete
the directory silently.

* bump jruby to 9.2.5.0 and fix test

* make rake default task since prepare pack needs it

* Resolve compiler warnings (#10247)

There are 3 types of compiler warnings that are either resolved or suppressed:

1. Rawtypes: In JRuby 9.2, `RubyArray` is a generic, so references throughout
   our codebase to the now "raw" type trigger warnings. In most cases we cannot
   actually resolve the issue, since the JRuby-provided methods for creating
   `RubyArray`s still return the raw type, so these have been suppressed.

2. Deprecations:
   - `RubyString#intern19()` -> `RubyString#intern()`
   - `RubyString#downcase19(ThreadContext)` -> `RubyString#downcase(ThreadContext)`
   - `NativeException`: remove import & reference directly; suppress usage
     warnings
   - `RaiseException()`: migrate to equivalent non-deprecated methods wherever
     possible; in some cases where we are using this in conjunction with the
     also-deprecated `NativeException` to preserve java stacktraces, there
     seems to be no non-deprecated path forward, so these cases have been
     suppressed.

3. Redundant Casts
   - Resolved

* JRuby 9.2 bundler shenanigans (#10266)

* Revert "Revert "remove forced dependency on old bundler (#9395)""

This reverts commit bef984143d.

* plugin management: update internal bundler to 1.17.x APIs

* deps: update dev dependency webmock to version compatible with JRuby 9.2

* spec: update Pack fixture to include manticore version that doesn't conflict

* build: update gradle to version that has Java 11 support

* java11: resolve or suppress deprecation warnings

* Remove superfluous flag opting into ParNew GC implementation

When opting into CMS garbage collector with `XX:+UseConcMarkSweepGC`, the
young generation collector ParNew has been the default since Java 8, making
the `XX:+UseParNew` flag redundant; the flag was removed in Java 9, and
should no longer be specified to work with modern Javas.

https://bugs.openjdk.java.net/browse/JDK-8006478
https://openjdk.java.net/jeps/214

* spec: set thread name to example description for easier debugging

* spec: prevent errors in testing specs by checking against skip list before using

* no-op: remove use of `HashMap#computeIfAbsent` on single-threaded code

> This method will, on a best-effort basis, throw a `ConcurrentModificationException`
> if it is detected that the mapping function modifies this map during computation.
>
> -- https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/HashMap.html#computeIfAbsent(K,java.util.function.Function)

* qa: by default, run integration against Elastic Stack 6.5.x

To support development on Logstash on top of Java 11, default to testing
against an Elastic Stack that is capable of running on Java 11.

* qa: ignore deprecation warnings when comparing offline pack output

* qa: add Java 9+ support to ChildProcess dev dependency

this can safely be removed when the childprocess gem supports Java9+
https://github.com/enkessler/childprocess/pull/141

* qa: allow connections to localhost in webmock

* bump jrjackson version

* fix filebeat integration tests

* spec: ensure license compliance spec runs first

The license compliance spec that validates the licenses of bundled
plugins appears to not be compatible with the hooks that we inject
into bundler for plugin management, and will fail in obscure ways
when run after those hooks have been added. Since those hooks are
not necessary for validating licenses, the easiest solution was to
ensure that those specs run first, before the VM has been poluted.

Since the gradle/junit/rspec bridge that is currently in place
runs all specs in the same JVM, we also need to make sure that the
rspec "world" is reset before a run, to ensure that it doesn't
retain spec definitions from previous runs.

Also updates the rake invocation, although I'm not sure it is used
any more.
2019-02-04 16:36:11 -08:00
Ry Biesemeyer
dc174b2802 tests: remove kafka deprecated --new-consumer flag in setup
> KIP-176 removes the `--new-consumer` option for all consumer based tools.
> This option is redundant since the new consumer is automatically used if
> `--bootstrap-server` is defined.
>
> -- [Kafka 2.0.0 Changelog](https://kafka.apache.org/documentation/#upgrade_200_notable)

Fixes #10217
2018-12-17 22:56:18 +00:00
João Duarte
bef984143d
Revert "remove forced dependency on old bundler (#9395)"
This reverts commit ab20b40e47.

Due to failing tests like https://logstash-ci.elastic.co/job/elastic+logstash+master+multijob--ruby-unit-tests/86/
2018-12-03 13:49:54 +00:00
João Duarte
ab20b40e47
remove forced dependency on old bundler (#9395)
* update bundler to 1.17.1

This commit required some tweaking of how we setup Bundler
due to changes in reset behaviour, an internal variable name change,
and the Bundler::Settings api changing.
2018-11-30 09:25:24 +00:00
Rob Bavey
c02440170d Update Kafka download version
Fixes #10172
2018-11-21 22:17:32 +00:00
Dan Hermann
cb426ae89e Fix integration tests to work with the useragent filter at either version 3.2.2 or 3.2.3
Fixes #10021
2018-09-26 12:58:16 +00:00
Dan Hermann
669ccad8f6 fix integration tests to work with version 3.2.3 of the useragent filter
Fixes #10019
2018-09-25 19:17:12 +00:00
Josh Soref
c6cd247ec3 Multiple spelling corrections (#9782)
* spelling: actually
* spelling: already
* spelling: concurrency
* spelling: constructor
* spelling: destinations
* spelling: different
* spelling: elasticsearch
* spelling: encoding
* spelling: error
* spelling: explicitly
* spelling: failings
* spelling: falsey
* spelling: guarantees
* spelling: having
* spelling: implementation
* spelling: logstash
* spelling: module
* spelling: multiple
* spelling: omitted
* spelling: overridden
* spelling: pipeline
* spelling: raspberry
* spelling: receive
* spelling: recommended
* spelling: registered
* spelling: registering
* spelling: shutdown
* spelling: signal
* spelling: specified
* spelling: successful
* spelling: successfully
* spelling: valuefied
* spelling: vector
2018-07-04 10:41:10 +01:00
Ry Biesemeyer
d6b9d0f398 prevent tests from stalling by ensuring files we check get flushed
Fixes #9795
2018-06-29 18:35:51 +00:00
Dan Hermann
48594baf2b Add license reporting task
Fixes #9331
2018-05-02 15:35:42 +00:00