dsoprea / PyInotify

An efficient and elegant inotify (Linux filesystem activity monitor) library for Python. Python 2 and 3 compatible.
GNU General Public License v2.0
242 stars 73 forks source link

Create Dockerfile to support unit-test debugging/development from local and fix current CI issues #85

Closed dsoprea closed 4 years ago

dsoprea commented 4 years ago

Currently, our version of Ubuntu is different from the CI version of Ubuntu and can explain at least one discrepancy in testing results. This is causing the CI to currently fail in testing. Specifically, we're getting duplicate IN_OPEN events on local and a IN_CLOSE_NOWRITE event in CI but not from local.

test__watch_list_of_paths (tests.test_inotify.TestInotify) ... 

ACTUAL:
(_INOTIFY_EVENT(wd=1, mask=256, cookie=0, len=16), ['IN_CREATE'], '/tmp/tmp7976pa7k/aa', 'seen_new_file')
(_INOTIFY_EVENT(wd=1, mask=32, cookie=0, len=16), ['IN_OPEN'], '/tmp/tmp7976pa7k/aa', 'seen_new_file')
(_INOTIFY_EVENT(wd=1, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], '/tmp/tmp7976pa7k/aa', 'seen_new_file')
(_INOTIFY_EVENT(wd=2, mask=256, cookie=0, len=16), ['IN_CREATE'], '/tmp/tmp7976pa7k/bb', 'seen_new_file2')
(_INOTIFY_EVENT(wd=2, mask=32, cookie=0, len=16), ['IN_OPEN'], '/tmp/tmp7976pa7k/bb', 'seen_new_file2')
(_INOTIFY_EVENT(wd=2, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], '/tmp/tmp7976pa7k/bb', 'seen_new_file2')
(_INOTIFY_EVENT(wd=1, mask=512, cookie=0, len=16), ['IN_DELETE'], '/tmp/tmp7976pa7k/aa', 'seen_new_file')

EXPECTED:
(_INOTIFY_EVENT(wd=1, mask=256, cookie=0, len=16), ['IN_CREATE'], '/tmp/tmp7976pa7k/aa', 'seen_new_file')
(_INOTIFY_EVENT(wd=1, mask=32, cookie=0, len=16), ['IN_OPEN'], '/tmp/tmp7976pa7k/aa', 'seen_new_file')
(_INOTIFY_EVENT(wd=1, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], '/tmp/tmp7976pa7k/aa', 'seen_new_file')
(_INOTIFY_EVENT(wd=2, mask=256, cookie=0, len=16), ['IN_CREATE'], '/tmp/tmp7976pa7k/bb', 'seen_new_file2')
(_INOTIFY_EVENT(wd=2, mask=32, cookie=0, len=16), ['IN_OPEN'], '/tmp/tmp7976pa7k/bb', 'seen_new_file2')
(_INOTIFY_EVENT(wd=2, mask=8, cookie=0, len=16), ['IN_CLOSE_WRITE'], '/tmp/tmp7976pa7k/bb', 'seen_new_file2')
(_INOTIFY_EVENT(wd=1, mask=512, cookie=0, len=16), ['IN_DELETE'], '/tmp/tmp7976pa7k/aa', 'seen_new_file')
(_INOTIFY_EVENT(wd=2, mask=32, cookie=0, len=16), ['IN_OPEN'], '/tmp/tmp7976pa7k/bb', 'seen_new_file2')
(_INOTIFY_EVENT(wd=2, mask=16, cookie=0, len=16), ['IN_CLOSE_NOWRITE'], '/tmp/tmp7976pa7k/bb', 'seen_new_file2')

I initially wanted to add some jitter-correction to drop similar events within a near timeframe to each other, but I don't think this can be done safely.