MCPcopy Index your code
hub / github.com/probelabs/goreplay / TestHTTPInput

Function TestHTTPInput

input_http_test.go:12–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestHTTPInput(t *testing.T) {
13 wg := new(sync.WaitGroup)
14
15 input := NewHTTPInput("127.0.0.1:0")
16 time.Sleep(time.Millisecond)
17 output := NewTestOutput(func(*Message) {
18 wg.Done()
19 })
20
21 plugins := &InOutPlugins{
22 Inputs: []PluginReader{input},
23 Outputs: []PluginWriter{output},
24 }
25 plugins.All = append(plugins.All, input, output)
26
27 emitter := NewEmitter()
28 go emitter.Start(plugins, Settings.Middleware)
29
30 address := strings.Replace(input.address, "[::]", "127.0.0.1", -1)
31
32 for i := 0; i < 100; i++ {
33 wg.Add(1)
34 http.Get("http://" + address + "/")
35 }
36
37 wg.Wait()
38 emitter.Close()
39}
40
41func TestInputHTTPLargePayload(t *testing.T) {
42 wg := new(sync.WaitGroup)

Callers

nothing calls this directly

Calls 6

StartMethod · 0.95
CloseMethod · 0.95
NewHTTPInputFunction · 0.85
NewTestOutputFunction · 0.85
NewEmitterFunction · 0.85
GetMethod · 0.80

Tested by

no test coverage detected