Skip to content

Commit cf9ff83

Browse files
committed
[Build] Tidy up, and fix secure integration tests
Adds a DISTRIBUTION environment variable, which can be: legacy: OSS < 6.3 legacyxpack: < 6.3 with xpack plugin oss: OSS >= 6.3 default: standard distribution >= 6.3 Removes the exclusion filter for `secure_integration` - this was stopping secure integration tests from running even with tags on Updates logstash branch to 6.4
1 parent 4ad777c commit cf9ff83

File tree

3 files changed

+32
-38
lines changed

3 files changed

+32
-38
lines changed

.travis.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ language: ruby
44
cache: bundler
55
env:
66
- INTEGRATION=false
7-
- INTEGRATION=true ES_VERSION=1.7.6 TEST_DEBUG=true
8-
- INTEGRATION=true ES_VERSION=2.4.4 TEST_DEBUG=true
9-
- INTEGRATION=true ES_VERSION=5.6.9 TEST_DEBUG=true
10-
- OSS=true INTEGRATION=true ES_VERSION=6.4.2 TEST_DEBUG=true
11-
- OSS=false INTEGRATION=true ES_VERSION=6.4.2 TEST_DEBUG=true
12-
- INTEGRATION=true ES_VERSION=master TEST_DEBUG=true
13-
- SECURE_INTEGRATION=true INTEGRATION=true ES_VERSION=5.6.9 TEST_DEBUG=true
14-
- OSS=false SECURE_INTEGRATION=true INTEGRATION=true ES_VERSION=6.4.2 TEST_DEBUG=true
7+
- DISTRIBUTION=legacy INTEGRATION=true ES_VERSION=1.7.6 TEST_DEBUG=true
8+
- DISTRIBUTION=legacy INTEGRATION=true ES_VERSION=2.4.4 TEST_DEBUG=true
9+
- DISTRIBUTION=legacy INTEGRATION=true ES_VERSION=5.6.9 TEST_DEBUG=true
10+
- DISTRIBUTION=oss INTEGRATION=true ES_VERSION=6.4.2 TEST_DEBUG=true
11+
- DISTRIBUTION=default INTEGRATION=true ES_VERSION=6.4.2 TEST_DEBUG=true
12+
- DISTRIBUTION=default INTEGRATION=true ES_VERSION=master TEST_DEBUG=true
13+
- DISTRIBUTION=legacyxpack SECURE_INTEGRATION=true INTEGRATION=true ES_VERSION=5.6.9 TEST_DEBUG=true
14+
- DISTRIBUTION=default SECURE_INTEGRATION=true INTEGRATION=true ES_VERSION=6.4.2 TEST_DEBUG=true
1515

1616
rvm:
1717
- jruby-1.7.25
@@ -22,11 +22,11 @@ matrix:
2222
- rvm: jruby-9.1.13.0
2323
env: LOGSTASH_BRANCH=6.x
2424
- rvm: jruby-9.1.13.0
25-
env: LOGSTASH_BRANCH=6.2
25+
env: LOGSTASH_BRANCH=6.4
2626
- rvm: jruby-1.7.27
2727
env: LOGSTASH_BRANCH=5.6
2828
allow_failures:
29-
- env: INTEGRATION=true ES_VERSION=master TEST_DEBUG=true
29+
- env: DISTRIBUTION=default INTEGRATION=true ES_VERSION=master TEST_DEBUG=true
3030
fast_finish: true
3131
install: true
3232
script: ci/build.sh

ci/run.sh

