Skip to content

Commit

Permalink
endpoint randomisation stopped
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh-awg committed Mar 6, 2024
1 parent 63ed330 commit 6de2bd1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions canned/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func NewElasticSearch(ctx context.Context) (*ElasticSearch, error) {
_ = os.Setenv("TC_HOST", "localhost")
req := testcontainers.ContainerRequest{
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"),
//Image: getEnvString("ES_CONTAINER_IMAGE", "elasticsearch:7.0.0"),
Env: map[string]string{
"discovery.type": "single-node",
"network.host": "0.0.0.0",
Expand All @@ -46,16 +46,16 @@ func NewElasticSearch(ctx context.Context) (*ElasticSearch, error) {
}
host, _ := container.Host(ctx)
port, _ := container.MappedPort(ctx, "9200")
port2, _ := container.MappedPort(ctx, "9300")
endpoint, err := container.Endpoint(ctx, "")
endpoint = fmt.Sprintf("http://%s", endpoint)
//port2, _ := container.MappedPort(ctx, "9300")
//endpoint, err := container.Endpoint(ctx, "")
endpoint := fmt.Sprintf("http://%s:%s", host, port.Port())

if err != nil {
return nil, err
}

client, err := elasticsearch.NewClient(elasticsearch.Config{
Addresses: []string{endpoint, fmt.Sprintf("http://%s:%s", host, port2.Port())},
Addresses: []string{endpoint}, //, fmt.Sprintf("http://%s:%s", host, port2.Port())},
EnableRetryOnTimeout: true,
})
if err != nil {
Expand Down

0 comments on commit 6de2bd1

Please sign in to comment.