Extract storage diff fetching behind an interface
- 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)
This commit is contained in:
@@ -6,24 +6,22 @@ import (
|
||||
)
|
||||
|
||||
type MockTailer struct {
|
||||
Lines chan *tail.Line
|
||||
TailCalled bool
|
||||
Lines chan *tail.Line
|
||||
TailErr error
|
||||
}
|
||||
|
||||
func NewMockTailer() *MockTailer {
|
||||
return &MockTailer{
|
||||
Lines: make(chan *tail.Line, 1),
|
||||
TailCalled: false,
|
||||
Lines: make(chan *tail.Line, 1),
|
||||
}
|
||||
}
|
||||
|
||||
func (mock *MockTailer) Tail() (*tail.Tail, error) {
|
||||
mock.TailCalled = true
|
||||
fakeTail := &tail.Tail{
|
||||
Filename: "",
|
||||
Lines: mock.Lines,
|
||||
Config: tail.Config{},
|
||||
Tomb: tomb.Tomb{},
|
||||
}
|
||||
return fakeTail, nil
|
||||
return fakeTail, mock.TailErr
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user