Skip to content

Commit

Permalink
[IND-551] create script for resetting the network in e2e test (#914)
Browse files Browse the repository at this point in the history
  • Loading branch information
dydxwill authored Jan 2, 2024
1 parent 19313c5 commit 3f5654d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
26 changes: 1 addition & 25 deletions e2e-testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <container_id>:/opt/kafka
docker exec -it <container_id> /bin/bash
./remove-all-kafka-msgs.sh
```

Restart all containers:
```
docker compose -f docker-compose-e2e-test.yml up
./reset-network.sh
```
28 changes: 28 additions & 0 deletions e2e-testing/reset-network.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3f5654d

Please sign in to comment.