Skip to content

Commit

Permalink
Fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Soulou committed Nov 26, 2018
1 parent d8c68a6 commit d1a3e34
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 4 deletions.
8 changes: 8 additions & 0 deletions nsqlbproducer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Mock Generation

```
mockgen -destination nsqlbproducermock/gomock_publish_pinger.go \
-package nsqlbproducermock \
github.com/Scalingo/go-utils/nsqlbproducer \
PublishPinger
```
9 changes: 8 additions & 1 deletion nsqlbproducer/lbproducer.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,15 @@ type NsqLBProducer struct {
logger logrus.FieldLogger
}

type PublishPinger interface {
Publish(context.Context, string, nsqproducer.NsqMessageSerialize) error
DeferredPublish(context.Context, string, int64, nsqproducer.NsqMessageSerialize) error
Ping() error
Stop()
}

type producer struct {
producer *nsqproducer.NsqProducer
producer PublishPinger
host Host
}

Expand Down
6 changes: 3 additions & 3 deletions nsqlbproducer/lbproducer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"errors"
"testing"

"github.com/Scalingo/go-utils/nsqlbproducer/nsqlbproducermock"
"github.com/Scalingo/go-utils/nsqproducer"
"github.com/Scalingo/go-utils/nsqproducer/nsqproducermock"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -113,8 +113,8 @@ func runPublishExample(t *testing.T, example example, deferred bool) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()

p1 := nsqproducermock.NewMockProducer(ctrl)
p2 := nsqproducermock.NewMockProducer(ctrl)
p1 := nsqlbproducermock.NewMockPublishPinger(ctrl)
p2 := nsqlbproducermock.NewMockPublishPinger(ctrl)

if example.ExpectP1Call {
if deferred {
Expand Down
81 changes: 81 additions & 0 deletions nsqlbproducer/nsqlbproducermock/gomock_publish_pinger.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d1a3e34

Please sign in to comment.