diff options
author | Wolfy-J <[email protected]> | 2018-06-23 13:15:33 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-23 13:15:33 +0300 |
commit | 38d694411abbdb0c31b08b96452fa0604a93418a (patch) | |
tree | 828492153bd4893347534e6ee9858bbb4d45f233 /error_buffer_test.go | |
parent | 14a54572d7a3754aeb81d3dc9949276b7fff04fe (diff) |
support for realtime error aggegration
Diffstat (limited to 'error_buffer_test.go')
-rw-r--r-- | error_buffer_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/error_buffer_test.go b/error_buffer_test.go index afbc80e2..aa6a17f2 100644 --- a/error_buffer_test.go +++ b/error_buffer_test.go @@ -12,3 +12,20 @@ func TestErrBuffer_Write_Len(t *testing.T) { assert.Equal(t, 5, buf.Len()) assert.Equal(t, buf.String(), "hello") } + +func TestErrBuffer_Write_Event(t *testing.T) { + buf := &errBuffer{buffer: new(bytes.Buffer)} + + tr := make(chan interface{}) + buf.Listen(func(event int, ctx interface{}) { + assert.Equal(t, EventStderrOutput, event) + assert.Equal(t, []byte("hello"), ctx) + close(tr) + }) + + buf.Write([]byte("hello")) + + <-tr + assert.Equal(t, 5, buf.Len()) + assert.Equal(t, buf.String(), "hello") +} |