I'm trying to run integration tests that need to talk to a postgres db. I'm getting a connection refused - I'm not sure why. Here's my code:
func integration(ctx context.Context, client *dagger.Client) error {
postgres := client.Container().
From("postgres:13.3-alpine").
WithEnvVariable("POSTGRES_USER", "postgres").
WithEnvVariable("POSTGRES_PASSWORD", "postgres").
WithEnvVariable("POSTGRES_HOST_AUTH_METHOD", "trust").
WithEnvVariable("POSTGRES_DB", "bareminimum").
WithExposedPort(5432).
// WithExec([]string{"postgres"}).
AsService()
_, err := client.
Container().
From("golangci/golangci-lint:v1.55.0").
WithDirectory("/src", client.Host().Directory(".")).WithWorkdir("/src").
WithExec([]string{"go", "test", "-json", "-race", "-tags=integration", "./..."}).
WithServiceBinding("postgres", postgres).
Sync(ctx)
return err
}
Any ideas?