Skip to content

Commit

Permalink
set 3min for indexinit
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh-awg committed Mar 5, 2024
1 parent 172051c commit c253ec1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 6 additions & 5 deletions canned/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ func NewElasticSearch(ctx context.Context) (*ElasticSearch, error) {
Image: getEnvString("ES_CONTAINER_IMAGE", "docker.elastic.co/elasticsearch/elasticsearch-oss:7.0.0"),
//Image: getEnvString("ES_CONTAINER_IMAGE", "157529275398.dkr.ecr.ap-south-1.amazonaws.com/ci-libraries/docker.elastic.co/elasticsearch/elasticsearch:6.4.2"),
Env: map[string]string{
"discovery.type": "single-node",
"network.host": "0.0.0.0",
"network.bind_host": "0.0.0.0",
"discovery.type": "single-node",
//"network.host": "0.0.0.0",
//"network.bind_host": "0.0.0.0",
},
ExposedPorts: []string{"9200/tcp", "9300/tcp"},
WaitingFor: wait.ForListeningPort("9200").WithStartupTimeout(time.Minute * 3), // Default timeout is 1 minute
//WaitingFor: wait.ForHTTP("/").WithPort("9200/tcp").WithStartupTimeout(time.Minute * 3),
RegistryCred: getBasicAuth(),
//AutoRemove: true,
SkipReaper: skipReaper(),
SkipReaper: skipReaper(),
}
container, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
ContainerRequest: req,
Expand All @@ -54,7 +54,8 @@ func NewElasticSearch(ctx context.Context) (*ElasticSearch, error) {
}

client, err := elasticsearch.NewClient(elasticsearch.Config{
Addresses: []string{endpoint},
Addresses: []string{endpoint},
EnableRetryOnTimeout: true,
})
if err != nil {
return nil, err
Expand Down
6 changes: 4 additions & 2 deletions pkg/grillelasticsearch/stubs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import (
func (ge *ElasticSearch) CreateIndex(index string, mapping string) grill.Stub {
return grill.StubFunc(func() error {
req := esapi.IndicesCreateRequest{
Index: index,
Body: strings.NewReader(mapping),
Index: index,
MasterTimeout: 3000,
Timeout: 3000,
Body: strings.NewReader(mapping),
}
res, err := req.Do(context.Background(), ge.elasticSearch.Client)
if err != nil {
Expand Down

0 comments on commit c253ec1

Please sign in to comment.