Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
strategy:
matrix:
logstash: [ "7.16.3", "7.17.1", "8.3.2" ]
opensearch: [ "1.2.1" ]
opensearch: [ "1.3.4", "2.1.0" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean we don't want the 1.2.1 version at all?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other clients tests against all released version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we want to run the tests only on the latest released versions of 1.x and 2.x

secure: [ true, false ]

name: Integration Test logstash-output-opensearch against OpenSearch
Expand Down
2 changes: 1 addition & 1 deletion scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ RUN gem install bundler -v '< 2'
WORKDIR /usr/share/plugins/plugin
RUN bundle install --with test ci
COPY --chown=logstash:logstash . /usr/share/plugins/plugin
RUN bundle exec rake vendor
RUN bundle exec rake vendor
2 changes: 1 addition & 1 deletion scripts/logstash-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ wait_for_es() {
[[ $count -eq 0 ]] && exit 1
sleep 20
done
echo $(curl -s $SERVICE_URL | python -c "import sys, json; print(json.load(sys.stdin)['version']['number'])")
echo $(curl -s $SERVICE_URL | grep -oP '"number"[^"]+"\K[^"]+')
}

if [[ "$SECURE_INTEGRATION" == "true" ]]; then
Expand Down
8 changes: 7 additions & 1 deletion spec/integration/outputs/compressed_indexing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@
response = http_client.get("#{index_url}/_search?q=*&size=1000")
result = LogStash::Json.load(response.body)
result["hits"]["hits"].each do |doc|
expect(doc["_type"]).to eq(type)
# FIXME This checks for OpenSearch 1.x or OpenDistro which has version 7.10.x
# need a cleaner way to check this.
if OpenSearchHelper.check_version?("< 2") || OpenSearchHelper.check_version?("> 7")
expect(doc["_type"]).to eq(type)
else
expect(doc).not_to include("_type")
end
expect(doc["_index"]).to eq(index)
end
end
Expand Down
8 changes: 7 additions & 1 deletion spec/integration/outputs/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@
response = http_client.get("#{index_url}/_search?q=*&size=1000")
result = LogStash::Json.load(response.body)
result["hits"]["hits"].each do |doc|
expect(doc["_type"]).to eq(type)
# FIXME This checks for OpenSearch 1.x or OpenDistro which has version 7.10.x
# need a cleaner way to check this.
if OpenSearchHelper.check_version?("< 2") || OpenSearchHelper.check_version?("> 7")
expect(doc["_type"]).to eq(type)
else
expect(doc).not_to include("_type")
end
expect(doc["_index"]).to eq(index)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/outputs/parent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
require_relative "../../../spec/opensearch_spec_helper"
require "logstash/outputs/opensearch"

context "join field tests", :integration => true do
context "join field tests", :integration => true && OpenSearchHelper.check_version?("<2") do

shared_examples "a join field based parent indexer" do
let(:index) { 10.times.collect { rand(10).to_s }.join("") }
Expand Down
10 changes: 10 additions & 0 deletions spec/opensearch_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ def self.version
RSpec.configuration.filter[:version]
end

def self.check_version?(*requirement)
version = self.version
if version.nil? || version.empty?
puts "version tag isn't set. Returning false from 'check_version?`."
return false
end
release_version = Gem::Version.new(version).release
Gem::Requirement.new(requirement).satisfied_by?(release_version)
end

RSpec::Matchers.define :have_hits do |expected|
match do |actual|
expected == actual['hits']['total']['value']
Expand Down