Initialize Logger in tests that create a speaker controller.
Also runs gofmt, which apparently didn't run previously.
@@ -2,6 +2,7 @@ package main
import (
"net"
+ "os"
"sort"
"testing"
@@ -9,7 +10,7 @@ import (
"go.universe.tf/metallb/internal/k8s"
"github.com/go-kit/kit/log"
- "k8s.io/api/core/v1"
+ v1 "k8s.io/api/core/v1"
)
func compareUseableNodesReturnedValue(a, b []string) bool {
@@ -30,6 +31,7 @@ func compareUseableNodesReturnedValue(a, b []string) bool {
func TestUsableNodes(t *testing.T) {
c, err := newController(controllerConfig{
MyNode: "iris1",
+ Logger: log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr)),
})
if err != nil {
t.Fatalf("creating controller: %s", err)
@@ -121,6 +123,7 @@ func TestUsableNodes(t *testing.T) {
func TestShouldAnnounce(t *testing.T) {
c1, err := newController(controllerConfig{
MyNode: "iris1",
+ Logger: log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr)),
})
if err != nil {
t.Fatalf("creating controller: %s", err)
@@ -129,6 +132,7 @@ func TestShouldAnnounce(t *testing.T) {
c2, err := newController(controllerConfig{
MyNode: "iris2",
+ Logger: log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr)),
})
if err != nil {
t.Fatalf("creating controller: %s", err)
