2019-04-26 15:42:40 +00:00
|
|
|
// VulcanizeDB
|
|
|
|
// Copyright © 2019 Vulcanize
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2019-01-28 22:52:47 +00:00
|
|
|
package fakes
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hpcloud/tail"
|
|
|
|
"gopkg.in/tomb.v1"
|
|
|
|
)
|
|
|
|
|
|
|
|
type MockTailer struct {
|
2019-04-24 20:05:57 +00:00
|
|
|
Lines chan *tail.Line
|
|
|
|
TailErr error
|
2019-01-28 22:52:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewMockTailer() *MockTailer {
|
|
|
|
return &MockTailer{
|
2019-04-24 20:05:57 +00:00
|
|
|
Lines: make(chan *tail.Line, 1),
|
2019-01-28 22:52:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mock *MockTailer) Tail() (*tail.Tail, error) {
|
|
|
|
fakeTail := &tail.Tail{
|
|
|
|
Filename: "",
|
|
|
|
Lines: mock.Lines,
|
|
|
|
Config: tail.Config{},
|
|
|
|
Tomb: tomb.Tomb{},
|
|
|
|
}
|
2019-04-24 20:05:57 +00:00
|
|
|
return fakeTail, mock.TailErr
|
2019-01-28 22:52:47 +00:00
|
|
|
}
|