Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not starting kafkaproducer in integration tests #20

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions server/benchmarking_fetch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"strconv"
"testing"
"time"
"github.com/cosminrentea/gobbler/server/configstring"
)

func Benchmark_E2E_Fetch_HelloWorld_Messages(b *testing.B) {
Expand All @@ -27,6 +28,8 @@ func Benchmark_E2E_Fetch_HelloWorld_Messages(b *testing.B) {
*Config.StoragePath = dir
*Config.WS.Enabled = true
*Config.WS.Prefix = "/stream/"
*Config.KafkaProducer.Brokers = configstring.List{}

service := StartService()
defer service.Stop()

Expand Down
2 changes: 2 additions & 0 deletions server/benchmarking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/cosminrentea/gobbler/client"
"github.com/cosminrentea/gobbler/protocol"
"github.com/cosminrentea/gobbler/testutil"
"github.com/cosminrentea/gobbler/server/configstring"
)

type testgroup struct {
Expand Down Expand Up @@ -50,6 +51,7 @@ func TestThroughput(t *testing.T) {
*Config.StoragePath = dir
*Config.WS.Enabled = true
*Config.WS.Prefix = "/stream/"
*Config.KafkaProducer.Brokers = configstring.List{}

service := StartService()

Expand Down
2 changes: 1 addition & 1 deletion server/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func assertArguments(a *assert.Assertions) {
a.Equal("dev", *Config.EnvName)
a.Equal("mem", *Config.Profile)

a.Equal("[ 127.0.0.1:9092 127.0.0.1:9091]", (*Config.KafkaProducer.Brokers).String())
a.Equal("[127.0.0.1:9092 127.0.0.1:9091]", (*Config.KafkaProducer.Brokers).String())
a.Equal("sms_reporting_topic", *Config.SMS.KafkaReportingTopic)

assertClusterRemotes(a)
Expand Down
8 changes: 6 additions & 2 deletions server/configstring/configstringlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ func (sl *List) IsEmpty() bool {

func (sl List) String() string {
res := "["
for _, s := range sl {
res = res + " " + s
for i, s := range sl {
if i == 0 {
res = res + s
} else {
res = res + " " + s
}
}
res = res + "]"
return res
Expand Down
8 changes: 6 additions & 2 deletions server/configstring/configstringlist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ func TestList_IsEmpty(t *testing.T) {
m := NewMockSettings(ctrl)
m.EXPECT().SetValue(gomock.Any())

cs := NewFromKingpin(m)
listFromKingpin := NewFromKingpin(m)

assert.True(t, cs.IsEmpty())
assert.True(t, listFromKingpin.IsEmpty())

list := &List{}

assert.True(t, list.IsEmpty())
}
2 changes: 2 additions & 0 deletions server/fcm_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/cosminrentea/gobbler/server/service"
"github.com/cosminrentea/gobbler/testutil"
"github.com/stretchr/testify/assert"
"github.com/cosminrentea/gobbler/server/configstring"
)

var (
Expand Down Expand Up @@ -142,6 +143,7 @@ func serviceSetUp(t *testing.T) (*service.Service, func()) {
*Config.FCM.Prefix = "/fcm/"
*Config.FCM.Workers = 1 // use only one worker so we can control the number of messages that go to FCM
*Config.APNS.Enabled = false
*Config.KafkaProducer.Brokers = configstring.List{}

var s *service.Service
for s == nil {
Expand Down
2 changes: 2 additions & 0 deletions server/gobbler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"reflect"
"strings"
"testing"
"github.com/cosminrentea/gobbler/server/configstring"
)

func TestValidateStoragePath(t *testing.T) {
Expand Down Expand Up @@ -115,6 +116,7 @@ func TestStartServiceModules(t *testing.T) {
*Config.FCM.Enabled = false
*Config.APNS.Enabled = false
*Config.WS.Enabled = false
*Config.KafkaProducer.Brokers = configstring.List{}

// using an available port for http
testHttpPort++
Expand Down
3 changes: 3 additions & 0 deletions server/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ import (

"github.com/cosminrentea/gobbler/restclient"
"github.com/cosminrentea/gobbler/testutil"
"github.com/cosminrentea/gobbler/server/configstring"
)

func initServerAndClients(t *testing.T) (*service.Service, client.Client, client.Client, func()) {
*Config.HttpListen = "localhost:0"
*Config.KVS = "memory"
*Config.WS.Enabled = true
*Config.WS.Prefix = "/stream/"
*Config.KafkaProducer.Brokers = configstring.List{}

s := StartService()

time.Sleep(time.Millisecond * 100)
Expand Down