Skip to content

Commit 0a0afa9

Browse files
authored
Merge branch 'main' into ls2ls-integration-test-addition-changes
2 parents 299fa34 + 73ffa24 commit 0a0afa9

File tree

2 files changed

+8
-25
lines changed

2 files changed

+8
-25
lines changed

qa/integration/services/logstash_service.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,9 @@ def is_port_open?
220220
# check REST API is responsive
221221
def rest_active?
222222
result = monitoring_api.node_info
223-
started = !result.nil?
223+
!result.nil?
224+
rescue
225+
return false
224226
end
225227

226228
def monitoring_api

qa/integration/specs/logstash_to_logstash_spec.rb

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,9 @@
2727

2828
before(:all) {
2929
@fixture = Fixture.new(__FILE__)
30-
# backup original setting file since we change API port number, and restore after all tests
31-
FileUtils.cp(@fixture.get_service('logstash').application_settings_file, "#{@fixture.get_service('logstash').application_settings_file}.original")
3230
}
3331

3432
after(:all) {
35-
FileUtils.mv("#{@fixture.get_service('logstash').application_settings_file}.original", @fixture.get_service('logstash').application_settings_file)
3633
@fixture.teardown
3734
}
3835

@@ -58,26 +55,10 @@ def run_logstash_instance(config_name, options = {}, &block)
5855
"--path.data", get_temp_path_dir,
5956
"--api.http.port", api_port.to_s,
6057
"--config.reload.automatic")
61-
wait_for_logstash(logstash_service)
62-
58+
logstash_service.wait_for_rest_api
6359
yield logstash_service
64-
6560
ensure
66-
logstash_service&.teardown
67-
end
68-
69-
def wait_for_logstash(service)
70-
wait_in_seconds = 60
71-
while wait_in_seconds > 0 do
72-
begin
73-
return if service.rest_active?
74-
rescue => e
75-
puts "Exception: #{e.message}"
76-
wait_in_seconds -= 1
77-
sleep 1
78-
end
79-
end
80-
raise "Logstash is not responsive after 60 seconds."
61+
logstash_service.teardown
8162
end
8263

8364
let(:num_retries) { 60 }
@@ -98,8 +79,8 @@ def wait_for_logstash(service)
9879

9980
try(num_retries) do
10081
downstream_event_stats = downstream_logstash_service.monitoring_api.event_stats
101-
102-
expect(downstream_event_stats).to include({"in" => num_events}), lambda { "expected #{num_events} events to have been received by downstream"}
82+
expect(downstream_event_stats).to include({"in" => num_events}), lambda { "expected #{num_events} events to have been received by downstream" }
83+
expect(downstream_event_stats).to include({"out" => num_events}), lambda { "expected #{num_events} events to have been processed by downstream" }
10384
end
10485

10586
# make sure received events are in the file
@@ -123,4 +104,4 @@ def wait_for_logstash(service)
123104
include_examples "send events"
124105
end
125106

126-
end
107+
end

0 commit comments

Comments
 (0)