Skip to content

Commit

Permalink
fix(e2e): docker host internal
Browse files Browse the repository at this point in the history
  • Loading branch information
mabdh committed Nov 4, 2022
1 parent 164fa9e commit ec7ccb7
Show file tree
Hide file tree
Showing 18 changed files with 316 additions and 404 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test: ## Run the tests
go test -race $(shell go list ./... | grep -v /test/) -covermode=atomic -coverprofile=coverage.out

e2e-test: ## Run all e2e tests
go test -v -race ./test/e2e_test/... -coverprofile=coverage.out --timeout 60s
go test -v -race ./test/e2e_test/... -coverprofile=coverage.out --timeout 120s

coverage: ## Print code coverage
go test -race -coverprofile coverage.out -covermode=atomic ./... && go tool cover -html=coverage.out
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0
github.com/newrelic/go-agent/v3 v3.12.0
github.com/newrelic/go-agent/v3/integrations/nrgrpc v1.3.1
github.com/odpf/salt v0.2.5-0.20221104075046-434fc1e9375a
github.com/odpf/salt v0.2.5-0.20221104100256-dc17b102381a
github.com/ory/dockertest/v3 v3.9.1
github.com/pelletier/go-toml/v2 v2.0.2 // indirect
github.com/prometheus/alertmanager v0.21.1-0.20200911160112-1fdff6b3f939
Expand Down
14 changes: 8 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,6 @@ github.com/cortexproject/cortex v1.4.1-0.20201022071705-85942c5703cf h1:TGmSZFMN
github.com/cortexproject/cortex v1.4.1-0.20201022071705-85942c5703cf/go.mod h1:MBJnS5mzVcHqivBp2391HpflMeMiT+f8r4VNkJlsZFs=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
Expand Down Expand Up @@ -1558,10 +1557,14 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/odpf/salt v0.2.5-0.20221019092709-83b91cba3daf h1:Ehn6ltBEIowDKtfnkptzZ+Y+32PSMalx2N3Td1jnbD4=
github.com/odpf/salt v0.2.5-0.20221019092709-83b91cba3daf/go.mod h1:SVfb9FtFA22A5AUvXF9QfwkT3KSCkkKw53P0DmtrSXw=
github.com/odpf/salt v0.2.5-0.20221104075046-434fc1e9375a h1:U+Wm5SN9BM/+xvyHq2zhdWAeUlDwdi8aARURw+z24gk=
github.com/odpf/salt v0.2.5-0.20221104075046-434fc1e9375a/go.mod h1:SVfb9FtFA22A5AUvXF9QfwkT3KSCkkKw53P0DmtrSXw=
github.com/odpf/salt v0.2.5-0.20221104082327-331b4095e025 h1:2NjPtpdzRSFBb2Nsw8kLjBqvCGUXrRaVgRHQHPI0qLc=
github.com/odpf/salt v0.2.5-0.20221104082327-331b4095e025/go.mod h1:SVfb9FtFA22A5AUvXF9QfwkT3KSCkkKw53P0DmtrSXw=
github.com/odpf/salt v0.2.5-0.20221104085240-fa2885f66cce h1:eTLlA1AUA6MTeNh3FSG3syy3RjzKhxyPLvl7OqiXOcg=
github.com/odpf/salt v0.2.5-0.20221104085240-fa2885f66cce/go.mod h1:SVfb9FtFA22A5AUvXF9QfwkT3KSCkkKw53P0DmtrSXw=
github.com/odpf/salt v0.2.5-0.20221104090941-0fcfbd98eed1 h1:bMVMatG8HnRs+ZOz+Qns/a27u+94auPyn5ieOaUe624=
github.com/odpf/salt v0.2.5-0.20221104090941-0fcfbd98eed1/go.mod h1:SVfb9FtFA22A5AUvXF9QfwkT3KSCkkKw53P0DmtrSXw=
github.com/odpf/salt v0.2.5-0.20221104100256-dc17b102381a h1:8VANBL7/1RjMZxbL+ExlRP4nyStqn393pw4t17kaL5g=
github.com/odpf/salt v0.2.5-0.20221104100256-dc17b102381a/go.mod h1:SVfb9FtFA22A5AUvXF9QfwkT3KSCkkKw53P0DmtrSXw=
github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU=
Expand Down Expand Up @@ -1803,7 +1806,6 @@ github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
Expand Down
5 changes: 3 additions & 2 deletions internal/store/postgres/alerts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ import (
"github.com/odpf/salt/log"
"github.com/odpf/siren/core/alert"
"github.com/odpf/siren/internal/store/postgres"
"github.com/ory/dockertest/v3"
"github.com/stretchr/testify/suite"
)

type AlertsRepositoryTestSuite struct {
suite.Suite
ctx context.Context
pool *dockertestx.Pool
resource *dockertestx.Resource
pool *dockertest.Pool
resource *dockertest.Resource
client *postgres.Client
repository *postgres.AlertRepository
}
Expand Down
5 changes: 3 additions & 2 deletions internal/store/postgres/namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ import (
"github.com/odpf/siren/core/namespace"
"github.com/odpf/siren/core/provider"
"github.com/odpf/siren/internal/store/postgres"
"github.com/ory/dockertest/v3"
"github.com/stretchr/testify/suite"
)

