main.go: log errors if they are returned from runner.Trigger()
This commit is contained in:
parent
241ec393ac
commit
200ad6332b
2 changed files with 38 additions and 2 deletions
10
main.go
10
main.go
|
@ -107,13 +107,19 @@ func main() {
|
|||
handler := frontend.MakeFrontend(rotatingLogHandler, gerrit, runner)
|
||||
|
||||
// fetch only on first run
|
||||
runner.Trigger(fetchOnly)
|
||||
err = runner.Trigger(fetchOnly)
|
||||
if err != nil {
|
||||
log.Error(err.Error())
|
||||
}
|
||||
|
||||
// ticker
|
||||
go func() {
|
||||
for {
|
||||
time.Sleep(time.Duration(triggerInterval) * time.Second)
|
||||
runner.Trigger(fetchOnly)
|
||||
err = runner.Trigger(fetchOnly)
|
||||
if err != nil {
|
||||
log.Error(err.Error())
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
30
submitqueue/test_runner.go
Normal file
30
submitqueue/test_runner.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package submitqueue
|
||||
|
||||
// import (
|
||||
// "testing"
|
||||
|
||||
// "github.com/apex/log"
|
||||
// "github.com/apex/log/handlers/memory"
|
||||
// "github.com/tweag/gerrit-queue/gerrit"
|
||||
// )
|
||||
|
||||
// type MockClient struct {
|
||||
// gerrit.Client
|
||||
// }
|
||||
|
||||
// func (c *MockClient) Refresh() error {
|
||||
// return nil
|
||||
// }
|
||||
|
||||
// func TestNewRunner(t *testing.T) {
|
||||
// logger := &log.Logger{
|
||||
// Handler: memory.New(),
|
||||
// }
|
||||
|
||||
// //TODO
|
||||
// gerrit := &MockClient {
|
||||
// client: nil,
|
||||
// }
|
||||
// submitQueueTag := "submitme"
|
||||
// runner := NewRunner(logger, gerrit, submitQueueTag)
|
||||
// }
|
Loading…
Reference in a new issue