-
Notifications
You must be signed in to change notification settings - Fork 178
/
Copy pathproxy_test.go
31 lines (26 loc) · 917 Bytes
/
proxy_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package goka
import (
"testing"
"github.com/IBM/sarama"
"github.com/lovoo/goka/storage"
)
type nullProxy struct{}
func (p *nullProxy) Add(topic string, offset int64) error { return nil }
func (p *nullProxy) Remove(topic string) error { return nil }
func (p *nullProxy) AddGroup() {}
func (p *nullProxy) Stop() {}
func TestUpdateWithHeaders(t *testing.T) {
s := storageProxy{
update: func(ctx UpdateContext, s storage.Storage, key string, value []byte) error {
if len(ctx.Headers()) == 0 {
t.Errorf("Missing headers")
return nil
}
if string(ctx.Headers()["key"]) != "value" {
t.Errorf("Key missmatch. Expected %q. Found: %q", "key", string(ctx.Headers()["key"]))
}
return nil
},
}
_ = s.Update(&DefaultUpdateContext{headers: []*sarama.RecordHeader{{Key: []byte("key"), Value: []byte("value")}}}, "", nil)
}