diff --git a/go/topkapi/client_test.go b/go/topkapi/client_test.go index 08e452c8..1f62876a 100644 --- a/go/topkapi/client_test.go +++ b/go/topkapi/client_test.go @@ -1,34 +1,36 @@ package topkapi import ( - "fmt" - "hash/adler32" - "testing" + "fmt" + "hash/adler32" + "os" + "testing" ) func TestTopicPrefix(t *testing.T) { - config := &ClientConfig{ - TopicPrefix: "hase-", - } - fulltopic := getTopicWithPrefix("horst", config) - if fulltopic != "hase-horst" { - t.Error(fulltopic + " unexpected") - } + config := &ClientConfig{ + TopicPrefix: "hase-", + } + fulltopic := getTopicWithPrefix("horst", config) + if fulltopic != "hase-horst" { + t.Error(fulltopic + " unexpected") + } } func TestChecksum(t *testing.T) { - message := "SummerOf69!" - checksum := adler32.Checksum([]byte(message)) - if checksum != 422708159 { - t.Error(fmt.Sprint(checksum) + " unexpected") - } + message := "SummerOf69!" + checksum := adler32.Checksum([]byte(message)) + if checksum != 422708159 { + t.Error(fmt.Sprint(checksum) + " unexpected") + } } func TestClientSetup(t *testing.T) { - expected := "testTheRest" - client := NewClientWithId(expected) - actual1 := client.Config.ClientId - if actual1 != expected { - t.Error(fmt.Sprintf("Expected %s got %s", expected, actual1)) - } + _ = os.Setenv("KAFKA_BROKERS", "localhost:9094") + expected := "testTheRest" + client := NewClientWithId(expected) + actual1 := client.Config.ClientId + if actual1 != expected { + t.Error(fmt.Sprintf("Expected %s got %s", expected, actual1)) + } }