Skip to content

Commit

Permalink
Migrate from bou.ke/monkey to github.com/agiledragon/gomonkey/v2 (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
instabledesign authored Oct 29, 2021
1 parent 772f028 commit 113b1ed
Show file tree
Hide file tree
Showing 15 changed files with 210 additions and 156 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

handler/fake_format_Mon Apr 7 1986
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
go test --race -gcflags=-l -v ./...
31 changes: 17 additions & 14 deletions formatter/gelf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,25 @@ import (
"testing"
"time"

"bou.ke/monkey"

"github.com/stretchr/testify/assert"

"github.com/agiledragon/gomonkey/v2"
"github.com/gol4ng/logger"
"github.com/gol4ng/logger/formatter"
"github.com/stretchr/testify/assert"
)

func TestNewGelf_WillPanic(t *testing.T) {
err := errors.New("my_hostname_error")
monkey.Patch(os.Hostname, func() (string, error) { return "", err })
patch := gomonkey.NewPatches()
patch.ApplyFunc(os.Hostname, func() (string, error) { return "", err })
defer patch.Reset()
assert.PanicsWithValue(t, err, func() { formatter.NewGelf() })
}

func TestGelf_Format(t *testing.T) {
monkey.Patch(time.Now, func() time.Time { return time.Unix(513216000, 0) })
monkey.Patch(os.Hostname, func() (string, error) { return "my_fake_hostname", nil })
defer monkey.UnpatchAll()
patch := gomonkey.NewPatches()
patch.ApplyFunc(time.Now, func() time.Time { return time.Unix(513216000, 0) })
patch.ApplyFunc(os.Hostname, func() (string, error) { return "my_fake_hostname", nil })
defer patch.Reset()

gelf := formatter.NewGelf()

Expand All @@ -36,9 +37,10 @@ func TestGelf_Format(t *testing.T) {
}

func TestGelfTCP_Format(t *testing.T) {
monkey.Patch(time.Now, func() time.Time { return time.Unix(513216000, 0) })
monkey.Patch(os.Hostname, func() (string, error) { return "my_fake_hostname", nil })
defer monkey.UnpatchAll()
patch := gomonkey.NewPatches()
patch.ApplyFunc(time.Now, func() time.Time { return time.Unix(513216000, 0) })
patch.ApplyFunc(os.Hostname, func() (string, error) { return "my_fake_hostname", nil })
defer patch.Reset()

gelf := formatter.NewGelfTCP()

Expand All @@ -54,9 +56,10 @@ func TestGelfTCP_Format(t *testing.T) {
// =====================================================================================================================

func ExampleGelf_Format() {
monkey.Patch(time.Now, func() time.Time { return time.Unix(513216000, 0) })
monkey.Patch(os.Hostname, func() (string, error) { return "my_fake_hostname", nil })
defer monkey.UnpatchAll()
patch := gomonkey.NewPatches()
patch.ApplyFunc(time.Now, func() time.Time { return time.Unix(513216000, 0) })
patch.ApplyFunc(os.Hostname, func() (string, error) { return "my_fake_hostname", nil })
defer patch.Reset()

gelfFormatter := formatter.NewGelf()

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/gol4ng/logger
go 1.12

require (
bou.ke/monkey v1.0.1
github.com/agiledragon/gomonkey/v2 v2.3.1
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/google/go-cmp v0.3.0 // indirect
github.com/kr/pretty v0.1.0 // indirect
Expand Down
14 changes: 11 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
bou.ke/monkey v1.0.1 h1:zEMLInw9xvNakzUUPjfS4Ds6jYPqCFx3m7bRmG5NH2U=
bou.ke/monkey v1.0.1/go.mod h1:FgHuK96Rv2Nlf+0u1OOVDpCMdsWyOFmeeketDHE7LIg=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/agiledragon/gomonkey/v2 v2.3.1 h1:k+UnUY0EMNYUFUAQVETGY9uUTxjMdnUkP0ARyJS1zzs=
github.com/agiledragon/gomonkey/v2 v2.3.1/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
Expand All @@ -15,10 +16,17 @@ github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
56 changes: 29 additions & 27 deletions handler/gelf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ import (
"testing"
"time"

"bou.ke/monkey"

"github.com/stretchr/testify/assert"

"github.com/agiledragon/gomonkey/v2"
"github.com/gol4ng/logger"
"github.com/gol4ng/logger/handler"
"github.com/gol4ng/logger/writer"
"github.com/stretchr/testify/assert"
)

func TestGelf(t *testing.T) {
Expand All @@ -35,13 +33,14 @@ func TestGelf(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
monkey.Patch(tt.method, func(network, address string) logger.HandlerInterface {
patch := gomonkey.NewPatches()
patch.ApplyFunc(tt.method, func(network, address string) logger.HandlerInterface {
assert.Equal(t, network, tt.network)
assert.Equal(t, address, tt.address)
return logger.NopHandler
})
defer patch.Reset()
assert.IsType(t, logger.NopHandler, handler.Gelf(tt.network, tt.address))
monkey.UnpatchAll()
})
}
}
Expand All @@ -58,29 +57,31 @@ func (w *WrongConn) Read(_ []byte) (n int, err error) { return 0, nil }
func (w *WrongConn) Write(_ []byte) (n int, err error) { return 0, nil }
func (w *WrongConn) Close() error { return nil }
func (w *WrongConn) LocalAddr() net.Addr { return nil }
func (w *WrongConn) RemoteAddr() net.Addr { return nil }
func (w *WrongConn) SetDeadline(_ time.Time) error { return nil }
func (w *WrongConn) SetReadDeadline(_ time.Time) error { return nil }
func (w *WrongConn) RemoteAddr() net.Addr { return nil }
func (w *WrongConn) SetDeadline(_ time.Time) error { return nil }
func (w *WrongConn) SetReadDeadline(_ time.Time) error { return nil }
func (w *WrongConn) SetWriteDeadline(_ time.Time) error { return nil }

func TestGelfFromConnection(t *testing.T) {

t.Run("TestGelfFromConnection for TCPConn", func(t *testing.T) {
monkey.Patch(handler.GelfTCPFromConnection, func(c *net.TCPConn) logger.HandlerInterface {
patch := gomonkey.NewPatches()
patch.ApplyFunc(handler.GelfTCPFromConnection, func(c *net.TCPConn) logger.HandlerInterface {
//assert.Equal(t, conn, c)
return logger.NopHandler
})
defer patch.Reset()
assert.IsType(t, logger.NopHandler, handler.GelfFromConnection(&net.TCPConn{}))
monkey.UnpatchAll()
})

t.Run("TestGelfFromConnection for UDPConn", func(t *testing.T) {
monkey.Patch(handler.GelfUDPFromConnection, func(c *net.UDPConn) logger.HandlerInterface {
patch := gomonkey.NewPatches()
patch.ApplyFunc(handler.GelfUDPFromConnection, func(c *net.UDPConn) logger.HandlerInterface {
//assert.Equal(t, conn, c)
return logger.NopHandler
})
defer patch.Reset()
assert.IsType(t, logger.NopHandler, handler.GelfFromConnection(&net.UDPConn{}))
monkey.UnpatchAll()
})
}

Expand All @@ -93,24 +94,25 @@ func TestGelfFromConnection_withWrongConnection(t *testing.T) {
func TestGelfTCP_Handle(t *testing.T) {
var TCPAddr *net.TCPAddr
var TCPConn *net.TCPConn
monkey.Patch(net.ResolveTCPAddr, func(network, address string) (*net.TCPAddr, error) {
patch := gomonkey.NewPatches()
patch.ApplyFunc(net.ResolveTCPAddr, func(network, address string) (*net.TCPAddr, error) {
assert.Equal(t, "fake_network", network)
assert.Equal(t, "fake_address", address)
return TCPAddr, nil
})
monkey.Patch(net.DialTCP, func(network string, laddr, raddr *net.TCPAddr) (*net.TCPConn, error) {
patch.ApplyFunc(net.DialTCP, func(network string, laddr, raddr *net.TCPAddr) (*net.TCPConn, error) {
assert.Equal(t, "fake_network", network)
assert.Nil(t, laddr)
assert.Equal(t, TCPAddr, raddr)
return TCPConn, nil
})
monkey.PatchInstanceMethod(reflect.TypeOf(TCPConn), "Write", func(conn *net.TCPConn, b []byte) (n int, err error) {
patch.ApplyMethod(reflect.TypeOf(TCPConn), "Write", func(conn *net.TCPConn, b []byte) (n int, err error) {
assert.Equal(t, []byte(`{"version":"1.1","host":"my_fake_hostname","level":4,"timestamp":513216000.000,"short_message":"test message","full_message":"<warning> test message"}`+"\x00"), b)
return 99, nil
})
monkey.Patch(time.Now, func() time.Time { return time.Unix(513216000, 0) })
monkey.Patch(os.Hostname, func() (string, error) { return "my_fake_hostname", nil })
defer monkey.UnpatchAll()
patch.ApplyFunc(time.Now, func() time.Time { return time.Unix(513216000, 0) })
patch.ApplyFunc(os.Hostname, func() (string, error) { return "my_fake_hostname", nil })
defer patch.Reset()

h := handler.GelfTCP("fake_network", "fake_address")

Expand All @@ -122,33 +124,33 @@ func TestGelfUDP_Handle(t *testing.T) {
var UDPAddr *net.UDPAddr
var UDPConn *net.UDPConn
var CompressWriter *writer.CompressWriter

monkey.Patch(net.ResolveUDPAddr, func(network, address string) (*net.UDPAddr, error) {
patch := gomonkey.NewPatches()
patch.ApplyFunc(net.ResolveUDPAddr, func(network, address string) (*net.UDPAddr, error) {
assert.Equal(t, "fake_network", network)
assert.Equal(t, "fake_address", address)
return UDPAddr, nil
})
monkey.Patch(net.DialUDP, func(network string, laddr, raddr *net.UDPAddr) (*net.UDPConn, error) {
patch.ApplyFunc(net.DialUDP, func(network string, laddr, raddr *net.UDPAddr) (*net.UDPConn, error) {
assert.Equal(t, "fake_network", network)
assert.Nil(t, laddr)
assert.Equal(t, UDPAddr, raddr)
return UDPConn, nil
})
monkey.Patch(writer.NewCompressWriter, func(w io.Writer, options ...writer.CompressOption) *writer.CompressWriter {
patch.ApplyFunc(writer.NewCompressWriter, func(w io.Writer, options ...writer.CompressOption) *writer.CompressWriter {
assert.IsType(t, &writer.GelfChunkWriter{}, w, "writer passed to CompressWriter must be a GelfCompressWriter")
assert.Len(t, options, 2)
return CompressWriter
})
monkey.PatchInstanceMethod(reflect.TypeOf(CompressWriter), "Write", func(w *writer.CompressWriter, p []byte) (int, error) {
patch.ApplyMethod(reflect.TypeOf(CompressWriter), "Write", func(w *writer.CompressWriter, p []byte) (int, error) {
assert.Equal(t, []byte(`{"version":"1.1","host":"`+osHostname+`","level":4,"timestamp":513216000.000,"short_message":"test message","full_message":"<warning> test message"}`+"\n"), p)
return 99, nil
})
monkey.PatchInstanceMethod(reflect.TypeOf(UDPConn), "Write", func(conn *net.UDPConn, b []byte) (n int, err error) {
patch.ApplyMethod(reflect.TypeOf(UDPConn), "Write", func(conn *net.UDPConn, b []byte) (n int, err error) {
assert.Equal(t, []byte(`{"version":"1.1","host":"`+osHostname+`","level":4,"timestamp":513216000.000,"short_message":"test message","full_message":"<warning> test message"}`+"\n"), b)
return 99, nil
})
monkey.Patch(time.Now, func() time.Time { return time.Unix(513216000, 0) })
defer monkey.UnpatchAll()
patch.ApplyFunc(time.Now, func() time.Time { return time.Unix(513216000, 0) })
defer patch.Reset()

h := handler.GelfUDP("fake_network", "fake_address")
assert.Nil(t, h(logger.Entry{Message: "test message", Level: logger.WarningLevel, Context: nil}))
Expand Down
43 changes: 23 additions & 20 deletions handler/rotate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ import (
"testing"
"time"

"bou.ke/monkey"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"

"github.com/agiledragon/gomonkey/v2"
"github.com/gol4ng/logger"
"github.com/gol4ng/logger/handler"
"github.com/gol4ng/logger/mocks"
"github.com/gol4ng/logger/writer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)

func TestNewTimeRotateFileStream_Handle(t *testing.T) {
Expand All @@ -24,8 +22,9 @@ func TestNewTimeRotateFileStream_Handle(t *testing.T) {
var f *os.File
createdFile1 := &os.File{}
createdFile2 := &os.File{}
patch := gomonkey.NewPatches()
// mock os.File::Write method
monkey.PatchInstanceMethod(reflect.TypeOf(f), "Write", func(file *os.File, p []byte) (n int, err error) {
patch.ApplyMethod(reflect.TypeOf(f), "Write", func(file *os.File, p []byte) (n int, err error) {
if i == 0 {
assert.Equal(t, createdFile1, file)
assert.Equal(t, []byte("my formatter return\n"), p)
Expand All @@ -43,11 +42,11 @@ func TestNewTimeRotateFileStream_Handle(t *testing.T) {
// on the second call of rotate, the TimeFileProvider will have a writer that is not nil (it will contain `createdFile1` that is technically nil
// if we do not mock the `Close` method on `createdFile1` which will and up with a syscall.EINVAL error
// as the code will pass here https://github.com/golang/go/blob/release-branch.go1.12/src/os/file_unix.go#L242
monkey.PatchInstanceMethod(reflect.TypeOf(f), "Close", func(file *os.File) error {
patch.ApplyMethod(reflect.TypeOf(f), "Close", func(file *os.File) error {
return nil
})
// mock os.OpenFile method
monkey.Patch(os.OpenFile, func(name string, flag int, perm os.FileMode) (*os.File, error) {
patch.ApplyFunc(os.OpenFile, func(name string, flag int, perm os.FileMode) (*os.File, error) {
if i == 0 {
assert.Equal(t, "fake_format_Thu Jan 1 1970 00", name)
assert.Equal(t, os.O_CREATE|os.O_APPEND|os.O_WRONLY, flag)
Expand All @@ -65,15 +64,16 @@ func TestNewTimeRotateFileStream_Handle(t *testing.T) {
})
// mock time.NewTicker method : override private ticker channel in order to be able to send ticks manually
tickerChan := make(chan time.Time, 1)
monkey.Patch(time.NewTicker, func(d time.Duration) *time.Ticker {
patch.ApplyFunc(time.NewTicker, func(d time.Duration) *time.Ticker {
assert.Equal(t, 10*time.Millisecond, d)
return &time.Ticker{
C: tickerChan,
}
})
// mock time.Now method in order to return always the same time whenever the test is launched
monkey.Patch(time.Now, func() time.Time { return time.Unix(i, 0) })
defer monkey.UnpatchAll()
patch.ApplyFunc(time.Now, func() time.Time { return time.Unix(i, 0) })
defer patch.Reset()

// mock a basic formatter that will return "my formatter return" on any call of `Format`
mockFormatter := mocks.FormatterInterface{}
mockFormatter.On("Format", mock.AnythingOfType("logger.Entry")).Return("my formatter return")
Expand All @@ -92,38 +92,40 @@ func TestNewTimeRotateFileStream_Handle(t *testing.T) {

func TestNewTimeRotateFileStream_Error(t *testing.T) {
mockFormatter := mocks.FormatterInterface{}
monkey.Patch(writer.NewTimeRotateFromProvider, func(provider writer.Provider, interval time.Duration) (*writer.TimeRotateWriter, error) {
patch := gomonkey.NewPatches()
patch.ApplyFunc(writer.NewTimeRotateFromProvider, func(provider writer.Provider, interval time.Duration) (*writer.TimeRotateWriter, error) {
return nil, errors.New("my_fake_error")
})
defer monkey.UnpatchAll()
defer patch.Reset()

_, err := handler.TimeRotateFileStream("fake_format_%s", "Mon Jan _2 2006 05", &mockFormatter, 10*time.Millisecond)
assert.EqualError(t, err, "my_fake_error")
}

func TestNewLogRotateFileStream_Handle(t *testing.T) {
var f *os.File
monkey.PatchInstanceMethod(reflect.TypeOf(f), "Write", func(_ *os.File, p []byte) (n int, err error) {
patch := gomonkey.NewPatches()
patch.ApplyMethod(reflect.TypeOf(f), "Write", func(_ *os.File, p []byte) (n int, err error) {
assert.Equal(t, []byte("my formatter return\n"), p)
return 99, nil
})

file := os.File{}

monkey.Patch(os.OpenFile, func(name string, flag int, perm os.FileMode) (*os.File, error) {
patch.ApplyFunc(os.OpenFile, func(name string, flag int, perm os.FileMode) (*os.File, error) {
assert.Equal(t, "fake_format_test", name)
assert.Equal(t, os.O_CREATE|os.O_APPEND|os.O_WRONLY, flag)
assert.Equal(t, os.FileMode(0666), perm)
return &file, nil
})

monkey.Patch(os.Rename, func(oldpath, newpath string) error {
patch.ApplyFunc(os.Rename, func(oldpath, newpath string) error {
assert.Equal(t, "fake_format_test", oldpath)
assert.Equal(t, "fake_format_Mon Apr 7 1986", newpath)
return nil
})
monkey.Patch(time.Now, func() time.Time { return time.Unix(513216000, 0) })
defer monkey.UnpatchAll()
patch.ApplyFunc(time.Now, func() time.Time { return time.Unix(513216000, 0) })
defer patch.Reset()

mockFormatter := mocks.FormatterInterface{}
mockFormatter.On("Format", mock.AnythingOfType("logger.Entry")).Return("my formatter return")
Expand All @@ -138,10 +140,11 @@ func TestNewLogRotateFileStream_Handle(t *testing.T) {

func TestNewLogRotateFileStream_Error(t *testing.T) {
mockFormatter := mocks.FormatterInterface{}
monkey.Patch(writer.NewTimeRotateFromProvider, func(provider writer.Provider, interval time.Duration) (*writer.TimeRotateWriter, error) {
patch := gomonkey.NewPatches()
patch.ApplyFunc(writer.NewTimeRotateFromProvider, func(provider writer.Provider, interval time.Duration) (*writer.TimeRotateWriter, error) {
return nil, errors.New("my_fake_error")
})
defer monkey.UnpatchAll()
defer patch.Reset()

_, err := handler.LogRotateFileStream("test", "fake_format_%s", "Mon Jan _2 2006", &mockFormatter, 100*time.Millisecond)
assert.EqualError(t, err, "my_fake_error")
Expand Down
Loading

0 comments on commit 113b1ed

Please sign in to comment.