Skip to content

CI: reduce test flakiness on travis #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 23, 2020
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 Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ require "logstash/devutils/rake"

desc "Compile and put filewatch jar into lib/jars"
task :vendor do
exit(1) unless system './gradlew clean jar'
exit(1) unless system './gradlew --no-daemon clean jar'
puts "-------------------> built filewatch jar via rake"
end
3 changes: 2 additions & 1 deletion spec/filewatch/rotate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ module FileWatch
FileUtils.mv(directory.join("1.logtmp").to_path, file1_path)
end
.then("wait for expectation") do
wait(2).for{listener1.calls}.to eq([:open, :accept, :accept, :accept])
sleep(0.25) # if ENV['CI']
wait(2).for { listener1.calls }.to eq([:open, :accept, :accept, :accept])
end
.then("quit") do
tailing.quit
Expand Down
2 changes: 1 addition & 1 deletion spec/filewatch/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8
require "rspec_sequencing"
# require 'rspec/wait'
require 'rspec/wait'
require "logstash/devutils/rspec/spec_helper"
require "concurrent"
require "timecop"
Expand Down
8 changes: 4 additions & 4 deletions spec/inputs/file_read_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
end

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

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

Expand Down Expand Up @@ -171,7 +171,7 @@
CONFIG

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

Expand Down Expand Up @@ -205,7 +205,7 @@
CONFIG

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

Expand Down
4 changes: 2 additions & 2 deletions spec/inputs/file_tail_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
path => "#{path_path}"
start_position => "beginning"
sincedb_path => "#{sincedb_path}"
"file_sort_by" => "path"
file_sort_by => "path"
delimiter => "#{TEST_FILE_DELIMITER}"
}
}
Expand Down Expand Up @@ -176,7 +176,7 @@
context "when sincedb_path is a directory" do
let(:name) { "E" }
subject { LogStash::Inputs::File.new("path" => path_path, "sincedb_path" => directory) }

after :each do
FileUtils.rm_rf(sincedb_path)
end
Expand Down