Skip to content

Commit

Permalink
update param urls from single url to list of urls setup esClient
Browse files Browse the repository at this point in the history
Co-authored-by: tarabaskara <[email protected]>
  • Loading branch information
fadlinurhasan and tarabaskara committed Aug 30, 2019
1 parent ab8a382 commit 72cd74b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion flow/elastic.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func NewEsConfig(indexMethod string, bulkSize int, flushMs time.Duration, printT
}
}

func NewElastic(retrierFunc *ElasticRetrier, esConfig esConfig, urls ...string) (client elasticClient, err error) {
func NewElastic(retrierFunc *ElasticRetrier, esConfig esConfig, urls []string) (client elasticClient, err error) {

c, err := elastic.NewClient(
elastic.SetURL(urls...),
Expand Down
6 changes: 3 additions & 3 deletions flow/elastic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestElasticStore_CreateIndexError(t *testing.T) {

retrier := mockElasticRetrier()
esConfig := NewEsConfig("SingleInsert", 100, time.Duration(1000), false)
client, err := NewElastic(retrier, esConfig, ts.URL)
client, err := NewElastic(retrier, esConfig, []string{ts.URL})
FatalIfError(t, err)

err = client.Store(context.Background(), timber)
Expand All @@ -50,7 +50,7 @@ func TestElasticStore_CreateindexSuccess(t *testing.T) {

retrier := mockElasticRetrier()
esConfig := NewEsConfig("SingleInsert", 100, time.Duration(1000), false)
client, err := NewElastic(retrier, esConfig, ts.URL)
client, err := NewElastic(retrier, esConfig, []string{ts.URL})
FatalIfError(t, err)

appSecret := timber.Context().AppSecret
Expand All @@ -76,7 +76,7 @@ func TestElasticStoreman_store_SaveError(t *testing.T) {

retrier := mockElasticRetrier()
esConfig := NewEsConfig("SingleInsert", 100, time.Duration(1000), false)
client, err := NewElastic(retrier, esConfig, ts.URL)
client, err := NewElastic(retrier, esConfig, []string{ts.URL})
FatalIfError(t, err)

appSecret := timber.Context().AppSecret
Expand Down

0 comments on commit 72cd74b

Please sign in to comment.