about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2019-12-03T10·07+0100
committerFlorian Klink <flokli@flokli.de>2019-12-03T10·07+0100
commit200ad6332b61b643ea943b45938d7d3d17865b2b (patch)
tree3bf2d1b48121a270330db2f16833934bd915487b
parent241ec393acb6e7e8c784aeed56e281b13a7bc4c6 (diff)
main.go: log errors if they are returned from runner.Trigger()
-rw-r--r--main.go10
-rw-r--r--submitqueue/test_runner.go30
2 files changed, 38 insertions, 2 deletions
diff --git a/main.go b/main.go
index f939c7e370c4..9f3277e9a90e 100644
--- a/main.go
+++ b/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())
+				}
 			}
 		}()
 
diff --git a/submitqueue/test_runner.go b/submitqueue/test_runner.go
new file mode 100644
index 000000000000..e5c33cb2e56a
--- /dev/null
+++ b/submitqueue/test_runner.go
@@ -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)
+// }