fix remaining race condition in monitoring api integration spec

* add NoMethodError to list of allowed exceptions in try
This commit is contained in:
Joao Duarte 2017-05-11 16:13:43 +01:00
parent e73a4cb209
commit 55ad9850c8

View file

@ -26,9 +26,10 @@ describe "Test Monitoring API" do
logstash_service.wait_for_logstash
number_of_events.times { logstash_service.write_to_stdin("Hello world") }
Stud.try(max_retry.times, RSpec::Expectations::ExpectationNotMetError) do
Stud.try(max_retry.times, [NoMethodError, RSpec::Expectations::ExpectationNotMetError]) do
# event_stats can fail if the stats subsystem isn't ready
result = logstash_service.monitoring_api.event_stats rescue {}
result = logstash_service.monitoring_api.event_stats rescue nil
expect(result).not_to be_nil
expect(result["in"]).to eq(number_of_events)
end
end
@ -38,7 +39,7 @@ describe "Test Monitoring API" do
logstash_service.start_with_stdin
logstash_service.wait_for_logstash
Stud.try(max_retry.times, RSpec::Expectations::ExpectationNotMetError) do
Stud.try(max_retry.times, [NoMethodError, RSpec::Expectations::ExpectationNotMetError]) do
# node_stats can fail if the stats subsystem isn't ready
result = logstash_service.monitoring_api.node_stats rescue nil
expect(result).not_to be_nil
@ -52,7 +53,7 @@ describe "Test Monitoring API" do
logstash_service.start_with_stdin
logstash_service.wait_for_logstash
Stud.try(max_retry.times, RSpec::Expectations::ExpectationNotMetError) do
Stud.try(max_retry.times, [NoMethodError, RSpec::Expectations::ExpectationNotMetError]) do
# node_stats can fail if the stats subsystem isn't ready
result = logstash_service.monitoring_api.node_stats rescue nil
expect(result).not_to be_nil