type NamespaceRepositoryTestSuite struct {
suite.Suite
ctx context.Context
client *postgres.Client
pool *dockertestx.Pool
resource *dockertestx.Resource
pool *dockertest.Pool
resource *dockertest.Resource
repository *postgres.NamespaceRepository
}

Expand Down
4 changes: 2 additions & 2 deletions internal/store/postgres/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"os"

"github.com/odpf/salt/db"
"github.com/odpf/salt/dockertestx"
"github.com/odpf/salt/log"
"github.com/odpf/siren/core/alert"
"github.com/odpf/siren/core/namespace"
Expand All @@ -17,6 +16,7 @@ import (
"github.com/odpf/siren/core/subscription"
"github.com/odpf/siren/core/template"
"github.com/odpf/siren/internal/store/postgres"
"github.com/ory/dockertest/v3"
)

const (
Expand All @@ -35,7 +35,7 @@ var (
}
)

func purgeDocker(pool *dockertestx.Pool, resource *dockertestx.Resource) error {
func purgeDocker(pool *dockertest.Pool, resource *dockertest.Resource) error {
if err := pool.Purge(resource); err != nil {
return fmt.Errorf("could not purge resource: %w", err)
}
Expand Down
5 changes: 3 additions & 2 deletions internal/store/postgres/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ import (
"github.com/odpf/salt/log"
"github.com/odpf/siren/core/provider"
"github.com/odpf/siren/internal/store/postgres"
"github.com/ory/dockertest/v3"
"github.com/stretchr/testify/suite"
)

type ProviderRepositoryTestSuite struct {
suite.Suite
ctx context.Context
client *postgres.Client
pool *dockertestx.Pool
resource *dockertestx.Resource
pool *dockertest.Pool
resource *dockertest.Resource
repository *postgres.ProviderRepository
}

Expand Down
5 changes: 3 additions & 2 deletions internal/store/postgres/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ import (
"github.com/odpf/salt/log"
"github.com/odpf/siren/core/receiver"
"github.com/odpf/siren/internal/store/postgres"
"github.com/ory/dockertest/v3"
"github.com/stretchr/testify/suite"
)

type ReceiverRepositoryTestSuite struct {
suite.Suite
ctx context.Context
client *postgres.Client
pool *dockertestx.Pool
resource *dockertestx.Resource
pool *dockertest.Pool
resource *dockertest.Resource
repository *postgres.ReceiverRepository
}

Expand Down
5 changes: 3 additions & 2 deletions internal/store/postgres/rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ import (
"github.com/odpf/salt/log"
"github.com/odpf/siren/core/rule"
"github.com/odpf/siren/internal/store/postgres"
"github.com/ory/dockertest/v3"
"github.com/stretchr/testify/suite"
)

type RuleRepositoryTestSuite struct {
suite.Suite
ctx context.Context
client *postgres.Client
pool *dockertestx.Pool
resource *dockertestx.Resource
pool *dockertest.Pool
resource *dockertest.Resource
repository *postgres.RuleRepository
}

Expand Down
5 changes: 3 additions & 2 deletions internal/store/postgres/subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ import (
"github.com/odpf/salt/log"
"github.com/odpf/siren/core/subscription"
"github.com/odpf/siren/internal/store/postgres"
"github.com/ory/dockertest/v3"
"github.com/stretchr/testify/suite"
)

type SubscriptionRepositoryTestSuite struct {
suite.Suite
ctx context.Context
client *postgres.Client
pool *dockertestx.Pool
resource *dockertestx.Resource
pool *dockertest.Pool
resource *dockertest.Resource
repository *postgres.SubscriptionRepository
}

Expand Down
5 changes: 3 additions & 2 deletions internal/store/postgres/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ import (
"github.com/odpf/salt/log"
"github.com/odpf/siren/core/template"
"github.com/odpf/siren/internal/store/postgres"
"github.com/ory/dockertest/v3"
"github.com/stretchr/testify/suite"
)

type TemplateRepositoryTestSuite struct {
suite.Suite
ctx context.Context
client *postgres.Client
pool *dockertestx.Pool
resource *dockertestx.Resource
pool *dockertest.Pool
resource *dockertest.Resource
repository *postgres.TemplateRepository
}

Expand Down
5 changes: 3 additions & 2 deletions plugins/queues/postgresq/queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/odpf/siren/core/receiver"
"github.com/odpf/siren/plugins/queues/postgresq"
"github.com/odpf/siren/plugins/queues/postgresq/migrations"
"github.com/ory/dockertest/v3"
"github.com/stretchr/testify/suite"
)

Expand All @@ -23,8 +24,8 @@ type QueueTestSuite struct {
logger log.Logger
ctx context.Context
dbc *db.Client
pool *dockertestx.Pool
resource *dockertestx.Resource
pool *dockertest.Pool
resource *dockertest.Resource
q *postgresq.Queue
dlq *postgresq.Queue
}
Expand Down
Loading

0 comments on commit ec7ccb7

Please sign in to comment.