Skip to content

Commit

Permalink
Merge pull request #157 from db7/remove-unnecessary-dependencies
Browse files Browse the repository at this point in the history
remove proto and go-metrics direct dependencies
  • Loading branch information
frairon authored Nov 5, 2018
2 parents a83ac41 + d15aa95 commit afac4cd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 145 deletions.
130 changes: 0 additions & 130 deletions mocks.go

This file was deleted.

13 changes: 0 additions & 13 deletions tester/tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
"reflect"
"sync"

"github.com/golang/protobuf/proto"

"github.com/lovoo/goka"
"github.com/lovoo/goka/kafka"
"github.com/lovoo/goka/storage"
Expand Down Expand Up @@ -225,17 +223,6 @@ func (km *Tester) StorageBuilder() storage.Builder {
}
}

// ConsumeProto simulates a message on kafka in a topic with a key.
func (km *Tester) ConsumeProto(topic string, key string, msg proto.Message) {
data, err := proto.Marshal(msg)
if err != nil && km.t != nil {
km.t.Errorf("Error marshaling message for consume: %v", err)
}
km.waitStartup()
km.pushMessage(topic, key, data)
km.waitForConsumers()
}

// ConsumeString simulates a message with a string payload.
func (km *Tester) ConsumeString(topic string, key string, msg string) {
km.waitStartup()
Expand Down
32 changes: 32 additions & 0 deletions view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,38 @@ var (
recoveredMessages int
)

// constHasher implements a hasher that will always return the specified
// partition. Doesn't properly implement the Hash32 interface, use only in
// tests.
type constHasher struct {
partition uint32
}

func (ch *constHasher) Sum(b []byte) []byte {
return nil
}

func (ch *constHasher) Sum32() uint32 {
return ch.partition
}

func (ch *constHasher) BlockSize() int {
return 0
}

func (ch *constHasher) Reset() {}

func (ch *constHasher) Size() int { return 4 }

func (ch *constHasher) Write(p []byte) (n int, err error) {
return len(p), nil
}

// NewConstHasher creates a constant hasher that hashes any value to 0.
func NewConstHasher(part uint32) hash.Hash32 {
return &constHasher{partition: part}
}

func createTestView(t *testing.T, consumer kafka.Consumer, sb storage.Builder, tm kafka.TopicManager) *View {
recoveredMessages = 0
opts := &voptions{
Expand Down
2 changes: 0 additions & 2 deletions web/monitor/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"net/http"

"github.com/gorilla/mux"
"github.com/rcrowley/go-metrics"
)

var baseTemplates = append(templates.BaseTemplates, "web/templates/monitor/menu.go.html")
Expand Down Expand Up @@ -57,7 +56,6 @@ func (s *Server) BasePath() string {
type processorStats struct {
ID string
ClientID string
metrics metrics.Registry
}

func (s *Server) AttachProcessor(processor *goka.Processor) {
Expand Down

0 comments on commit afac4cd

Please sign in to comment.