-
Notifications
You must be signed in to change notification settings - Fork 100
chore: Improve canister snapshot download/upload #4406
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 24 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
89fa5ce
Stream snapshot downloads to disk directly.
vincent-dfinity af8d9ed
Add progress bar for snapshot downloading.
vincent-dfinity f9b17cc
Stream snapshot uploading from disk directly.
vincent-dfinity 262b52a
Add progress bar for snapshot uploading.
vincent-dfinity 0f6f44a
Implement new_progress stub in env.
vincent-dfinity 1299854
Change the log level.
vincent-dfinity c48795c
Support snapshot downloading with resuming.
vincent-dfinity c484d67
Add snapshot download concurrency.
vincent-dfinity c2d5464
Support snapshot uploading with resuming.
vincent-dfinity 8caca0d
Add snapshot upload concurrency
vincent-dfinity 7d94221
Revert the testing chunk size.
vincent-dfinity ddd984f
Update changelog and document.
vincent-dfinity a083c51
Addressed review comments.
vincent-dfinity 8742534
Added a test for download/upload with latency, disabled it for now.
vincent-dfinity 71f4625
Make the test passed locally with toxiproxy used.
vincent-dfinity 6e987f8
Update CI to install toxiproxy for canister_extra tests.
vincent-dfinity d654ea0
Added two e2e tests for canister snapshot.
vincent-dfinity aa36711
Use toxiproxy-cli directly for debugging...
vincent-dfinity 9ac3ccb
Add more debugging info...
vincent-dfinity 0865e85
Make the snapshot tests be able to run in parallel.
vincent-dfinity 2667fd7
Add canister_extra as serial...
vincent-dfinity 35b06c6
Moved toxiproxy installation into provision script.
vincent-dfinity e5ae4ee
Make the canister snapshot network drop more robust...
vincent-dfinity a7eb17d
Merge branch 'master' into vincent/SDK-2382
vincent-dfinity fcbff22
Use limit_data instead.
vincent-dfinity 0df8dac
fix hanging test (and mac `find -printf`)
adamspofford-dfinity d155edf
remove focus tag
adamspofford-dfinity dcf1ce3
Add mention of `--resume` to error message
adamspofford-dfinity 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 |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| # Helpers for toxiproxy to use toxiproxy-server and toxiproxy-cli | ||
|
|
||
| : "${TOXIPROXY_HOST:=127.0.0.1}" | ||
| : "${TOXIPROXY_PORT:=8474}" | ||
|
|
||
| # Check if toxiproxy server is running | ||
| toxiproxy_is_running() { | ||
| curl --silent --fail "http://${TOXIPROXY_HOST}:${TOXIPROXY_PORT}/version" >/dev/null 2>&1 | ||
| } | ||
|
|
||
| # Start toxiproxy server | ||
| toxiproxy_start() { | ||
| if toxiproxy_is_running; then | ||
| return 0 | ||
| fi | ||
|
|
||
| if ! command -v toxiproxy-server >/dev/null 2>&1; then | ||
| echo "toxiproxy-server not found in PATH" >&2 | ||
| return 1 | ||
| fi | ||
|
|
||
| toxiproxy-server -host "$TOXIPROXY_HOST" -port "$TOXIPROXY_PORT" >/dev/null 2>&1 & | ||
| export E2E_TOXIPROXY_PID=$! | ||
|
|
||
| for _ in $(seq 1 50); do | ||
| if toxiproxy_is_running; then | ||
| return 0 | ||
| fi | ||
| sleep 0.1 | ||
| done | ||
|
|
||
| echo "Toxiproxy server did not become available on ${TOXIPROXY_HOST}:${TOXIPROXY_PORT}" >&2 | ||
| return 1 | ||
| } | ||
|
|
||
| # Stop toxiproxy server | ||
| toxiproxy_stop() { | ||
| if [ -n "${E2E_TOXIPROXY_PID:-}" ]; then | ||
| kill "$E2E_TOXIPROXY_PID" >/dev/null 2>&1 || true | ||
| unset E2E_TOXIPROXY_PID | ||
| fi | ||
| } | ||
|
|
||
| # Create or replace a proxy | ||
| toxiproxy_create_proxy() { | ||
| local listen=$1 upstream=$2 name=$3 | ||
|
|
||
| # Ensure toxiproxy-cli is available | ||
| if ! command -v toxiproxy-cli >/dev/null 2>&1; then | ||
| echo "toxiproxy-cli not found in PATH" >&2 | ||
| return 1 | ||
| fi | ||
|
|
||
| toxiproxy-cli delete "$name" >/dev/null 2>&1 || true | ||
| toxiproxy-cli create --listen "$listen" --upstream "$upstream" "$name" >/dev/null 2>&1 | ||
| } | ||
|
|
||
| # Delete a proxy | ||
| toxiproxy_delete_proxy() { | ||
| local name=$1 | ||
| toxiproxy-cli delete "$name" >/dev/null 2>&1 || true | ||
| } | ||
|
|
||
| # Set a proxy to enabled or disabled | ||
| toxiproxy_toggle_proxy() { | ||
| local name=$1 | ||
| toxiproxy-cli toggle "$name" >/dev/null 2>&1 | ||
| } | ||
|
|
||
| # Add latency toxic (downstream) | ||
| toxiproxy_add_latency() { | ||
| local latency=$1 jitter=$2 name=$3 | ||
| toxiproxy-cli toxic add -t latency -a latency="$latency" -a jitter="$jitter" -d "$name" >/dev/null | ||
| } |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.