Skip to content

Commit

Permalink
set dummy value for kafka brokers
Browse files Browse the repository at this point in the history
  • Loading branch information
tillkuhn committed Jan 12, 2024
1 parent af14d80 commit 24baeb6
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions go/topkapi/client_test.go
Original file line number Diff line number Diff line change
@@ -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))
}
}

0 comments on commit 24baeb6

Please sign in to comment.