fix: detect silent wget failures in container DownloadFile#743
Open
dlevy-msft-sql wants to merge 4 commits intomicrosoft:mainfrom
Open
fix: detect silent wget failures in container DownloadFile#743dlevy-msft-sql wants to merge 4 commits intomicrosoft:mainfrom
dlevy-msft-sql wants to merge 4 commits intomicrosoft:mainfrom
Conversation
5c04558 to
8a5de5a
Compare
DownloadFile discarded wget's exit code, so failed downloads (e.g. unreachable host) produced no error. The caller then tried to restore a missing or empty .bak file, yielding a confusing 'volume is empty' message from SQL Server. Add ExecInspect to runCmdInContainer to capture the exit code. Check wget's exit code in DownloadFile and panic with stderr context on failure. Also adds mkdir -p for idempotent directory creation. Fixes microsoft#566
8a5de5a to
feaae22
Compare
- Add ExtraHosts host-gateway mapping to ContainerRun so containers can resolve host.docker.internal to the Docker host - Update TestController_EnsureImage to replace 127.0.0.1/localhost with host.docker.internal so wget inside the container can reach the host's httptest server in CI
httptest.NewServer binds to 127.0.0.1, which is unreachable from the Docker bridge network even with host.docker.internal. Use NewUnstartedServer with a 0.0.0.0 listener so the container can connect via 172.17.0.1.
Use net.Listen tcp4 + net.SplitHostPort to extract the port and build the host.docker.internal URL directly. Avoids fragile string replacements that miss IPv6 [::] addresses on some CI runners.
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.
Problem
\DownloadFile\ discarded wget's stdout/stderr, so failed downloads (e.g. unreachable host, DNS failure, 404) produced no error. The caller then tried to restore a missing or empty .bak\ file, yielding a confusing \The volume on device '...' is empty\ message from SQL Server.
Fix
After wget completes, verify the output file exists and is non-empty via \ est -s. If the file is missing or empty, panic with the wget stderr output for diagnosis. This stays consistent with the existing panic-based precondition pattern in the container package.
Also:
What changed
Fixes #566