Commit Graph
43 Commits
Author SHA1 Message Date
Simon Frei ca15b52885 tests: pass root dir of testing watcher through cleanpath 2017-08-31 13:37:54 +02:00
DiSiqueira 72bdc6c378 Misspelled words in code comments 2017-01-28 16:35:34 -02:00
Rafal Jeczalik e4fec824e0 util: canonical resolves relative symlinks
Fixes #83.
2015-09-11 05:27:15 +02:00
Paweł Błaszczyk d7efb190f5 kqueue: Update rename handling & rewrite tests.
- NoteRename is triggered only on parent directory, not on it's
   contents. Now rename events are generated in this case.
 - Rewrite old disabled tests to new framework.
2015-06-21 12:35:13 +02:00
Rafal Jeczalik 4a154a6dfd use debug build tag instead of NOTIFY_DEBUG var 2015-03-16 21:06:42 +01:00
Pawel Knap 128e2d9c9f rename 'skip' to 'errSkip' which makes go-linter happy + simple data race fix 2015-03-13 18:36:48 +01:00
Pawel Knap 5ea496c2d4 readdcw: allow to mix system and generic events when watching same directory on different channels 2015-03-13 17:33:31 +01:00
Rafal Jeczalik 5a8438b920 remove spurious TODOs 2015-03-08 13:13:06 +01:00
Rafal Jeczalik 7e3fce3fdd implement watching on newly created directories
Closes #5.
2015-02-26 13:32:16 +01:00
Rafal Jeczalik 3dddcc3ac4 implement Stop for non-recursive tree
Part of #5.
2015-02-25 15:20:38 +01:00
Rafal Jeczalik 4f78a83e66 implement Watch for non-recursive tree
Part of #5.
2015-02-25 15:20:38 +01:00
Rafal Jeczalik b347e4d221 close watcher before removing test directory tree
The race mentioned in the issue is artificial for real applications, as
Close is never called - it was introduced only for test purposes. It
makes little sense for creating overhead for FSEvents watcher
implementation if rearranging the order of actions can dodge the issue.

Fixes #74.
2015-02-23 22:46:24 +01:00
Rafal Jeczalik dcdfbe945e rename Delete and Move events
notify.Delete -> notify.Remove (because os.Remove)
notify.Move -> notify.Rename (because os.Rename)

Fixes #70.
2015-02-16 00:43:00 +01:00
Rafal Jeczalik bd62d61df5 update license / authors
Done with:

  ~ $ find . -type f -name '*.go' -exec prepend -f preamble.txt {} \;

