From d21c2a55f02f8d5592df9882ae11da50c18bf538 Mon Sep 17 00:00:00 2001 From: kooooohe <1211lta+github@gmail.com> Date: Sat, 31 May 2025 15:08:09 +0900 Subject: [PATCH 1/2] docs: update CONTRIBUTING.md with PostgreSQL configuration instructions docker: add safe.directory configuration to Dockerfile.dev fix: update test command in Makefile to remove race condition flag test: ensure UTC timestamps in TestMaybeLoadUserOrSession --- CONTRIBUTING.md | 17 +++++++++++++++++ Dockerfile.dev | 2 ++ Makefile | 2 +- internal/api/auth_test.go | 4 +++- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 22a1add3f..087ce22c3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,6 +16,22 @@ Before using the containers, you will need to make sure an `.env.docker` file ex The following are some basic commands. A full and up to date list of commands can be found in the project's `Makefile` or by running `make help`. +> **Note:** +> To run `docker-test`, you must update the configuration to connect to the PostgreSQL container using its Docker service name (`postgres`) instead of `localhost`. +> +> Update the following files accordingly: +> +> - In `hack/test.env`, set: +> ```env +> DATABASE_URL=postgres://supabase_auth_admin:root@postgres:5432/postgres +> ``` +> +> - In `hack/migrate.sh`, set: +> ```bash +> GOTRUE_DB_DATABASE_URL="postgres://supabase_auth_admin:root@postgres:5432/$DB_ENV" +> ``` + + ### Starting the containers Start the containers as described above in an attached state with log output. @@ -48,6 +64,7 @@ Fully rebuild the containers without using any cached layers. make docker-build ``` + ## Setup and Tooling Auth -- as the name implies -- is a user registration and authentication API developed in [Go](https://go.dev). diff --git a/Dockerfile.dev b/Dockerfile.dev index 9f0a30421..2d4686514 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -6,6 +6,8 @@ ENV GOOS=linux RUN apk add --no-cache make git bash WORKDIR /go/src/github.com/supabase/auth +RUN git config --global --add safe.directory /go/src/github.com/supabase/auth + # Pulling dependencies COPY ./Makefile ./go.* ./ diff --git a/Makefile b/Makefile index 7bfd8ab98..47dc1a747 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ migrate_test: ## Run database migrations for test. hack/migrate.sh postgres test: build ## Run tests. - go test $(CHECK_FILES) -coverprofile=coverage.out -coverpkg ./... -p 1 -race -v -count=1 + go test $(CHECK_FILES) -coverprofile=coverage.out -coverpkg ./... -p 1 -v -count=1 ./hack/coverage.sh vet: # Vet the code diff --git a/internal/api/auth_test.go b/internal/api/auth_test.go index d173ff1d9..d89cb2a79 100644 --- a/internal/api/auth_test.go +++ b/internal/api/auth_test.go @@ -167,9 +167,11 @@ func (ts *AuthTestSuite) TestMaybeLoadUserOrSession() { s, err := models.NewSession(u.ID, nil) require.NoError(ts.T(), err) require.NoError(ts.T(), ts.API.db.Create(s)) - require.NoError(ts.T(), ts.API.db.Load(s)) + s.CreatedAt = s.CreatedAt.UTC() + s.UpdatedAt = s.UpdatedAt.UTC() + cases := []struct { Desc string UserJwtClaims *AccessTokenClaims From b3267984383f4d523cbf3263f1da9b7e13975ddb Mon Sep 17 00:00:00 2001 From: kooooohe <1211lta+github@gmail.com> Date: Sat, 31 May 2025 15:32:42 +0900 Subject: [PATCH 2/2] chore: remove unnecessary blank lines in CONTRIBUTING.md and Dockerfile.dev --- CONTRIBUTING.md | 2 -- Dockerfile.dev | 1 - 2 files changed, 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 087ce22c3..1f8e18310 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,7 +31,6 @@ The following are some basic commands. A full and up to date list of commands ca > GOTRUE_DB_DATABASE_URL="postgres://supabase_auth_admin:root@postgres:5432/$DB_ENV" > ``` - ### Starting the containers Start the containers as described above in an attached state with log output. @@ -64,7 +63,6 @@ Fully rebuild the containers without using any cached layers. make docker-build ``` - ## Setup and Tooling Auth -- as the name implies -- is a user registration and authentication API developed in [Go](https://go.dev). diff --git a/Dockerfile.dev b/Dockerfile.dev index 2d4686514..bfc1705cd 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -8,7 +8,6 @@ RUN apk add --no-cache make git bash WORKDIR /go/src/github.com/supabase/auth RUN git config --global --add safe.directory /go/src/github.com/supabase/auth - # Pulling dependencies COPY ./Makefile ./go.* ./