Commit Graph

37 Commits

Author SHA1 Message Date
Jonathan Rudenberg 166cd27854 Add StopAtEOF to stop tailing when the end of the file is reached 2014-12-25 21:02:30 -05:00
Sridhar Ratnakumar 929590016a use ReadString instead of ReadLine
ReadLine is a low-level primitive, and we don't do a good job of
splitting the lines as they are being read. best to read the entire
line and then split it in one go.

with this change, there is one test failure that will be resolved
next:

  --- FAIL: TestMaxLineSize (0.10 seconds)
         tail_test.go:410: tail ended early; expecting more: [he]
2014-05-16 18:01:10 -07:00
Sridhar Ratnakumar 34fb5fd3ef integrate leakybucket algorithm 2014-04-29 16:39:57 -07:00
Sridhar Ratnakumar c13cdd473c refactor seek routine 2014-04-28 14:55:51 -07:00
Sridhar Ratnakumar afbbb638b5 add failing test case 2014-04-28 14:46:42 -07:00
Sridhar Ratnakumar 734bf58f78 should be Fatal here 2014-04-28 14:46:18 -07:00
Sridhar Ratnakumar 473bd49874 test: rewrite the confusing mismatch message 2014-04-28 14:15:34 -07:00
Sridhar Ratnakumar fc42d757b5 test: ensure that subsequent line(s) are being skipped 2014-04-28 14:15:17 -07:00
Sridhar Ratnakumar 074c77ccbf update test for parent commit 2014-04-28 12:56:31 -07:00
YAMASAKI masahide 6a3ddb6ced If specified the MaxLineSize, then set to the bufio.reader MaxLineSize. 2014-04-06 09:48:37 +09:00
Sridhar Ratnakumar 3da62cd5ae account for POLL_DURATION in the reopen test
ref: https://travis-ci.org/ActiveState/tail/builds/21301728
2014-03-21 22:32:56 -07:00
Sridhar Ratnakumar 323e1c0988 add Cleanup function to close open inotify watches
bug: 101635
2013-11-12 20:15:27 -08:00
miraclesu a7f9b4b6fc Fixed stop hang & stop err 2013-09-23 15:03:51 +08:00
QLeelulu 1a8af20665 add tail.Tell's test 2013-08-24 15:43:25 +08:00
Sridhar Ratnakumar 275e6442bd tests for the new Location spec 2013-08-09 14:57:38 -07:00
Sridhar Ratnakumar b2509e165e option to limit the rate of reading lines from files 2013-07-11 17:28:18 -07:00
Sridhar Ratnakumar f461ddc97d support Follow=false 2013-05-30 13:18:46 -07:00
Sridhar Ratnakumar de27e252a7 truncate tests should not use ReOpen 2013-05-29 15:08:10 -07:00
Sridhar Ratnakumar 7599e3efb9 fix tail.Stop blocking when called in midst of re-opening
this is what caused the test to hang occasionally. after this fix,
test completes in 2mins all the time.

closes issue #4
2013-05-28 19:35:12 -07:00
Sridhar Ratnakumar 0f67bc352f make watch.go its own package
for the purpose for upcoming changes to the watch functionality.
2013-05-28 16:37:21 -07:00
Sridhar Ratnakumar 976fc15b81 update change log, gofmt and remove debug prints 2013-05-28 14:01:32 -07:00
Sridhar Ratnakumar 644891ebbc BlockUntilExists should return immediately if the file already exists
this fixes a potential race condition in the use of BlockUntilExists
following a file existence check (as we do in tail.go:reopen).

closes issue 5
2013-05-28 13:29:40 -07:00
Sridhar Ratnakumar fb37e0b7ca use a smaller poll duration for faster test runs 2013-05-28 12:55:11 -07:00
Sridhar Ratnakumar 8c443fb067 fix truncation tests
* use O_TRUNC to actually truncate
* use longer initial data before truncating

truncated and updated file is expected to be of smaller size, else
truncation detection won't work.

ref: https://github.com/josegonzalez/beaver/pull/67/files
2013-05-28 12:28:56 -07:00
Sridhar Ratnakumar e9c3c07fbb add (failing) tests for copytruncate detection 2013-05-28 11:46:49 -07:00
Sridhar Ratnakumar ec461b87f0 implement PollingFileWatcher.BlockUntilExists 2013-05-27 15:34:50 -07:00
Sridhar Ratnakumar c5073c7f26 PollingFileWatcher.ChangeEvents must detect file deletion/rename 2013-05-27 15:34:50 -07:00
Sridhar Ratnakumar e895d422e1 run TestReOpen with both poll = true and false
this catches a bug with log rotation when using polling file watcher.
2013-05-27 15:32:49 -07:00
Sridhar Ratnakumar 0449e85ca5 add license and copyright 2013-01-07 12:54:49 -08:00
Sridhar Ratnakumar 1a694c85a6 test refactoring: use struct embedding to reuse semantics 2012-10-13 13:04:50 -07:00
Sridhar Ratnakumar b8bf75b80a MaxLineSize now splits longer lines without discarding the rest
implements http://bugs.activestate.com/show_bug.cgi?id=95745
2012-10-13 12:50:27 -07:00
Sridhar Ratnakumar d214cebdfd test case for "-F" (follow by name)
-F mode reopens deleted/ renamed files.
2012-10-13 12:11:50 -07:00
Sridhar Ratnakumar aa3b7c3413 test: add test for "-n 0" 2012-10-13 12:02:38 -07:00
Sridhar Ratnakumar df3f97310f test: fixture workflow to make test functions concise 2012-10-13 11:44:47 -07:00
Sridhar Ratnakumar 4e53f618e2 first test case for tail
tests "-n -1"

need to abstract operations for multiple workflow
2012-10-13 11:20:04 -07:00
Sridhar Ratnakumar 4bbf3d28cc gracefully manage goroutines death using tomb
http://blog.labix.org/2011/10/09/death-of-goroutines-under-control
2012-10-12 16:28:22 -07:00
Sridhar Ratnakumar 187dea7196 use struct to configure the growing tail args; start working on unit tests 2012-10-12 14:32:04 -07:00