+22-22
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@ setup_es() {
3232
# If we're running with xpack SSL/Users enabled...
3333
# Note that 6.3.0 releases and above do not require an x-pack plugin install
3434

35-
if [[ "$SECURE_INTEGRATION" == "true" ]]; then
36-
if [[ -z "$OSS" ]]; then
37-
if [[ "$xpack_download_url" == "" ]]; then
38-
yes y | elasticsearch/bin/elasticsearch-plugin install x-pack
39-
else
40-
curl -sL $xpack_download_url > elasticsearch/xpack.zip
41-
yes y | elasticsearch/bin/elasticsearch-plugin install file://$BUILD_DIR/elasticsearch/xpack.zip
42-
fi
35+
if [[ "$DISTRIBUTION" == "legacyxpack" ]]; then
36+
if [[ "$xpack_download_url" == "" ]]; then
37+
yes y | elasticsearch/bin/elasticsearch-plugin install x-pack
38+
else
39+
curl -sL $xpack_download_url > elasticsearch/xpack.zip
40+
yes y | elasticsearch/bin/elasticsearch-plugin install file://$BUILD_DIR/elasticsearch/xpack.zip
4341
fi
42+
fi
43+
44+
if [[ "$SECURE_INTEGRATION" == "true" ]]; then
4445
es_yml=elasticsearch/config/elasticsearch.yml
4546
cp -rv $BUILD_DIR/spec/fixtures/test_certs elasticsearch/config/test_certs
4647
echo "xpack.security.http.ssl.enabled: true" >> $es_yml
@@ -58,18 +59,17 @@ start_es() {
5859
es_url="http://localhost:9200"
5960
if [[ "$SECURE_INTEGRATION" == "true" ]]; then
6061
es_url="https://localhost:9200 -k"
61-
62-
# Needed for travis. On travis the `users` script will fail because it will first try and write
63-
# to /etc/elasticsearch
64-
export CONF_DIR=$BUILD_DIR/elasticsearch/config
65-
66-
if [[ "$OSS" == "false" ]]; then
67-
elasticsearch/bin/elasticsearch-users useradd simpleuser -p abc123 -r superuser
68-
elasticsearch/bin/elasticsearch-users useradd 'f@ncyuser' -p 'ab%12#' -r superuser
69-
else
70-
elasticsearch/bin/x-pack/users useradd simpleuser -p abc123 -r superuser
71-
elasticsearch/bin/x-pack/users useradd 'f@ncyuser' -p 'ab%12#' -r superuser
72-
fi
62+
fi
63+
# Needed for travis. On travis the `users` script will fail because it will first try and write
64+
# to /etc/elasticsearch
65+
export CONF_DIR=$BUILD_DIR/elasticsearch/config
66+
67+
if [[ "$DISTRIBUTION" == "default" ]]; then
68+
elasticsearch/bin/elasticsearch-users useradd simpleuser -p abc123 -r superuser
69+
elasticsearch/bin/elasticsearch-users useradd 'f@ncyuser' -p 'ab%12#' -r superuser
70+
elif [[ "$DISTRIBUTION" == "legacyxpack" ]]; then
71+
elasticsearch/bin/x-pack/users useradd simpleuser -p abc123 -r superuser
72+
elasticsearch/bin/x-pack/users useradd 'f@ncyuser' -p 'ab%12#' -r superuser
7373
fi
7474

7575
while ! curl --silent $es_url && [[ $count -ne 0 ]]; do
@@ -139,9 +139,9 @@ else
139139
bundle exec rspec -fd $extra_tag_args --tag update_tests:painless --tag update_tests:groovy --tag es_version:$es_distribution_version $spec_path
140140
;;
141141
6.*)
142-
if [[ "$OSS" == "true" ]]; then
142+
if [[ "$DISTRIBUTION" == "oss" ]]; then
143143
setup_es https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-${ES_VERSION}.tar.gz
144-
else
144+
elif [[ "$DISTRIBUTION" == "default" ]]; then
145145
setup_es https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz
146146
fi
147147
es_distribution_version=$(get_es_distribution_version)

spec/es_spec_helper.rb

-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
require 'manticore'
33
require 'elasticsearch'
44

5-
# by default exclude secure_integration tests unless requested
6-
# normal integration specs are already excluded by devutils' spec helper
7-
RSpec.configure do |config|
8-
config.filter_run_excluding config.exclusion_filter.add(:secure_integration => true)
9-
end
10-
115
module ESHelper
126
def get_host_port
137
"127.0.0.1:9200"

0 commit comments

Comments
 (0)