From c63fd32fc2341f753afb147e41a607e482608a11 Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Fri, 21 Feb 2020 15:23:48 +0100 Subject: [PATCH] circleci: run P2P IPv4 and IPv6 tests in parallel (#4459) --- .circleci/config.yml | 9 ++++++++- test/p2p/circleci.sh | 25 +++++++++++++------------ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e0d8129a9..8fe23501f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -171,11 +171,15 @@ jobs: GOPATH: /home/circleci/.go_workspace machine: image: circleci/classic:latest + parameters: + ipv: + type: integer + default: 4 steps: - checkout - run: mkdir -p $GOPATH/src/github.com/tendermint - run: ln -sf /home/circleci/project $GOPATH/src/github.com/tendermint/tendermint - - run: bash test/p2p/circleci.sh + - run: bash test/p2p/circleci.sh << parameters.ipv >> - store_artifacts: path: /home/circleci/project/test/p2p/logs @@ -425,6 +429,9 @@ workflows: requires: - setup_dependencies - test_p2p + - test_p2p: + name: test_p2p_ipv6 + ipv: 6 - upload_coverage: requires: - test_cover diff --git a/test/p2p/circleci.sh b/test/p2p/circleci.sh index 92869ff45..fe8a972bd 100644 --- a/test/p2p/circleci.sh +++ b/test/p2p/circleci.sh @@ -1,21 +1,26 @@ #! /bin/bash set -eux +# Take IP version as parameter +IPV="${1:-4}" + # Get the directory of where this script is. SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" # Enable IPv6 support in Docker daemon -echo -echo "* [$(date +"%T")] enabling IPv6 stack in Docker daemon" -cat <<'EOF' | sudo tee /etc/docker/daemon.json +if [[ "$IPV" == "6" ]]; then + echo + echo "* [$(date +"%T")] enabling IPv6 stack in Docker daemon" + cat <<'EOF' | sudo tee /etc/docker/daemon.json { - "ipv6": true, - "fixed-cidr-v6": "2001:db8:1::/64" + "ipv6": true, + "fixed-cidr-v6": "2001:db8:1::/64" } EOF -sudo service docker restart + sudo service docker restart +fi LOGS_DIR="$DIR/logs" echo @@ -42,12 +47,8 @@ if [[ "$SKIP_BUILD" == "" ]]; then fi echo -echo "* [$(date +"%T")] running p2p tests on a local docker network" -bash "$DIR/../p2p/test.sh" tester - -echo -echo "* [$(date +"%T")] running IPv6 p2p tests on a local docker network" -bash "$DIR/../p2p/test.sh" tester 6 +echo "* [$(date +"%T")] running IPv$IPV p2p tests on a local docker network" +bash "$DIR/../p2p/test.sh" tester $IPV echo echo "* [$(date +"%T")] copying log files out of docker container into $LOGS_DIR"