File: test-suite-fsnotify-fix.patch

package info (click to toggle)
golang-github-influxdata-tail 1.0.0%2Bgit20180327.c434825-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 232 kB
  • sloc: makefile: 18
file content (55 lines) | stat: -rw-r--r-- 1,784 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
 tail_test.go |   28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

--- a/tail_test.go
+++ b/tail_test.go
@@ -345,19 +345,11 @@ func reOpen(t *testing.T, poll bool) {
 	content := []string{"hello", "world", "more", "data", "endofworld"}
 	go tailTest.VerifyTailOutput(tail, content, false)
 
-	if poll {
-		// deletion must trigger reopen
-		<-time.After(delay)
-		tailTest.RemoveFile("test.txt")
-		<-time.After(delay)
-		tailTest.CreateFile("test.txt", "more\ndata\n")
-	} else {
-		// In inotify mode, fsnotify is currently unable to deliver notifications
-		// about deletion of open files, so we are not testing file deletion.
-		// (see https://github.com/fsnotify/fsnotify/issues/194 for details).
-		<-time.After(delay)
-		tailTest.AppendToFile("test.txt", "more\ndata\n")
-	}
+	// deletion must trigger reopen
+	<-time.After(delay)
+	tailTest.RemoveFile("test.txt")
+	<-time.After(delay)
+	tailTest.CreateFile("test.txt", "more\ndata\n")
 
 	// rename must trigger reopen
 	<-time.After(delay)
@@ -371,10 +363,7 @@ func reOpen(t *testing.T, poll bool) {
 	tailTest.RemoveFile("test.txt")
 	<-time.After(delay)
 
-	// Do not bother with stopping as it could kill the tomb during
-	// the reading of data written above. Timings can vary based on
-	// test environment.
-	tailTest.Cleanup(tail, false)
+	tail.Cleanup()
 }
 
 func TestInotify_WaitForCreateThenMove(t *testing.T) {
@@ -429,10 +418,7 @@ func reSeek(t *testing.T, poll bool) {
 	<-time.After(100 * time.Millisecond)
 	tailTest.RemoveFile("test.txt")
 
-	// Do not bother with stopping as it could kill the tomb during
-	// the reading of data written above. Timings can vary based on
-	// test environment.
-	tailTest.Cleanup(tail, false)
+	tail.Cleanup()
 }
 
 // Test library