Skip to content

Commit be8af3e

Browse files
committed
fix spec suite argument passing and other minor bugs
1 parent 65087a9 commit be8af3e

File tree

4 files changed

+28
-11
lines changed

4 files changed

+28
-11
lines changed

spec/integration/outputs/routing_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
before do
1313
subject.register
1414
event_count.times do
15-
subject.receive(LogStash::Event.new("message" => "Hello World!", "type" => type))
15+
subject.receive(LogStash::Event.new("message" => "test", "type" => type))
1616
end
1717
end
1818

spec/integration/outputs/templates_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@
7373
end
7474

7575
it "make [geoip][location] a geo_point" do
76-
results = @es.search(:body => { "query" => { "bool" => { "must" => { "match_all" => {} }, "filter" => { "geo_distance" => { "distance" => "1000km", "geoip.location" => { "lat" => 0.5, "lon" => 0.5 } } } } } })
77-
insist { results["hits"]["total"] } == 1
78-
insist { results["hits"]["hits"][0]["_source"]["geoip"]["location"] } == [ 0.0, 0.0 ]
76+
expect(@es.indices.get_template(name: "logstash")["logstash"]["mappings"]["_default_"]["properties"]["geoip"]["properties"]["location"]["type"]).to eq("geo_point")
7977
end
8078

8179
it "aggregate .raw results correctly " do

spec/integration/outputs/update_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require_relative "../../../spec/es_spec_helper"
22

3-
describe "Update actions", :integration => true do
3+
describe "Update actions", :integration => true, :version_2x_plus => true do
4+
45
require "logstash/outputs/elasticsearch"
56
require "elasticsearch"
67

travis-run.sh

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
#!/bin/bash
22
set -ex
33

4+
function finish {
5+
last_result=$?
6+
set +e
7+
[[ $last_result -ne 0 ]] && cat /tmp/elasticsearch.log
8+
}
9+
trap finish EXIT
10+
411
setup_es() {
512
download_url=$1
613
curl -sL $download_url > elasticsearch.tar.gz
@@ -10,10 +17,17 @@ setup_es() {
1017
}
1118

1219
start_es() {
13-
es_args=$1
14-
elasticsearch/bin/elasticsearch $es_args > /tmp/elasticsearch.log &
15-
sleep 10
16-
curl http://localhost:9200 && echo "ES is up!" || cat /tmp/elasticsearch.log
20+
es_args=$@
21+
elasticsearch/bin/elasticsearch $es_args > /tmp/elasticsearch.log 2>/dev/null &
22+
count=120
23+
echo "Waiting for elasticsearch to respond..."
24+
while ! curl --silent localhost:9200 && [[ $count -ne 0 ]]; do
25+
count=$(( $count - 1 ))
26+
[[ $count -eq 0 ]] && return 1
27+
sleep 1
28+
done
29+
echo "Elasticsearch is Up !"
30+
return 0
1731
}
1832

1933
if [[ "$INTEGRATION" != "true" ]]; then
@@ -22,10 +36,14 @@ else
2236
if [[ "$ES_VERSION" == 5.* ]]; then
2337
setup_es https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/$ES_VERSION/elasticsearch-$ES_VERSION.tar.gz
2438
start_es -Ees.script.inline=true -Ees.script.indexed=true -Ees.script.file=true
25-
bundle exec rspec -fd spec --tag integration --tag version_5x
26-
else
39+
bundle exec rspec -fd spec --tag integration --tag version_5x --tag integration_2x_plus
40+
elif [[ "$ES_VERSION" == 2.* ]]; then
2741
setup_es https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-$ES_VERSION.tar.gz
2842
start_es -Des.script.inline=on -Des.script.indexed=on -Des.script.file=on
2943
bundle exec rspec -fd spec --tag integration --tag ~version_5x
44+
else
45+
setup_es https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-$ES_VERSION.tar.gz
46+
start_es -Des.script.inline=on -Des.script.indexed=on -Des.script.file=on
47+
bundle exec rspec -fd spec --tag integration --tag ~version_5x --tag ~version_2x_plus
3048
fi
3149
fi

0 commit comments

Comments
 (0)