Skip to content

fix: make docker-test work as described in Quickstart guide #2041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ 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.
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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.* ./
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion internal/api/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down