test(caddy): cover server_idx registration scenarios#2530
Merged
henderkes merged 1 commit intoJul 20, 2026
Conversation
Covers the sharing and registration logic around server_idx: - Caddyfile parsing assigns incrementing indexes - modules with the same server_idx share one server instance and register it only once - modules without server_idx each get their own server - an explicit server_idx equal to an already registered one joins the existing server instead of re-registering (the double-registration scenario possible with JSON configs POSTed to the admin API)
alexandre-daubois
approved these changes
Jul 20, 2026
henderkes
approved these changes
Jul 20, 2026
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.
Follow-up to #2499, targeting
refactor/phpserver. Test-only.During review, an explicit
server_idxcolliding with an auto-assigned one could make one handler serve another's files; the fix (deferring registration to a single pass keyed by index) had no regression test, and nothing incaddy/exercisedserver_idxat all. This adds unit coverage for:server_idxshare one server instance, registered only onceserver_idxeach get their own serverserver_idxequal to an already registered one joins the existing server instead of re-registering it (the double-registration scenario possible with JSON configs POSTed to the admin API)These are pure Go unit tests on
registerModules(); an end-to-end admin API config-swap test would be a natural follow-up but needs the PHP runtime, so it is not included here.