Add E2E tests for self-referencing variable expansion in .env files #13592
Open
4RH1T3CT0R7 wants to merge 1 commit intodocker:mainfrom
Open
Add E2E tests for self-referencing variable expansion in .env files #135924RH1T3CT0R7 wants to merge 1 commit intodocker:mainfrom
4RH1T3CT0R7 wants to merge 1 commit intodocker:mainfrom
Conversation
Signed-off-by: Artem Lytkin <iprintercanon@gmail.com>
fc9cf71 to
97856c8
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
Context
Issue #13591 reports that Docker Compose doesn't support variable expansion within .env files. Investigation shows that compose-go's dotenv parser already handles this correctly — parser.go processes lines sequentially, accumulating each variable into the lookup map before parsing the next line. However, the existing test TestEnvInterpolation always sets the base variable via OS env, so it never actually exercises pure .env-internal self-reference.
This PR closes the test gap by adding an explicit E2E test that relies solely on variables defined within the .env file, with no OS env assistance.
Changes
a. Pure .env self-reference — no OS env set, asserts FULL_IMAGE: gcr.io/myproject/myapp:latest and BASE_URL: gcr.io/myproject/subpath
b. OS env override cascade — sets REGISTRY_URL=override.io in OS env, asserts that dependent variables pick up the override