Skip to content

Commit 975262c

Browse files
authored
CI: reduce test flakiness on travis (logstash-plugins#263)
* Test: fix flaky test caused by LS bug identified and expected to be fixed in LS 7.6.2 ... for reference see elastic/logstash#11694 * Test: wait longer (due CI being a bit slow) * Refactor: actually require rspec/wait * Test: sleep a bit to avoid delete to happen * Chore: let's not leave gradle daemon around
1 parent 29cc105 commit 975262c

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

Rakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ require "logstash/devutils/rake"
88

99
desc "Compile and put filewatch jar into lib/jars"
1010
task :vendor do
11-
exit(1) unless system './gradlew clean jar'
11+
exit(1) unless system './gradlew --no-daemon clean jar'
1212
puts "-------------------> built filewatch jar via rake"
1313
end

spec/filewatch/rotate_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ module FileWatch
7373
FileUtils.mv(directory.join("1.logtmp").to_path, file1_path)
7474
end
7575
.then("wait for expectation") do
76-
wait(2).for{listener1.calls}.to eq([:open, :accept, :accept, :accept])
76+
sleep(0.25) # if ENV['CI']
77+
wait(2).for { listener1.calls }.to eq([:open, :accept, :accept, :accept])
7778
end
7879
.then("quit") do
7980
tailing.quit

spec/filewatch/spec_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# encoding: utf-8
22
require "rspec_sequencing"
3-
# require 'rspec/wait'
3+
require 'rspec/wait'
44
require "logstash/devutils/rspec/spec_helper"
55
require "concurrent"
66
require "timecop"

spec/inputs/file_read_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
end
7171

7272
events = input(conf) do |pipeline, queue|
73-
wait(0.5).for{IO.read(log_completed_path)}.to match(/A\.log/)
73+
wait(0.75).for { IO.read(log_completed_path) }.to match(/A\.log/)
7474
2.times.collect { queue.pop }
7575
end
7676
expect(events.map{|e| e.get("message")}).to contain_exactly("hello", "world")
@@ -137,7 +137,7 @@
137137
CONFIG
138138

139139
events = input(conf) do |pipeline, queue|
140-
wait(0.5).for{IO.read(log_completed_path)}.to match(/#{file_path.to_s}/)
140+
wait(0.75).for { IO.read(log_completed_path) }.to match(/#{file_path.to_s}/)
141141
2.times.collect { queue.pop }
142142
end
143143

@@ -171,7 +171,7 @@
171171
CONFIG
172172

173173
events = input(conf) do |pipeline, queue|
174-
wait(0.5).for{IO.read(log_completed_path)}.to match(/uncompressed\.log/)
174+
wait(0.75).for{ IO.read(log_completed_path) }.to match(/uncompressed\.log/)
175175
2.times.collect { queue.pop }
176176
end
177177

@@ -205,7 +205,7 @@
205205
CONFIG
206206

207207
events = input(conf) do |pipeline, queue|
208-
wait(0.5).for{IO.read(log_completed_path).scan(/compressed\.log\.gz(ip)?/).size}.to eq(2)
208+
wait(0.75).for { IO.read(log_completed_path).scan(/compressed\.log\.gz(ip)?/).size }.to eq(2)
209209
4.times.collect { queue.pop }
210210
end
211211

spec/inputs/file_tail_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
path => "#{path_path}"
6868
start_position => "beginning"
6969
sincedb_path => "#{sincedb_path}"
70-
"file_sort_by" => "path"
70+
file_sort_by => "path"
7171
delimiter => "#{TEST_FILE_DELIMITER}"
7272
}
7373
}
@@ -176,7 +176,7 @@
176176
context "when sincedb_path is a directory" do
177177
let(:name) { "E" }
178178
subject { LogStash::Inputs::File.new("path" => path_path, "sincedb_path" => directory) }
179-
179+
180180
after :each do
181181
FileUtils.rm_rf(sincedb_path)
182182
end

0 commit comments

Comments
 (0)