test(auth): use supabase cli where possible - docker for extra tests#1985
Closed
test(auth): use supabase cli where possible - docker for extra tests#1985
Conversation
b9ad89a to
72ecfa2
Compare
059be8e to
8887523
Compare
@supabase/auth-js
@supabase/functions-js
@supabase/postgrest-js
@supabase/realtime-js
@supabase/storage-js
@supabase/supabase-js
commit: |
3b3c85c to
ef7b834
Compare
ef7b834 to
c68e3f9
Compare
c68e3f9 to
7dba452
Compare
7dba452 to
c1f0284
Compare
0a12489 to
a64c946
Compare
a64c946 to
fa7adbf
Compare
1965fcd to
e1c2833
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR migrates the
auth-jstest infrastructure from a multi-instance Docker Compose setup to a single Supabase CLI instance for the majority of tests, while preserving Docker-based tests for edge cases that require specific GoTrue configurations.Motivation
The original
auth-jstest setup used Docker Compose to run 4 separate GoTrue instances with different configurations:We have decided to move our test suites to use the
supabaseCLI wherever possible. It provides a simpler, faster alternative that covers the majority of test scenarios with a single instance.Changes
New Test Structure
Test Distribution
test:authtest:dockerDocker-Only Tests (11 total)
These tests require GoTrue configurations not possible with a single CLI instance:
Signup Disabled (1 test)
GOTRUE_DISABLE_SIGNUP=trueAsymmetric JWT / RS256 (3 tests)
Phone OTP / SMS (6 tests)
Anonymous Sign-in Disabled (1 test)
GOTRUE_EXTERNAL_ANONYMOUS_USERS_ENABLED=falseTargets/Scripts to run
test:authtest:infratest:suitetest:dockertest:docker:infratest:docker:suiteSupabase CLI Configuration
Key settings in
test/supabase/config.toml:How to Test
Run CLI tests locally
Run Docker tests locally
Bug Fixes
This PR also fixes a pre-existing test bug:
fetchJwktests were overridingauthWithSession['fetch']with a mock but never restoring it. This caused subsequent tests (likesignInAnonymously) to fail because they used the mocked fetch that returned JWKS data instead of auth responses. Fixed by addingbeforeEach/afterEachto save and restore the original fetch.