Repository: supabase/cli
Pull request #644 (2022-11-28 04:34:16)

chore: improve test coverage for start command
## What kind of change does this PR introduce?

tests

## What is the new behavior?

also allows typegen to work with db start

## Additional context

Add any other context or screenshots.


coveralls: ## Pull Request Test Coverage Report for [Build 3561736455](https://coveralls.io/builds/54598221)

* **48** of **48**   **(100.0%)**  changed or added relevant lines in **1** file are covered.
* **12** unchanged lines in **2** files lost coverage.
* Overall coverage increased (+**3.6%**) to **53.909%**

---


|  Files with Coverage Reduction | New Missed Lines | % |
| :-----|--------------|--: |
| [internal/start/start.go](https://coveralls.io/builds/54598221/source?filename=internal%2Fstart%2Fstart.go#L175) | 2 | 78.16% |
| [internal/utils/docker.go](https://coveralls.io/builds/54598221/source?filename=internal%2Futils%2Fdocker.go#L94) | 10 | 66.67% |
<!-- | **Total:** | **12** |  | -->

|  Totals | [![Coverage Status](https://coveralls.io/builds/54598221/badge)](https://coveralls.io/builds/54598221) |
| :-- | --: |
| Change from base [Build 3561732803](https://coveralls.io/builds/54598198): |  3.6% |
| Covered Lines: | 2993 |
| Relevant Lines: | 5552 |

---
##### 💛  - [Coveralls](https://coveralls.io)


Patch:
diff --git a/internal/functions/serve/serve.go b/internal/functions/serve/serve.go
index db52e4c2..521ff224 100644
--- a/internal/functions/serve/serve.go
+++ b/internal/functions/serve/serve.go
@@ -65,21 +65,16 @@ func Run(ctx context.Context, slug string, envFilePath string, verifyJWT bool, f
 			return err
 		}
 
-		if _, err := utils.DockerRun(
+		if _, err := utils.DockerStart(
 			ctx,
-			utils.DenoRelayId,
-			&container.Config{
-				Image: utils.GetRegistryImageUrl(utils.DenoRelayImage),
+			container.Config{
+				Image: utils.DenoRelayImage,
 				Env:   env,
-				Labels: map[string]string{
-					"com.supabase.cli.project":   utils.Config.ProjectId,
-					"com.docker.compose.project": utils.Config.ProjectId,
-				},
 			},
-			&container.HostConfig{
-				Binds:       []string{filepath.Join(cwd, utils.FunctionsDir) + ":" + relayFuncDir + ":ro,z"},
-				NetworkMode: container.NetworkMode(utils.NetId),
+			container.HostConfig{
+				Binds: []string{filepath.Join(cwd, utils.FunctionsDir) + ":" + relayFuncDir + ":ro,z"},
 			},
+			utils.DenoRelayId,
 		); err != nil {
 			return err
 		}
diff --git a/internal/gen/types/typescript/typescript.go b/internal/gen/types/typescript/typescript.go
index 5cfda169..17a899a0 100644
--- a/internal/gen/types/typescript/typescript.go
+++ b/internal/gen/types/typescript/typescript.go
@@ -87,7 +87,7 @@ func Run(ctx context.Context, useLocal bool, useLinked bool, projectId string, d
 			return err
 		}
 
-		out, err := utils.DockerExecOnce(ctx, utils.PgmetaId, []string{
+		out, err := utils.DockerRunOnce(ctx, utils.PgmetaImage, []string{
 			"PG_META_DB_HOST=" + utils.DbId,
 		}, []string{
 			"node",
diff --git a/internal/start/start.go b/internal/start/start.go
index 42981c02..a28d49bf 100644
--- a/internal/start/start.go
+++ b/internal/start/start.go
@@ -146,11 +146,10 @@ func run(p utils.Program, ctx context.Context, fsys afero.Fs, options ...func(*p
 			return err
 		}
 
-		if _, err := utils.DockerRun(
+		if _, err := utils.DockerStart(
 			ctx,
-			utils.KongId,
-			&container.Config{
-				Image: utils.GetRegistryImageUrl(utils.KongImage),
+			container.Config{
+				Image: utils.KongImage,
 				Env: []string{
 					"KONG_DATABASE=off",
 					"KONG_DECLARATIVE_CONFIG=/home/kong/kong.yml",
@@ -166,16 +165,12 @@ func run(p utils.Program, ctx context.Context, fsys afero.Fs, options ...func(*p
 ` + kongConfigBuf.String() + `
 EOF
 `},
-				Labels: map[string]string{
-					"com.supabase.cli.project":   utils.Config.ProjectId,
-					"com.docker.compose.project": utils.Config.ProjectId,
-				},
 			},
-			&container.HostConfig{
-				NetworkMode:   container.NetworkMode(utils.NetId),
+			container.HostConfig{
 				PortBindings:  nat.PortMap{"8000/tcp": []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Api.Port), 10)}}},
 				RestartPolicy: container.RestartPolicy{Name: "always"},
 			},
+			utils.KongId,
 		); err != nil {
 			return err
 		}
@@ -245,28 +240,22 @@ EOF
 			}
 		}
 
-		if _, err := utils.DockerRun(
+		if _, err := utils.DockerStart(
 			ctx,
-			utils.GotrueId,
-			&container.Config{
-				Image: utils.GetRegistryImageUrl(utils.GotrueImage),
+			container.Config{
+				Image: utils.GotrueImage,
 				Env:   env,
-				Labels: map[string]string{
-					"com.supabase.cli.project":   utils.Config.ProjectId,
-					"com.docker.compose.project": utils.Config.ProjectId,
-				},
 			},
-			&container.HostConfig{
-				NetworkMode:   container.NetworkMode(utils.NetId),
+			container.HostConfig{
 				RestartPolicy: container.RestartPolicy{Name: "always"},
 			},
+			utils.GotrueId,
 		); err != nil {
 			return err
 		}
 	}
 
-	var inbucketPortBindings = nat.PortMap{"9000/tcp": []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Inbucket.Port), 10)}}}
-
+	inbucketPortBindings := nat.PortMap{"9000/tcp": []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Inbucket.Port), 10)}}}
 	if utils.Config.Inbucket.SmtpPort != 0 {
 		inbucketPortBindings["2500/tcp"] = []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Inbucket.SmtpPort), 10)}}
 	}
@@ -274,31 +263,25 @@ EOF
 		inbucketPortBindings["1100/tcp"] = []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Inbucket.Pop3Port), 10)}}
 	}
 	// Start Inbucket.
-	if _, err := utils.DockerRun(
+	if _, err := utils.DockerStart(
 		ctx,
-		utils.InbucketId,
-		&container.Config{
-			Image: utils.GetRegistryImageUrl(utils.InbucketImage),
-			Labels: map[string]string{
-				"com.supabase.cli.project":   utils.Config.ProjectId,
-				"com.docker.compose.project": utils.Config.ProjectId,
-			},
+		container.Config{
+			Image: utils.InbucketImage,
 		},
-		&container.HostConfig{
-			NetworkMode:   container.NetworkMode(utils.NetId),
+		container.HostConfig{
 			PortBindings:  inbucketPortBindings,
 			RestartPolicy: container.RestartPolicy{Name: "always"},
 		},
+		utils.InbucketId,
 	); err != nil {
 		return err
 	}
 
 	// Start Realtime.
-	if _, err := utils.DockerRun(
+	if _, err := utils.DockerStart(
 		ctx,
-		utils.RealtimeId,
-		&container.Config{
-			Image: utils.GetRegistryImageUrl(utils.RealtimeImage),
+		container.Config{
+			Image: utils.RealtimeImage,
 			Env: []string{
 				"PORT=4000",
 				"DB_HOST=" + utils.DbId,
@@ -315,24 +298,20 @@ EOF
 				"ENABLE_TAILSCALE=false",
 				"DNS_NODES=''",
 			},
-			Labels: map[string]string{
-				"com.supabase.cli.project":   utils.Config.ProjectId,
-				"com.docker.compose.project": utils.Config.ProjectId,
-			},
 		},
-		&container.HostConfig{
-			NetworkMode:   container.NetworkMode(utils.NetId),
+		container.HostConfig{
 			RestartPolicy: container.RestartPolicy{Name: "always"},
-		}); err != nil {
+		},
+		utils.RealtimeId,
+	); err != nil {
 		return err
 	}
 
 	// Start PostgREST.
-	if _, err := utils.DockerRun(
+	if _, err := utils.DockerStart(
 		ctx,
-		utils.RestId,
-		&container.Config{
-			Image: utils.GetRegistryImageUrl(utils.PostgrestImage),
+		container.Config{
+			Image: utils.PostgrestImage,
 			Env: []string{
 				"PGRST_DB_URI=postgresql://postgres:postgres@" + utils.DbId + ":5432/postgres",
 				"PGRST_DB_SCHEMAS=" + strings.Join(append([]string{"public", "storage", "graphql_public"}, utils.Config.Api.Schemas...), ","),
@@ -340,25 +319,20 @@ EOF
 				"PGRST_DB_ANON_ROLE=anon",
 				"PGRST_JWT_SECRET=" + utils.JWTSecret,
 			},
-			Labels: map[string]string{
-				"com.supabase.cli.project":   utils.Config.ProjectId,
-				"com.docker.compose.project": utils.Config.ProjectId,
-			},
 		},
-		&container.HostConfig{
-			NetworkMode:   container.NetworkMode(utils.NetId),
+		container.HostConfig{
 			RestartPolicy: container.RestartPolicy{Name: "always"},
 		},
+		utils.RestId,
 	); err != nil {
 		return err
 	}
 
 	// Start Storage.
-	if _, err := utils.DockerRun(
+	if _, err := utils.DockerStart(
 		ctx,
-		utils.StorageId,
-		&container.Config{
-			Image: utils.GetRegistryImageUrl(utils.StorageImage),
+		container.Config{
+			Image: utils.StorageImage,
 			Env: []string{
 				"ANON_KEY=" + utils.AnonKey,
 				"SERVICE_KEY=" + utils.ServiceRoleKey,
@@ -373,68 +347,53 @@ EOF
 				"REGION=stub",
 				"GLOBAL_S3_BUCKET=stub",
 			},
-			Labels: map[string]string{
-				"com.supabase.cli.project":   utils.Config.ProjectId,
-				"com.docker.compose.project": utils.Config.ProjectId,
-			},
 		},
-		&container.HostConfig{
-			NetworkMode:   container.NetworkMode(utils.NetId),
+		container.HostConfig{
 			RestartPolicy: container.RestartPolicy{Name: "always"},
 		},
+		utils.StorageId,
 	); err != nil {
 		return err
 	}
 
 	// Start diff tool.
-	if _, err := utils.DockerRun(
+	if _, err := utils.DockerStart(
 		ctx,
-		utils.DifferId,
-		&container.Config{
-			Image:      utils.GetRegistryImageUrl(utils.DifferImage),
+		container.Config{
+			Image:      utils.DifferImage,
 			Entrypoint: []string{"sleep", "infinity"},
-			Labels: map[string]string{
-				"com.supabase.cli.project":   utils.Config.ProjectId,
-				"com.docker.compose.project": utils.Config.ProjectId,
-			},
 		},
-		&container.HostConfig{
-			NetworkMode:   container.NetworkMode(utils.NetId),
+		container.HostConfig{
 			RestartPolicy: container.RestartPolicy{Name: "always"},
 		},
+		utils.DifferId,
 	); err != nil {
 		return err
 	}
 
 	// Start pg-meta.
-	if _, err := utils.DockerRun(
+	if _, err := utils.DockerStart(
 		ctx,
-		utils.PgmetaId,
-		&container.Config{
-			Image: utils.GetRegistryImageUrl(utils.PgmetaImage),
+		container.Config{
+			Image: utils.PgmetaImage,
 			Env: []string{
 				"PG_META_PORT=8080",
 				"PG_META_DB_HOST=" + utils.DbId,
 			},
-			Labels: map[string]string{
-				"com.supabase.cli.project":   utils.Config.ProjectId,
-				"com.docker.compose.project": utils.Config.ProjectId,
-			},
 		},
-		&container.HostConfig{
-			NetworkMode:   container.NetworkMode(utils.NetId),
+		container.HostConfig{
 			RestartPolicy: container.RestartPolicy{Name: "always"},
 		},
+		utils.PgmetaId,
 	); err != nil {
 		return err
 	}
 
 	// Start Studio.
-	if _, err := utils.DockerRun(
+	if _, err := utils.DockerStart(
 		ctx,
-		utils.StudioId,
-		&container.Config{
-			Image: utils.GetRegistryImageUrl(utils.StudioImage),
+		container.Config{
+			Image: utils.StudioImage,
 			Env: []string{
 				"STUDIO_PG_META_URL=http://" + utils.PgmetaId + ":8080",
 				"POSTGRES_PASSWORD=postgres",
@@ -444,16 +403,12 @@ EOF
 				"SUPABASE_ANON_KEY=" + utils.AnonKey,
 				"SUPABASE_SERVICE_KEY=" + utils.ServiceRoleKey,
 			},
-			Labels: map[string]string{
-				"com.supabase.cli.project":   utils.Config.ProjectId,
-				"com.docker.compose.project": utils.Config.ProjectId,
-			},
 		},
-		&container.HostConfig{
-			NetworkMode:   container.NetworkMode(utils.NetId),
+		container.HostConfig{
 			PortBindings:  nat.PortMap{"3000/tcp": []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Studio.Port), 10)}}},
 			RestartPolicy: container.RestartPolicy{Name: "always"},
 		},
+		utils.StudioId,
 	); err != nil {
 		return err
 	}


Test patch:
diff --git a/internal/functions/serve/serve_test.go b/internal/functions/serve/serve_test.go
new file mode 100644
index 00000000..d933e19b
--- /dev/null
+++ b/internal/functions/serve/serve_test.go
@@ -0,0 +1,43 @@
+package serve
+
+import (
+	"context"
+	"net/http"
+	"testing"
+
+	"github.com/docker/docker/api/types"
+	"github.com/spf13/afero"
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+	"github.com/supabase/cli/internal/testing/apitest"
+	"github.com/supabase/cli/internal/utils"
+	"gopkg.in/h2non/gock.v1"
+)
+
+func TestServeCommand(t *testing.T) {
+	t.Run("serves function locally", func(t *testing.T) {
+		// Setup in-memory fs
+		fsys := afero.NewMemMapFs()
+		require.NoError(t, utils.WriteConfig(fsys, false))
+		// Setup mock docker
+		require.NoError(t, apitest.MockDocker(utils.Docker))
+		defer gock.OffAll()
+		gock.New(utils.Docker.DaemonHost()).
+			Get("/v" + utils.Docker.ClientVersion() + "/containers").
+			Reply(http.StatusOK).
+			JSON(types.ContainerJSON{})
+		gock.New(utils.Docker.DaemonHost()).
+			Delete("/v" + utils.Docker.ClientVersion() + "/containers").
+			Reply(http.StatusOK)
+		utils.DenoRelayId = "test-deno"
+		apitest.MockDockerStart(utils.Docker, utils.GetRegistryImageUrl(utils.DenoRelayImage), utils.DenoRelayId)
+		gock.New(utils.Docker.DaemonHost()).
+			Post("/v" + utils.Docker.ClientVersion() + "/containers").
+			Reply(http.StatusServiceUnavailable)
+		// Run test
+		err := Run(context.Background(), "test-func", "", true, fsys)
+		// Check error
+		assert.ErrorContains(t, err, "request returned Service Unavailable for API route and version http://localhost/v1.41/containers/supabase_deno_relay_serve/exec")
+		assert.Empty(t, apitest.ListUnmatchedRequests())
+	})
+}
diff --git a/internal/gen/types/typescript/typescript_test.go b/internal/gen/types/typescript/typescript_test.go
index b2271e09..6a4b5608 100644
--- a/internal/gen/types/typescript/typescript_test.go
+++ b/internal/gen/types/typescript/typescript_test.go
@@ -2,6 +2,7 @@ package typescript
 
 import (
 	"context"
+	"errors"
 	"net/http"
 	"testing"
 
@@ -16,6 +17,27 @@ import (
 )
 
 func TestGenLocalCommand(t *testing.T) {
+	t.Run("generates typescript types", func(t *testing.T) {
+		containerId := "test-pgmeta"
+		imageUrl := utils.GetRegistryImageUrl(utils.PgmetaImage)
+		// Setup in-memory fs
+		fsys := afero.NewMemMapFs()
+		require.NoError(t, utils.WriteConfig(fsys, false))
+		// Setup mock docker
+		require.NoError(t, apitest.MockDocker(utils.Docker))
+		defer gock.OffAll()
+		gock.New(utils.Docker.DaemonHost()).
+			Get("/v" + utils.Docker.ClientVersion() + "/containers").
+			Reply(200).
+			JSON(types.ContainerJSON{})
+		apitest.MockDockerStart(utils.Docker, imageUrl, containerId)
+		require.NoError(t, apitest.MockDockerLogs(utils.Docker, containerId, "hello world"))
+		// Run test
+		assert.NoError(t, Run(context.Background(), true, false, "", "", []string{}, fsys))
+		// Validate api
+		assert.Empty(t, apitest.ListUnmatchedRequests())
+	})
+
 	t.Run("throws error on missing config", func(t *testing.T) {
 		assert.Error(t, Run(context.Background(), true, false, "", "", []string{}, afero.NewMemMapFs()))
 	})
@@ -36,7 +58,7 @@ func TestGenLocalCommand(t *testing.T) {
 		assert.Empty(t, apitest.ListUnmatchedRequests())
 	})
 
-	t.Run("throws error failure to exec", func(t *testing.T) {
+	t.Run("throws error on image fetch failure", func(t *testing.T) {
 		// Setup in-memory fs
 		fsys := afero.NewMemMapFs()
 		require.NoError(t, utils.WriteConfig(fsys, false))
@@ -48,7 +70,7 @@ func TestGenLocalCommand(t *testing.T) {
 			Reply(200).
 			JSON(types.ContainerJSON{})
 		gock.New(utils.Docker.DaemonHost()).
-			Post("/v" + utils.Docker.ClientVersion() + "/containers").
+			Get("/v" + utils.Docker.ClientVersion() + "/images").
 			Reply(http.StatusServiceUnavailable)
 		// Run test
 		assert.Error(t, Run(context.Background(), true, false, "", "", []string{}, fsys))
@@ -102,6 +124,28 @@ func TestGenLinkedCommand(t *testing.T) {
 		// Run test
 		assert.Error(t, Run(context.Background(), false, true, "", "", []string{}, fsys))
 	})
+
+	t.Run("throws error on network failure", func(t *testing.T) {
+		// Setup in-memory fs
+		fsys := afero.NewMemMapFs()
+		require.NoError(t, utils.WriteConfig(fsys, false))
+		// Setup valid projectId id
+		projectId := apitest.RandomProjectRef()
+		require.NoError(t, afero.WriteFile(fsys, utils.ProjectRefPath, []byte(projectId), 0644))
+		// Setup valid access token
+		token := apitest.RandomAccessToken(t)
+		t.Setenv("SUPABASE_ACCESS_TOKEN", string(token))
+		// Flush pending mocks after test execution
+		defer gock.OffAll()
+		gock.New("https://api.supabase.io").
+			Get("/v1/projects/" + projectId + "/types/typescript").
+			ReplyError(errors.New("network failure"))
+		// Run test
+		err := Run(context.Background(), false, true, "", "", []string{}, fsys)
+		// Validate api
+		assert.ErrorContains(t, err, "network failure")
+		assert.Empty(t, apitest.ListUnmatchedRequests())
+	})
 }
 
 func TestGenProjectIdCommand(t *testing.T) {
@@ -133,6 +177,26 @@ func TestGenProjectIdCommand(t *testing.T) {
 		// Run test
 		assert.Error(t, Run(context.Background(), false, false, projectId, "", []string{}, fsys))
 	})
+
+	t.Run("throws error on network failure", func(t *testing.T) {
+		// Setup in-memory fs
+		fsys := afero.NewMemMapFs()
+		// Setup valid projectId id
+		projectId := apitest.RandomProjectRef()
+		// Setup valid access token
+		token := apitest.RandomAccessToken(t)
+		t.Setenv("SUPABASE_ACCESS_TOKEN", string(token))
+		// Flush pending mocks after test execution
+		defer gock.OffAll()
+		gock.New("https://api.supabase.io").
+			Get("/v1/projects/" + projectId + "/types/typescript").
+			ReplyError(errors.New("network failure"))
+		// Run test
+		err := Run(context.Background(), false, false, projectId, "", []string{}, fsys)
+		// Validate api
+		assert.ErrorContains(t, err, "network failure")
+		assert.Empty(t, apitest.ListUnmatchedRequests())
+	})
 }
 
 func TestGenRemoteCommand(t *testing.T) {
diff --git a/internal/start/start_test.go b/internal/start/start_test.go
index 797b6fe1..09d0164c 100644
--- a/internal/start/start_test.go
+++ b/internal/start/start_test.go
@@ -8,7 +8,6 @@ import (
 	"testing"
 
 	"github.com/docker/docker/api/types"
-	"github.com/docker/docker/api/types/container"
 	"github.com/spf13/afero"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
@@ -190,6 +189,7 @@ func TestDatabaseStart(t *testing.T) {
 				Reply(http.StatusOK).
 				JSON(types.ImageInspect{})
 		}
+		// Start postgres
 		utils.DbId = "test-postgres"
 		utils.Config.Db.Port = 54322
 		apitest.MockDockerStart(utils.Docker, imageUrl, utils.DbId)
@@ -199,11 +199,30 @@ func TestDatabaseStart(t *testing.T) {
 			JSON(types.ContainerJSON{ContainerJSONBase: &types.ContainerJSONBase{
 				State: &types.ContainerState{Health: &types.Health{Status: "healthy"}},
 			}})
-		// Start kong
-		gock.New(utils.Docker.DaemonHost()).
-			Post("/v" + utils.Docker.ClientVersion() + "/containers/create").
-			Reply(http.StatusCreated).
-			JSON(container.ContainerCreateCreatedBody{})
+		// Start services
+		utils.KongId = "test-kong"
+		apitest.MockDockerStart(utils.Docker, utils.GetRegistryImageUrl(utils.KongImage), utils.KongId)
+		utils.GotrueId = "test-gotrue"
+		flag := true
+		utils.Config.Auth.EnableSignup = &flag
+		utils.Config.Auth.Email.EnableSignup = &flag
+		utils.Config.Auth.Email.DoubleConfirmChanges = &flag
+		utils.Config.Auth.Email.EnableConfirmations = &flag
+		apitest.MockDockerStart(utils.Docker, utils.GetRegistryImageUrl(utils.GotrueImage), utils.GotrueId)
+		utils.InbucketId = "test-inbucket"
+		apitest.MockDockerStart(utils.Docker, utils.GetRegistryImageUrl(utils.InbucketImage), utils.InbucketId)
+		utils.RealtimeId = "test-realtime"
+		apitest.MockDockerStart(utils.Docker, utils.GetRegistryImageUrl(utils.RealtimeImage), utils.RealtimeId)
+		utils.RestId = "test-rest"
+		apitest.MockDockerStart(utils.Docker, utils.GetRegistryImageUrl(utils.PostgrestImage), utils.RestId)
+		utils.StorageId = "test-storage"
+		apitest.MockDockerStart(utils.Docker, utils.GetRegistryImageUrl(utils.StorageImage), utils.StorageId)
+		utils.DifferId = "test-differ"
+		apitest.MockDockerStart(utils.Docker, utils.GetRegistryImageUrl(utils.DifferImage), utils.DifferId)
+		utils.PgmetaId = "test-pgmeta"
+		apitest.MockDockerStart(utils.Docker, utils.GetRegistryImageUrl(utils.PgmetaImage), utils.PgmetaId)
+		utils.StudioId = "test-studio"
+		apitest.MockDockerStart(utils.Docker, utils.GetRegistryImageUrl(utils.StudioImage), utils.StudioId)
 		// Setup mock postgres
 		utils.GlobalsSql = "create schema public"
 		utils.InitialSchemaSql = "create schema private"
@@ -216,7 +235,7 @@ func TestDatabaseStart(t *testing.T) {
 		// Run test
 		err := run(p, context.Background(), fsys, conn.Intercept)
 		// Check error
-		assert.ErrorContains(t, err, "dial http: unknown network http")
+		assert.NoError(t, err)
 		assert.Empty(t, apitest.ListUnmatchedRequests())
 	})
 }