MCPcopy
hub / github.com/probelabs/goreplay / TestInputFileLoop

Function TestInputFileLoop

input_file_test.go:191–210  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

189}
190
191func TestInputFileLoop(t *testing.T) {
192 rnd := rand.Int63()
193
194 file, _ := os.OpenFile(fmt.Sprintf("/tmp/%d", rnd), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0660)
195 file.Write([]byte("1 1 1\ntest1"))
196 file.Write([]byte(payloadSeparator))
197 file.Write([]byte("1 1 2\ntest2"))
198 file.Write([]byte(payloadSeparator))
199 file.Close()
200
201 input := NewFileInput(fmt.Sprintf("/tmp/%d", rnd), true, 100, 0, false)
202
203 // Even if we have just 2 requests in file, it should indifinitly loop
204 for i := 0; i < 1000; i++ {
205 input.PluginRead()
206 }
207
208 input.Close()
209 os.Remove(file.Name())
210}
211
212func TestInputFileCompressed(t *testing.T) {
213 rnd := rand.Int63()

Callers

nothing calls this directly

Calls 5

PluginReadMethod · 0.95
CloseMethod · 0.95
NewFileInputFunction · 0.85
WriteMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected