Skip to content

fix(test): remove orphaned gock mock in TestUpdateRemoteConfig#4913

Open
lightstrike wants to merge 1 commit intosupabase:developfrom
lightstrikelabs:lightstrikelabs/fix/updater-test-gock-mock
Open

fix(test): remove orphaned gock mock in TestUpdateRemoteConfig#4913
lightstrike wants to merge 1 commit intosupabase:developfrom
lightstrikelabs:lightstrikelabs/fix/updater-test-gock-mock

Conversation

@lightstrike
Copy link

Summary

TestUpdateRemoteConfig/updates_all_configs fails because gock.IsDone() returns false — a registered mock for GET /v1/projects/test-project/network-restrictions is never consumed.

Root Cause

This is a regression introduced by the interaction of two commits:

  1. 69937e09 (Dec 2025, PR feat: support storage s3 protocol config #4545 — S3 protocol support): Added a gock mock for the network-restrictions endpoint to the "updates all configs" integration test. At the time, UpdateDbNetworkRestrictionsConfig made the API call unconditionally, so the mock was always consumed.

  2. 2f6e0c32 (Feb 2026, PR fix(updater): network restrictions not enabled #4887 — network restrictions safety fix): Added an early-return guard to UpdateDbNetworkRestrictionsConfig:

    if !n.Enabled {
        return nil
    }

    This correctly prevents 400 errors on projects without network restrictions entitlements. However, the "updates all configs" test was not updated to account for this new guard. Since the test config does not set NetworkRestrictions.Enabled = true, the function now returns early, the HTTP call is never made, and the gock mock is left unconsumed.

Fix

Remove the orphaned gock mock (5 lines). The test intentionally leaves NetworkRestrictions.Enabled at its zero value (false), consistent with Auth/Storage/Experimental which are each explicitly set to Enabled: true when the test intends to exercise their update paths.

The dedicated TestUpdateDbNetworkRestrictionsConfig (also added in PR #4887) already covers both the disabled-skip and enabled-error paths.

Test plan

  • go test ./config/... -run TestUpdateRemoteConfig -count=1 passes
  • Verified the same TestAuthDiff failures exist on upstream develop (pre-existing, unrelated)

PR supabase#4887 added an early return to UpdateDbNetworkRestrictionsConfig when NetworkRestrictions.Enabled is false, but didn't remove the corresponding gock mock from the "updates_all_configs" subtest. The mock was never consumed, causing gock.IsDone() to fail.
@coderabbitai
Copy link

coderabbitai bot commented Mar 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Cache: Disabled due to Reviews > Disable Cache setting

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5726ec3 and e7407ed.

📒 Files selected for processing (1)
  • pkg/config/updater_test.go
💤 Files with no reviewable changes (1)
  • pkg/config/updater_test.go

📝 Walkthrough

Summary by CodeRabbit

  • Tests
    • Updated configuration update test to streamline mock API requests while maintaining validation of remaining flows.

Walkthrough

The test file pkg/config/updater_test.go was modified to remove mock expectations for a network-restrictions API call from the TestUpdateRemoteConfig test. Specifically, the test no longer expects a GET request to /v1/projects/test-project/network-restrictions with a subsequent empty JSON response. The remaining test assertions for postgrest, database, auth, storage, and experimental API flows remain unchanged.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lightstrike lightstrike marked this pull request as ready for review March 1, 2026 02:10
@lightstrike lightstrike requested a review from a team as a code owner March 1, 2026 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant