From 3f5654d6bd32fda0ed59f8e851cd8f183de64319 Mon Sep 17 00:00:00 2001 From: dydxwill <119354122+dydxwill@users.noreply.github.com> Date: Tue, 2 Jan 2024 12:55:45 -0800 Subject: [PATCH] [IND-551] create script for resetting the network in e2e test (#914) --- e2e-testing/README.md | 26 +------------------------- e2e-testing/reset-network.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 25 deletions(-) create mode 100755 e2e-testing/reset-network.sh diff --git a/e2e-testing/README.md b/e2e-testing/README.md index 3aab0154f4..a9a874c8cc 100644 --- a/e2e-testing/README.md +++ b/e2e-testing/README.md @@ -19,30 +19,6 @@ pnpm build && pnpm test #### Quickest way to reset the network/clear all Indexer data sources without rebuilding from scratch -Go to Docker Desktop - -Stop all containers - -Delete all dydxprotocold* containers - -Reset the protocol by doing the following: -``` -cd ../protocol -make reset-chain -``` - -Delete the postgres container. - -Restart the Kafka container. - -Clear all Kafka topics: -``` -docker cp remove-all-kafka-msgs.sh :/opt/kafka -docker exec -it /bin/bash -./remove-all-kafka-msgs.sh -``` - -Restart all containers: ``` -docker compose -f docker-compose-e2e-test.yml up +./reset-network.sh ``` diff --git a/e2e-testing/reset-network.sh b/e2e-testing/reset-network.sh new file mode 100755 index 0000000000..8486de1b38 --- /dev/null +++ b/e2e-testing/reset-network.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Quickest way to reset the network/clear all Indexer data sources without rebuilding from scratch + +echo "Stopping all Docker containers..." +docker stop $(docker ps -a | grep 'e2e-testing' | awk '{print $1}') + +echo "Deleting all dydxprotocold* containers..." +docker rm $(docker ps -a | grep dydxprotocold | awk '{print $1}') + +echo "Resetting the protocol..." +cd ../protocol +make reset-chain + +echo "Deleting the postgres container..." +docker rm $(docker ps -a | grep postgres | awk '{print $1}') + +echo "Restarting the Kafka container..." +KAFKA_CONTAINER=$(docker ps -a | grep 'e2e-testing' | grep 'kafka' | awk '{print $1}') +docker start $KAFKA_CONTAINER + +echo "Clearing all Kafka topics..." +cd ../e2e-testing +docker cp clear-all-kafa-topics.sh $KAFKA_CONTAINER:/opt/kafka +docker exec -it $KAFKA_CONTAINER /bin/bash -c "./clear-all-kafa-topics.sh" + +echo "Restarting all containers..." +docker-compose -f docker-compose-e2e-test.yml up -d