Skip to content

Commit

Permalink
another try
Browse files Browse the repository at this point in the history
  • Loading branch information
facundomedica committed Oct 23, 2023
1 parent 150eb5e commit 5adff76
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions tests/e2e/setup/price-feeder.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"io"
"net/http"
"net/url"
"os"
"time"

Expand Down Expand Up @@ -61,12 +60,7 @@ func (s *E2ETestSuite) runPriceFeeder(valIndex int) {
)
s.Require().NoError(err)

hostport := getHostPort(s.priceFeederResource, PriceFeederServerPort)
s.T().Log("result from gethostport:", hostport, err)
if hostport == "" {
hostport = "localhost:7171"
}
endpoint := fmt.Sprintf("http://%s/api/v1/prices", hostport)
endpoint := fmt.Sprintf("http://%s/api/v1/prices", s.priceFeederResource.GetHostPort(PriceFeederServerPort))
s.T().Log("this is the endpoint:", endpoint, PriceFeederContainerRepo)

checkHealth := func() bool {
Expand Down Expand Up @@ -109,6 +103,7 @@ func (s *E2ETestSuite) runPriceFeeder(valIndex int) {
}

if !isHealthy {

err := s.DkrPool.Client.Logs(docker.LogsOptions{
Container: s.priceFeederResource.Container.ID,
OutputStream: os.Stdout,
Expand All @@ -126,15 +121,3 @@ func (s *E2ETestSuite) runPriceFeeder(valIndex int) {

s.T().Logf("started price-feeder container: %s", s.priceFeederResource.Container.ID)
}

func getHostPort(resource *dockertest.Resource, id string) string {
dockerURL := os.Getenv("DOCKER_HOST")
if dockerURL == "" {
return resource.GetHostPort(id)
}
u, err := url.Parse(dockerURL)
if err != nil {
panic(err)
}
return u.Hostname() + ":" + resource.GetPort(id)
}

0 comments on commit 5adff76

Please sign in to comment.