Fix xpack integration tests to work with new ES hits format (#10220)

This commit is contained in:
Dan Hermann 2018-12-18 13:17:18 -06:00 committed by GitHub
parent 47e1bd252f
commit a213a6f62a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -33,6 +33,6 @@ describe "Monitoring is disabled" do
let(:monitoring_index) { ".monitoring-logstash-2-*" } let(:monitoring_index) { ".monitoring-logstash-2-*" }
it "doesn't record any metrics" do it "doesn't record any metrics" do
expect(elasticsearch_client.search(:index => monitoring_index)["hits"]["total"]).to eq(0) expect(elasticsearch_client.search(:index => monitoring_index)["hits"]["total"]["value"]).to eq(0)
end end
end end

View file

@ -19,7 +19,7 @@ shared_examples "record monitoring data to es" do
Stud.try(max_retry.times, retryable_errors) do Stud.try(max_retry.times, retryable_errors) do
elasticsearch_client.indices.refresh elasticsearch_client.indices.refresh
api_response = elasticsearch_client.search :index => MONITORING_INDEXES, :body => {:query => {:term => {"type" => "logstash_stats"}}} api_response = elasticsearch_client.search :index => MONITORING_INDEXES, :body => {:query => {:term => {"type" => "logstash_stats"}}}
expect(api_response["hits"]["total"]).to be > 0 expect(api_response["hits"]["total"]["value"]).to be > 0
api_response["hits"]["hits"].each do |full_document| api_response["hits"]["hits"].each do |full_document|
document = full_document["_source"]["logstash_stats"] document = full_document["_source"]["logstash_stats"]
expect(JSON::Validator.fully_validate(schema_file, document)).to be_empty expect(JSON::Validator.fully_validate(schema_file, document)).to be_empty
@ -35,7 +35,7 @@ shared_examples "record monitoring data to es" do
Stud.try(max_retry.times, retryable_errors) do Stud.try(max_retry.times, retryable_errors) do
elasticsearch_client.indices.refresh elasticsearch_client.indices.refresh
api_response = elasticsearch_client.search :index => MONITORING_INDEXES, :body => {:query => {:term => {"type" => "logstash_state"}}} api_response = elasticsearch_client.search :index => MONITORING_INDEXES, :body => {:query => {:term => {"type" => "logstash_state"}}}
expect(api_response["hits"]["total"]).to be > 0 expect(api_response["hits"]["total"]["value"]).to be > 0
api_response["hits"]["hits"].each do |full_document| api_response["hits"]["hits"].each do |full_document|
document = full_document["_source"]["logstash_state"] document = full_document["_source"]["logstash_state"]
expect(JSON::Validator.fully_validate(schema_file, document)).to be_empty expect(JSON::Validator.fully_validate(schema_file, document)).to be_empty