From 66e8ec0f41a9e74ba5cd47215a2a28467c447967 Mon Sep 17 00:00:00 2001 From: Michael Li Date: Fri, 22 Nov 2024 15:05:46 -0500 Subject: [PATCH] test(e2e): Fix failure in migration test (#5277) * test(e2e): Fix log path to avoid error * test(e2e): Be explicit about port definition to avoid dockertest issue * test(e2e): Add check for health --- testing/internal/e2e/infra/docker.go | 4 ++-- testing/internal/e2e/tests/database/migration_test.go | 7 ++++--- .../e2e/tests/database/testdata/boundary-config.hcl | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/testing/internal/e2e/infra/docker.go b/testing/internal/e2e/infra/docker.go index 97bb76baf..1a412f97f 100644 --- a/testing/internal/e2e/infra/docker.go +++ b/testing/internal/e2e/infra/docker.go @@ -172,7 +172,7 @@ func StartBoundary(t testing.TB, pool *dockertest.Pool, network *dockertest.Netw Mounts: []string{path.Dir(boundaryConfigFilePath) + ":/boundary/"}, Name: "boundary", Networks: []*dockertest.Network{network}, - ExposedPorts: []string{"9200", "9201", "9202", "9203"}, + ExposedPorts: []string{"9200/tcp", "9201/tcp", "9202/tcp", "9203/tcp"}, PortBindings: map[docker.Port][]docker.PortBinding{ "9200/tcp": {{HostIP: "localhost", HostPort: "9200/tcp"}}, "9201/tcp": {{HostIP: "localhost", HostPort: "9201/tcp"}}, @@ -212,7 +212,7 @@ func StartVault(t testing.TB, pool *dockertest.Pool, network *dockertest.Network }, Name: "vault", Networks: []*dockertest.Network{network}, - ExposedPorts: []string{"8200"}, + ExposedPorts: []string{"8200/tcp"}, PortBindings: map[docker.Port][]docker.PortBinding{ "8200/tcp": {{HostIP: "localhost", HostPort: "8210/tcp"}}, }, diff --git a/testing/internal/e2e/tests/database/migration_test.go b/testing/internal/e2e/tests/database/migration_test.go index 291253662..fd6207743 100644 --- a/testing/internal/e2e/tests/database/migration_test.go +++ b/testing/internal/e2e/tests/database/migration_test.go @@ -181,16 +181,17 @@ func setupEnvironment(t testing.TB, c *config, boundaryRepo, boundaryTag string) t.Log("Waiting for Boundary to finish loading...") err = pool.Retry(func() error { - response, err := http.Get(b.UriLocalhost) + response, err := http.Get(fmt.Sprintf("%s/health", b.UriLocalhost)) if err != nil { - t.Logf("Could not access Boundary URL: %s. Retrying...", err.Error()) + t.Logf("Could not access health endpoint: %s. Retrying...", err.Error()) return err } if response.StatusCode != http.StatusOK { - return fmt.Errorf("Could not connect to %s. Status Code: %d", b.UriLocalhost, response.StatusCode) + return fmt.Errorf("Health check returned an error. Status Code: %d", response.StatusCode) } + response.Body.Close() return nil }) require.NoError(t, err) diff --git a/testing/internal/e2e/tests/database/testdata/boundary-config.hcl b/testing/internal/e2e/tests/database/testdata/boundary-config.hcl index d81477417..f191c2257 100644 --- a/testing/internal/e2e/tests/database/testdata/boundary-config.hcl +++ b/testing/internal/e2e/tests/database/testdata/boundary-config.hcl @@ -91,7 +91,7 @@ events { ] file { - path = "/logs" + path = "/boundary/logs" file_name = "audit.log" }