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

Function TestInputFileWithGETAndPOST

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

Source from the content-addressed store, hash-verified

60}
61
62func TestInputFileWithGETAndPOST(t *testing.T) {
63
64 input := NewTestInput()
65 rg := NewRequestGenerator([]PluginReader{input}, func() {
66 input.EmitGET()
67 input.EmitPOST()
68 }, 2)
69 readPayloads := []*Message{}
70
71 // Given a capture file with a GET request
72 expectedCaptureFile := CreateCaptureFile(rg)
73 defer expectedCaptureFile.TearDown()
74
75 // When the requests are read from the capture file
76 err := ReadFromCaptureFile(expectedCaptureFile.file, 2, func(msg *Message) {
77 readPayloads = append(readPayloads, msg)
78 })
79
80 // The read requests should match the original request
81 if err != nil {
82 t.Error(err)
83 } else if !expectedCaptureFile.PayloadsEqual(readPayloads) {
84 t.Error("Request read back from file should match")
85
86 }
87
88}
89
90func TestInputFileMultipleFilesWithRequestsOnly(t *testing.T) {
91 rnd := rand.Int63()

Callers

nothing calls this directly

Calls 9

EmitGETMethod · 0.95
EmitPOSTMethod · 0.95
NewTestInputFunction · 0.85
NewRequestGeneratorFunction · 0.85
CreateCaptureFileFunction · 0.85
ReadFromCaptureFileFunction · 0.85
TearDownMethod · 0.80
PayloadsEqualMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected