(t *testing.T)
| 88 | } |
| 89 | |
| 90 | func TestInputFileMultipleFilesWithRequestsOnly(t *testing.T) { |
| 91 | rnd := rand.Int63() |
| 92 | |
| 93 | file1, _ := os.OpenFile(fmt.Sprintf("/tmp/%d_0", rnd), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0660) |
| 94 | file1.Write([]byte("1 1 1\ntest1")) |
| 95 | file1.Write([]byte(payloadSeparator)) |
| 96 | file1.Write([]byte("1 1 3\ntest2")) |
| 97 | file1.Write([]byte(payloadSeparator)) |
| 98 | file1.Close() |
| 99 | |
| 100 | file2, _ := os.OpenFile(fmt.Sprintf("/tmp/%d_1", rnd), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0660) |
| 101 | file2.Write([]byte("1 1 2\ntest3")) |
| 102 | file2.Write([]byte(payloadSeparator)) |
| 103 | file2.Write([]byte("1 1 4\ntest4")) |
| 104 | file2.Write([]byte(payloadSeparator)) |
| 105 | file2.Close() |
| 106 | |
| 107 | input := NewFileInput(fmt.Sprintf("/tmp/%d*", rnd), false, 100, 0, false) |
| 108 | |
| 109 | for i := '1'; i <= '4'; i++ { |
| 110 | msg, _ := input.PluginRead() |
| 111 | if msg.Meta[4] != byte(i) { |
| 112 | t.Error("Should emit requests in right order", string(msg.Meta)) |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | os.Remove(file1.Name()) |
| 117 | os.Remove(file2.Name()) |
| 118 | } |
| 119 | |
| 120 | func TestInputFileRequestsWithLatency(t *testing.T) { |
| 121 | rnd := rand.Int63() |
nothing calls this directly
no test coverage detected