Fixed tests
This commit is contained in:
parent
694cecfbf8
commit
0cc9b76d26
|
@ -40,7 +40,7 @@ type FileRotator struct {
|
|||
currentWr int64
|
||||
|
||||
logger *log.Logger
|
||||
purgeCh chan interface{}
|
||||
purgeCh chan struct{}
|
||||
}
|
||||
|
||||
// NewFileRotator returns a new file rotator
|
||||
|
@ -54,7 +54,7 @@ func NewFileRotator(path string, baseFile string, maxFiles int,
|
|||
baseFileName: baseFile,
|
||||
|
||||
logger: logger,
|
||||
purgeCh: make(chan interface{}),
|
||||
purgeCh: make(chan struct{}, 1),
|
||||
}
|
||||
if err := rotator.lastFile(); err != nil {
|
||||
return nil, err
|
||||
|
@ -128,7 +128,7 @@ func (f *FileRotator) nextFile() error {
|
|||
// Purge old files if we have more files than MaxFiles
|
||||
if f.logFileIdx-f.oldestLogFileIdx >= f.MaxFiles {
|
||||
select {
|
||||
case f.purgeCh <- new(interface{}):
|
||||
case f.purgeCh <- struct{}{}:
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,13 +3,15 @@
|
|||
package logging
|
||||
|
||||
import (
|
||||
"log"
|
||||
"log/syslog"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLogParser_Priority(t *testing.T) {
|
||||
line := []byte("<30>2016-02-10T10:16:43-08:00 d-thinkpad docker/e2a1e3ebd3a3[22950]: 1:C 10 Feb 18:16:43.391 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf")
|
||||
d := NewDockerLogParser(line)
|
||||
d := NewDockerLogParser(log.New(os.Stdout, "", log.LstdFlags))
|
||||
p, _, err := d.parsePriority(line)
|
||||
if err != nil {
|
||||
t.Fatalf("got an err: %v", err)
|
||||
|
|
Loading…
Reference in a new issue