(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func 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 | |
| 41 | func TestInputHTTPLargePayload(t *testing.T) { |
| 42 | wg := new(sync.WaitGroup) |
nothing calls this directly
no test coverage detected