Skip to content

Commit

Permalink
Merge pull request #343 from guard/e2-allow_bigger_lag_on_travis_osx
Browse files Browse the repository at this point in the history
fix failing specs on Travis+OSX
  • Loading branch information
e2 committed Aug 22, 2015
2 parents 4d9d065 + 93a6a67 commit c6e9189
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Expand Up @@ -17,5 +17,6 @@ os:
- linux
- osx
env:
- LISTEN_TESTS_DEFAULT_LAG=0.8
# TODO: 0.8 is enough on Linux, but 2 seems needed for Travis/OSX
- LISTEN_TESTS_DEFAULT_LAG=2
sudo: false
2 changes: 1 addition & 1 deletion spec/lib/listen/adapter/linux_spec.rb
Expand Up @@ -59,7 +59,6 @@
let(:adapter_options) { { events: [:recursive, :close_write] } }

before do
allow(Kernel).to receive(:require).with('rb-inotify')
fake_worker = double(:fake_worker)
events = [:recursive, :close_write]
allow(fake_worker).to receive(:watch).with('/foo/dir1', *events)
Expand All @@ -78,6 +77,7 @@
allow(Listen::Change).to receive(:new).with(config, record).
and_return(snapshot)

allow(subject).to receive(:require).with('rb-inotify')
subject.configure
end

Expand Down
9 changes: 2 additions & 7 deletions spec/support/acceptance_helper.rb
Expand Up @@ -201,7 +201,6 @@ def listen(reset_queue = true)
# Lag should include:
# 0.1s - 0.2s if the test needs Listener queue to be processed
# 0.1s in case the system is busy
# 0.1s - for celluloid overhead and scheduling
sleep lag
end

Expand All @@ -228,9 +227,6 @@ def _add_changes(type, changes, dst)
freeze_offset = @timed_changes.freeze_offset

msg = "Changes took #{change_offset}s (allowed lag: #{freeze_offset})s"

# Use STDERR (workaround for Celluloid, since it catches abort)
STDERR.puts msg
abort(msg)
end

Expand Down Expand Up @@ -258,9 +254,8 @@ def _sleep_to_separate_events
# separate the events or Darwin and Polling
# will detect only the :added event
#
# (This is because both use directory scanning
# through Celluloid tasks, which may not kick in
# time before the next filesystem change)
# (This is because both use directory scanning which may not kick in time
# before the next filesystem change)
#
# The minimum for this is the time it takes between a syscall
# changing the filesystem ... and ... an async
Expand Down

0 comments on commit c6e9189

Please sign in to comment.