Skip to content

Commit b7d2ee7

Browse files
robbaveyyaauie
andauthored
[Tests] Increase frequency of reload to fix flaky tests (#32)
JDBC static scheduled reload tests were flaky, due to scheduled reload not happening every test, due to a mismatch between sleep time and schedule. The Timecop scaling feature has no effect when testing the scheduler, and hence is removed here. Co-authored-by: Ry Biesemeyer <[email protected]>
1 parent bb27219 commit b7d2ee7

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

spec/filters/integration/jdbc_static_spec.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
require "sequel"
55
require "sequel/adapters/jdbc"
66
require "stud/temporary"
7-
require "timecop"
87

98
module LogStash module Filters
109
describe JdbcStatic, :integration => true do
@@ -136,18 +135,16 @@ module LogStash module Filters
136135
describe "scheduled operation" do
137136
context "given a loader_schedule" do
138137
it "should properly schedule" do
139-
settings["loader_schedule"] = "*/10 * * * * * UTC"
140-
Timecop.travel(Time.now.utc - 3600)
141-
Timecop.scale(60)
138+
settings["loader_schedule"] = "*/3 * * * * * UTC"
142139
static_filter = JdbcStatic.new(settings)
143140
runner = Thread.new(static_filter) do |filter|
144141
filter.register
145142
end
146-
sleep 3
143+
runner.join(4)
144+
sleep 4
147145
static_filter.filter(event)
148146
expect(static_filter.loader_runner.reload_count).to be > 1
149147
static_filter.close
150-
Timecop.return
151148
expect(event.get("server")).to eq([{"ip"=>"10.3.1.1", "name"=>"mv-server-1", "location"=>"MV-9-6-4"}])
152149
end
153150
end

0 commit comments

Comments
 (0)