mirror of
https://github.com/buger/goreplay.git
synced 2024-04-21 12:32:02 +00:00
Refactor emitter.go and fix test accordingly.
This commit is contained in:
+8
-5
@@ -25,8 +25,10 @@ func TestHTTPInput(t *testing.T) {
|
||||
Inputs: []io.Reader{input},
|
||||
Outputs: []io.Writer{output},
|
||||
}
|
||||
plugins.All = append(plugins.All, input, output)
|
||||
|
||||
go Start(plugins, quit)
|
||||
emitter := NewEmitter(quit)
|
||||
go emitter.Start(plugins, Settings.middleware)
|
||||
|
||||
address := strings.Replace(input.listener.Addr().String(), "[::]", "127.0.0.1", -1)
|
||||
|
||||
@@ -36,8 +38,7 @@ func TestHTTPInput(t *testing.T) {
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
||||
close(quit)
|
||||
emitter.Close()
|
||||
}
|
||||
|
||||
func TestInputHTTPLargePayload(t *testing.T) {
|
||||
@@ -61,8 +62,10 @@ func TestInputHTTPLargePayload(t *testing.T) {
|
||||
Inputs: []io.Reader{input},
|
||||
Outputs: []io.Writer{output},
|
||||
}
|
||||
plugins.All = append(plugins.All, input, output)
|
||||
|
||||
go Start(plugins, quit)
|
||||
emitter := NewEmitter(quit)
|
||||
go emitter.Start(plugins, Settings.middleware)
|
||||
|
||||
wg.Add(1)
|
||||
address := strings.Replace(input.listener.Addr().String(), "[::]", "127.0.0.1", -1)
|
||||
@@ -73,5 +76,5 @@ func TestInputHTTPLargePayload(t *testing.T) {
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
close(quit)
|
||||
emitter.Close()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user