aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCecylia Bocovich <cohosh@torproject.org>2024-01-03 19:13:26 -0500
committerCecylia Bocovich <cohosh@torproject.org>2024-02-27 13:41:43 -0500
commitb3b03d1a56f38c7d9648c3e3b1fd241d4e3adffe (patch)
tree651e6419f1be9de5129e4d881871a4630dcf925a
parentb130151b24db155e4ea89517b72b73b21949c84b (diff)
downloadsnowflake-b3b03d1a56f38c7d9648c3e3b1fd241d4e3adffe.tar.gz
snowflake-b3b03d1a56f38c7d9648c3e3b1fd241d4e3adffe.zip
Add integration testing with shadow
This change uses the Shadow network simulator[0] to run a minimal snowflake network and pass data between a client and a server. [0] https://shadow.github.io/
-rw-r--r--.gitlab-ci.yml76
1 files changed, 76 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f17ffd6..994589b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -154,6 +154,82 @@ debian-testing:
script:
- *go-test
+shadow-integration:
+ # Need golang 1.21 from unstable to build snowflake
+ image: debian:sid-slim
+ variables:
+ SHADOW_VERSION: "v3.1.0"
+ TGEN_VERSION: "v1.1.2"
+ cache:
+ key: sf-integration-$SHADOW_VERSION-$TGEN_VERSION
+ paths:
+ - /opt/
+ script:
+ - apt-get update
+ - apt-get install -y git tor
+ - mkdir -p ~/.local/bin
+ - mkdir -p ~/.local/src
+ - export PATH=$PATH:$CI_PROJECT_DIR/opt/bin/
+
+ # Install shadow and tgen
+ - pushd ~/.local/src
+ - |
+ if [ ! -f opt/shadow/bin/shadow ]
+ then
+ echo "The required version of shadow was not cached, building from source"
+ git clone --branch $SHADOW_VERSION --depth 1 https://github.com/shadow/shadow.git
+ pushd shadow/
+ CONTAINER=debian:sid-slim ci/container_scripts/install_deps.sh
+ CC=gcc CONTAINER=debian:sid-slim ci/container_scripts/install_extra_deps.sh
+ apt-get install -y zlib1g
+ export PATH="$HOME/.cargo/bin:${PATH}"
+ ./setup build --jobs $(nproc) --prefix $CI_PROJECT_DIR/opt/
+ ./setup install
+ popd
+ fi
+ - |
+ if [ ! -f opt/shadow/bin/tgen ]
+ then
+ echo "The required version of tgen was not cached, building from source"
+ git clone --branch $TGEN_VERSION --depth 1 https://github.com/shadow/tgen.git
+ pushd tgen/
+ apt-get install -y cmake libglib2.0-dev libigraph-dev
+ mkdir build && cd build
+ cmake .. -DCMAKE_INSTALL_PREFIX=$CI_PROJECT_DIR/opt/
+ make
+ make install
+ popd
+ fi
+ install $CI_PROJECT_DIR/opt/bin/tgen ~/.local/bin/tgen
+ - popd
+
+ # Install snowflake binaries to .local folder
+ - |
+ for app in "proxy" "client" "server" "broker" "probetest"; do
+ pushd $app
+ go build
+ install $app ~/.local/bin/snowflake-$app
+ popd
+ done
+
+ # Install stun server
+ - GOBIN=~/.local/bin go install github.com/gortc/stund@latest
+
+ # Run a minimal snowflake shadow experiment
+ - git clone --depth 1 https://github.com/cohosh/shadow-snowflake-minimal
+ - pushd shadow-snowflake-minimal/
+ - shadow --log-level=debug --model-unblocked-syscall-latency=true snowflake-minimal.yaml > shadow.log
+
+ # Check to make sure streams succeeded
+ - |
+ if [ $(grep -c "stream-success" shadow.data/hosts/snowflakeclient/tgen.1006.stdout) = 10 ]
+ then
+ echo "All streams in shadow completed successfully"
+ else
+ echo "Shadow simulation failed"
+ exit 1
+ fi
+
generate_tarball:
stage: deploy
image: golang:1.21-$DEBIAN_STABLE