-
-
Notifications
You must be signed in to change notification settings - Fork 238
more reliable retries and fallback mirror usage - #1336 #1339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2bd09bd
Don't break out of the retry loop for ZipExceptions - fixes #1336
wilzbach 7cccb81
restrict zip exception handler to specific unpack statement
MartinNowak 2e58cc1
more robust testing
MartinNowak 30c872d
fix retry on http status error
MartinNowak 85d065f
unify retry counts to 3
MartinNowak 8b2145f
allow to add fallbacks to custom registry for testing purposes
MartinNowak 659e8db
test fallback mirror usage on server errors
MartinNowak aae40d5
dump dub output on failure
MartinNowak 8f14ccf
Add symlink for 1.0.2.zip of the tested gitcompatiblepackage (to 1.0…
wilzbach 2f7aa5a
fetchzip.sh: Display $retryCount in the error log output
wilzbach 4ba3a65
Use echo instead of bash here string
wilzbach 9c43002
Bump min frontend of fetchzip due to vibe.d incompatibility for the
wilzbach a885e97
Bump vibe.d to 0.8.3-alpha.1 for compatibility with dmd-nightly
wilzbach db084af
bump min frontend for ddox to 2.072
MartinNowak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,3 +11,5 @@ | |
| custom-unittest/custom-unittest | ||
| path-subpackage-ref/test | ||
| subpackage-ref/test | ||
|
|
||
| /test_registry | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 2.071 | ||
| 2.072 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| #!/bin/bash | ||
| DIR=$(dirname "${BASH_SOURCE[0]}") | ||
|
|
||
| . "$DIR"/common.sh | ||
|
|
||
| PORT=$(($$ + 1024)) # PID + 1024 | ||
|
|
||
| dub remove gitcompatibledubpackage --non-interactive --version=* 2>/dev/null || true | ||
|
|
||
| "$DUB" build --single "$DIR"/test_registry.d | ||
| "$DIR"/test_registry --folder="$DIR/issue1336-registry" --port=$PORT & | ||
| PID=$! | ||
| sleep 0.2 | ||
| trap 'kill $PID 2>/dev/null || true' exit | ||
|
|
||
| echo "Trying to download gitcompatibledubpackage (1.0.4)" | ||
| timeout 1s "$DUB" fetch gitcompatibledubpackage --version=1.0.4 --skip-registry=all --registry=http://localhost:$PORT | ||
| if [ $? -eq 124 ]; then | ||
| die 'Fetching from responsive registry should not time-out.' | ||
| fi | ||
| dub remove gitcompatibledubpackage --non-interactive --version=1.0.4 | ||
|
|
||
| echo "Downloads should be retried when the zip is corrupted - gitcompatibledubpackage (1.0.3)" | ||
| zipOut=$(! timeout 1s "$DUB" fetch gitcompatibledubpackage --version=1.0.3 --skip-registry=all --registry=http://localhost:$PORT 2>&1) | ||
| rc=$? | ||
|
|
||
| if ! zipCount=$(grep -Fc 'Failed to extract zip archive' <<<"$zipOut") || [ "$zipCount" -lt 3 ] ; then | ||
| echo '========== +Output was ==========' >&2 | ||
| echo "$zipOut" >&2 | ||
| echo '========== -Output was ==========' >&2 | ||
| die 'DUB should have tried to download the zip archive multiple times.' | ||
| elif [ $rc -eq 124 ]; then | ||
| die 'DUB timed out unexpectedly.' | ||
| fi | ||
| if dub remove gitcompatibledubpackage --non-interactive --version=* 2>/dev/null; then | ||
| die 'DUB should not have installed a broken package.' | ||
| fi | ||
|
|
||
| echo "HTTP status errors on downloads should be retried - gitcompatibledubpackage (1.0.2)" | ||
| retryOut=$(! timeout 1s "$DUB" fetch gitcompatibledubpackage --version=1.0.2 --skip-registry=all --registry=http://localhost:$PORT --vverbose 2>&1) | ||
| rc=$? | ||
| if ! retryCount=$(echo "$retryOut" | grep -Fc 'Bad Gateway') || [ "$retryCount" -lt 3 ] ; then | ||
| echo '========== +Output was ==========' >&2 | ||
| echo "$retryOut" >&2 | ||
| echo '========== -Output was ==========' >&2 | ||
| die "DUB should have retried download on server error multiple times, but only tried $retryCount times." | ||
| elif [ $rc -eq 124 ]; then | ||
| die 'DUB timed out unexpectedly.' | ||
| fi | ||
| if dub remove gitcompatibledubpackage --non-interactive --version=* 2>/dev/null; then | ||
| die 'DUB should not have installed a package.' | ||
| fi | ||
|
|
||
| echo "HTTP status errors on downloads should retry with fallback mirror - gitcompatibledubpackage (1.0.2)" | ||
| timeout 1s "$DUB" fetch gitcompatibledubpackage --version=1.0.2 --skip-registry=all --registry="http://localhost:$PORT http://localhost:$PORT/fallback" | ||
| if [ $? -eq 124 ]; then | ||
| die 'Fetching from responsive registry should not time-out.' | ||
| fi | ||
| dub remove gitcompatibledubpackage --non-interactive --version=1.0.2 | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 2.076 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| .dub | ||
| docs.json | ||
| __dummy.html | ||
| docs/ | ||
| issue1336-registry.so | ||
| issue1336-registry.dylib | ||
| issue1336-registry.dll | ||
| issue1336-registry.a | ||
| issue1336-registry.lib | ||
| issue1336-registry-test-* | ||
| *.exe | ||
| *.o | ||
| *.obj | ||
| *.lst |
Empty file.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"repository":{"project":"gitcompatibledubpackage","owner":"dlang-community","kind":"github"},"dateAdded":"2017-02-11T21:00:16","name":"gitcompatibledubpackage","categories":[],"owner":"5148973d2179ddb20b0002fd","id":"589f6d501c18646d0ee49f12","versions":[{"packageDescriptionFile":"dub.sdl","configurations":[{"name":"exe","targetType":"executable","mainSourceFile":"hello.d"},{"excludedSourceFiles":["hello.d"],"name":"lib","targetType":"library"}],"commitID":"9e3972be4c63790c32257220f40c0af7dc41bec5","importPaths":[".."],"name":"gitcompatibledubpackage","version":"~master","license":"public domain","readmeFile":"/README.md","date":"2017-09-18T18:18:35Z","description":"Example of a DUB package also usable as git submodule. For DUB test suite.","sourcePaths":["."]},{"packageDescriptionFile":"dub.json","commitID":"b62466d32dd6bbb0d45f9a73c91142205d1048e5","importPaths":[".."],"name":"gitcompatibledubpackage","version":"1.0.1","license":"public domain","readmeFile":"/README.md","date":"2015-10-31T11:09:14Z","description":"Example of a DUB package also usable as git submodule. For DUB test suite."},{"packageDescriptionFile":"dub.json","commitID":"cef89b5513a140b1e3417809f59d1957ddaad837","importPaths":[".."],"name":"gitcompatibledubpackage","version":"1.0.2","license":"public domain","readmeFile":"/README.md","date":"2015-10-31T11:23:53Z","description":"Example of a DUB package also usable as git submodule. For DUB test suite.","sourcePaths":["."]},{"packageDescriptionFile":"dub.json","commitID":"d36e49d31b26ea76e1670e9d5cd89aaac40fde75","importPaths":[".."],"name":"gitcompatibledubpackage","version":"1.0.3","targetType":"executable","license":"public domain","readmeFile":"/README.md","date":"2017-04-05T22:12:48Z","description":"Example of a DUB package also usable as git submodule. For DUB test suite.","mainSourceFile":"hello.d","sourcePaths":["."]},{"packageDescriptionFile":"dub.sdl","configurations":[{"name":"exe","targetType":"executable","mainSourceFile":"hello.d"},{"excludedSourceFiles":["hello.d"],"name":"lib","targetType":"library"}],"commitID":"9e3972be4c63790c32257220f40c0af7dc41bec5","importPaths":[".."],"name":"gitcompatibledubpackage","version":"1.0.4","license":"public domain","readmeFile":"/README.md","date":"2017-09-18T18:18:35Z","description":"Example of a DUB package also usable as git submodule. For DUB test suite.","sourcePaths":["."]}]} |
1 change: 1 addition & 0 deletions
1
test/issue1336-registry/packages/gitcompatibledubpackage/1.0.2.zip
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 1.0.4.zip |
1 change: 1 addition & 0 deletions
1
test/issue1336-registry/packages/gitcompatibledubpackage/1.0.3.zip
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| BROKEN ZIP |
Binary file not shown.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /+dub.sdl: | ||
| dependency "vibe-d" version="~>0.8.3-alpha.1" | ||
| versions "VibeNoSSL" | ||
| +/ | ||
|
|
||
| void main(string[] args) | ||
| { | ||
| import std.conv, vibe.d; | ||
| immutable folder = readRequiredOption!string("folder", "Folder to service files from."); | ||
| immutable port = readRequiredOption!uint("port", "Port to use"); | ||
| auto router = new URLRouter; | ||
| router.get("stop", (HTTPServerRequest req, HTTPServerResponse res){ | ||
| res.writeVoidBody; | ||
| exitEventLoop(); | ||
| }); | ||
| router.get("/packages/gitcompatibledubpackage/1.0.2.zip", (req, res) { | ||
| res.writeBody("", HTTPStatus.badGateway); | ||
| }); | ||
| router.get("*", folder.serveStaticFiles); | ||
| router.get("/fallback/*", folder.serveStaticFiles(new HTTPFileServerSettings("/fallback"))); | ||
| listenHTTP(text(":", port), router); | ||
| runApplication(); | ||
| } |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Travis log shows an error and
retryCountof1- despite the log clearly showing "Bad Gateway" three times: