2d684c5aec
- Replaces directly reading from a CSV - Simplifies testing - Should hopefully make it easier to plug in other sources for storage diffs (e.g. differently formatted CSVs, JSON RPC, etc)
28 lines
445 B
Go
28 lines
445 B
Go
package fakes
|
|
|
|
import (
|
|
"github.com/hpcloud/tail"
|
|
"gopkg.in/tomb.v1"
|
|
)
|
|
|
|
type MockTailer struct {
|
|
Lines chan *tail.Line
|
|
TailErr error
|
|
}
|
|
|
|
func NewMockTailer() *MockTailer {
|
|
return &MockTailer{
|
|
Lines: make(chan *tail.Line, 1),
|
|
}
|
|
}
|
|
|
|
func (mock *MockTailer) Tail() (*tail.Tail, error) {
|
|
fakeTail := &tail.Tail{
|
|
Filename: "",
|
|
Lines: mock.Lines,
|
|
Config: tail.Config{},
|
|
Tomb: tomb.Tomb{},
|
|
}
|
|
return fakeTail, mock.TailErr
|
|
}
|