Automate with CI?
2015-02-15 13:44:09 +01:00
Rafal Jeczalik 524da74166 skip traversing during Stop only if watchpoint is empty
Fixes a case when Stop on chan that does not affect overall state of
watchpoint causes children watchpoints not being deleted.
2015-02-13 17:49:17 +01:00
Rafal Jeczalik 8a56577ec4 register watchpoints that re-uses existing watches
Fixes an issue with watchpoints being ignored, when adding them did not
trigger an action on underlying watcher.
2015-02-13 17:49:17 +01:00
Rafal Jeczalik 082bbc8848 notify: add a test-case for isdir function 2015-02-12 11:19:49 +01:00
Pawel Knap 01a5687f20 inotify: test error handling for invalid events 2015-02-11 15:24:48 +01:00
Pawel Knap 433face91a readdcw: add support for recursive <-> non-recursive rewatching (fixes #66) 2015-02-10 15:29:59 +01:00
Rafal Jeczalik 20d823cb41 add a test for #66 2015-02-10 13:54:31 +01:00
Rafal Jeczalik 86e4249b15 canonicalize mocked event's path before distpatching
closes #61
2015-02-09 09:14:14 +01:00
Rafal Jeczalik 4b0535ec1c tree: implement Stop for recursive watchers (#6) 2015-02-08 14:49:05 +01:00
Rafal Jeczalik b025a5a85f tree: keep children watchpoints separate from parent ones 2015-02-08 00:49:27 +01:00
Rafal Jeczalik f8e4681e5d execute event action when no receiver is expected
Fixes false-positive test-cases for ExpectTreeEvents and
ExpectNotifyEvents tests.
2015-02-05 20:57:13 +01:00
Rafal Jeczalik 53cfaa6d25 add more test-cases for tree ei dispatch
+ fix notify environment variable names
2015-01-27 23:32:57 +01:00
Rafal Jeczalik 65d0e1ac13 implement dispatching events for the tree (#6)
+ close dispatching goroutines on tree close
2015-01-27 00:51:13 +01:00
Rafal Jeczalik 463963cd6f add more test-cases for recursive tree (#6)
- fix rewatching parent leaf directory (case 1)
- remove dead code (case 3)
2015-01-26 22:41:47 +01:00
Rafal Jeczalik 86d2374d21 add Watch implementation for recursive watchers (#6) 2015-01-25 23:15:31 +01:00
Pawel Knap 8bd3b7d2c3 inotify - fix for tests (temporary solution) 2015-01-25 12:54:40 +01:00
Rafal Jeczalik 185d187557 add new NOTIFY_TMP variable for testing
By default test dumps temporary directory tree in testdata directory.
In order to change the default behaviour to e.g. dump the tree to
C:\Windows\Temp, set:

  % set NOTIFY_TMP=C:\Windows\Temp\notify
2015-01-24 17:18:39 +01:00
Pawel Knap 3db17a57a1 inotify : Add test for system's move events 2015-01-24 12:12:11 +01:00
Rafal Jeczalik a54aea2848 testing: fail (*W).ExpectAny on unexpected event
It was false-positive.
2015-01-23 00:19:07 +01:00
Rafal Jeczalik 82431eaf54 make internal structs unexported 2015-01-21 22:41:21 +01:00
Rafal Jeczalik 1b1b782cf4 FSEvents: increase accuracy of events
FSEvents tends to send squashed old and new flags for an event. E.g.
for the following filesystem operations:

   ~ $ echo > file # Create|Write -> Create|Write
   ~ $ echo > file # Create|Write|InodeMetaMod -> Write|InodeMetaMod

FSEvents sends accordingly "Create|Write" and "Create|Write|InodeMetaMod"
events, even though "Create" event shouldn't be present in the latter
set.

There're two changes that, proved empirically, improves the accuracy
of reported events:

   - the sinceWhen for FSEventsStreamCreate is change from the Now const
     to quasi-recent event id value; the watcher then ignores all
     received events until it receive HistoryDone one (flushing?)
   - improved heuristics (+ doc) for striping old events from sets

And no, increasing latency does not force FSEvents to send old events,
besides making the tests extremely slow.
2015-01-20 00:04:03 +01:00
Rafal Jeczalik b5d874990c print testing_test caller's file+line number 2015-01-18 00:01:18 +01:00
Rafal Jeczalik 94b04b0b2f fix TestNotifyExample for OS X (#54)
Since FSEvents tends to send unrelated, historical flags altogether
with the actual event, its watcher implementation needs to bookkeep
them and filter out duplicated events before dispatching to the user.
The problem arises of the first event for a given path is Write -
FSEvents sends Create+Write but watcher has no knowledge what was the
real previous state of the event, that's why it will also dispatch
Create event to the user. This should be documented (#48) or even better
fixed.

That's why in test-cases we begin with dummy Create's to "initialize"
state of the history bookkeeping map. Lame, I know.
2015-01-15 23:09:54 +01:00
Rafal Jeczalik a45f01b332 fail if collected events does not match expected ones 2015-01-15 22:04:15 +01:00
Rafal Jeczalik b10bba6cab rewrite file tree structure for testing
Because I can.
2015-01-15 20:38:12 +01:00
Rafal Jeczalik 38652ff8ba fail test if collected events are not unique
Set of chans used in ExpectTreeEvents and ExpectTreeEvents tests is
expected to received exactly one unique event per each chan. Current
version could receive duplicated events and tests would not fail, even
though that condition is invalid.
2015-01-15 19:50:57 +01:00
Rafal Jeczalik 0e5572a621 add TEST_NOTIFY_TIMEOUT environment variable
It allows for changing wait time for watcher's events. The default is 2
seconds.

Currently AppVeyor uses 3 seconds.
2015-01-13 20:11:05 +01:00
Rafal Jeczalik e229e92e20 fix TestNotifyExample for Windows 2015-01-13 19:08:47 +01:00
Rafal Jeczalik 718f01ed87 implement acceptance testing for notify (#6) 2015-01-13 18:56:10 +01:00
Rafal Jeczalik 7b47226fe9 implement spy testing for Tree / RecursiveTree (#6) 2015-01-12 22:10:03 +01:00