Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions e2e-tests/auth/selfsigned/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ mkdir ./data

# Start new stack
docker compose pull
docker compose up -d
docker compose up --wait

waitForDCService node

go test -v --tags=e2e_tests .

Expand Down
4 changes: 1 addition & 3 deletions e2e-tests/nuts-network/direct-wan/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ docker compose rm -f -v
echo "------------------------------------"
echo "Starting Docker containers..."
echo "------------------------------------"
docker compose up -d
waitForDCService nodeA
waitForDCService nodeB
docker compose up --wait

echo "------------------------------------"
echo "Performing assertions..."
Expand Down
4 changes: 1 addition & 3 deletions e2e-tests/nuts-network/gossip-overflow/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ docker compose rm -f -v
echo "------------------------------------"
echo "Starting Docker containers..."
echo "------------------------------------"
docker compose up -d
waitForDCService nodeA
waitForDCService nodeB
docker compose up --wait

# Wait for Nuts Network nodes to build connections
sleep 1
Expand Down
6 changes: 1 addition & 5 deletions e2e-tests/nuts-network/gossip/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ docker compose rm -f -v
echo "------------------------------------"
echo "Starting Docker containers..."
echo "------------------------------------"
docker compose up -d
waitForDCService nodeA
waitForDCService nodeB
waitForDCService nodeC
waitForDCService nodeD
docker compose up --wait

# Wait for Nuts Network nodes to build connections
sleep 1
Expand Down
9 changes: 3 additions & 6 deletions e2e-tests/nuts-network/private-transactions/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ echo "------------------------------------"
echo "Starting Docker containers..."
echo "------------------------------------"

docker compose up -d

waitForDCService nodeA
waitForDCService nodeB
docker compose up --wait

# Wait for Nuts Network nodes to build connections
sleep 5
Expand All @@ -36,8 +33,8 @@ printf "NodeDID for node-a: %s\n" "$didNodeA"
# Restart nodeA now that it has >0 did documents with a NutsComm endpoint.
# This tricks the node into thinking it is not 'new' so it can bypass the service discovery delay for new nodes and immediately setup an authenticated connection.
# (nodeB will store this delay as a backoff for nodeA, so nodeA needs to discover and connect to nodeB after the restart)
docker compose restart nodeA
waitForDCService nodeA
docker compose stop nodeA
docker compose up --wait nodeA

# Wait for the transactions to be processed (will be the root transaction for both nodes)
sleep 5
Expand Down
5 changes: 1 addition & 4 deletions e2e-tests/nuts-network/private-transactions/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ function searchAuthCredentials() {
echo "------------------------------------"
echo "Starting Docker containers..."
echo "------------------------------------"
docker compose up -d

waitForDCService nodeA
waitForDCService nodeB
docker compose up --wait

# Wait for Nuts Network nodes to build connections
sleep 5
Expand Down
3 changes: 1 addition & 2 deletions e2e-tests/nuts-network/ssl-offloading/haproxy/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ echo "------------------------------------"
echo "Starting Docker containers..."
echo "------------------------------------"
docker compose up -d
waitForDCService nodeA-backend
waitForDCService nodeB
docker compose up --wait nodeA-backend nodeB

echo "------------------------------------"
echo "Performing assertions (nodes are connected)..."
Expand Down
3 changes: 1 addition & 2 deletions e2e-tests/nuts-network/ssl-offloading/nginx/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ echo "------------------------------------"
echo "Starting Docker containers..."
echo "------------------------------------"
docker compose up -d
waitForDCService nodeA-backend
waitForDCService nodeB
docker compose up --wait nodeA-backend nodeB

echo "------------------------------------"
echo "Performing assertions (nodes are connected)..."
Expand Down
3 changes: 1 addition & 2 deletions e2e-tests/nuts-network/ssl-pass-through/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ echo "------------------------------------"
echo "Starting Docker containers..."
echo "------------------------------------"
docker compose up -d
waitForDCService nodeA-backend
waitForDCService nodeB
docker compose up --wait nodeA-backend nodeB

echo "------------------------------------"
echo "Performing assertions (nodes are connected)..."
Expand Down
3 changes: 1 addition & 2 deletions e2e-tests/oauth-flow/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ echo "------------------------------------"
echo "Starting Docker containers..."
echo "------------------------------------"
docker compose up -d
waitForDCService nodeA-backend
waitForDCService nodeB
docker compose up --wait nodeA-backend nodeB

echo "------------------------------------"
echo "Registering vendors..."
Expand Down
5 changes: 1 addition & 4 deletions e2e-tests/openid4vci/issuer-initiated/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ mkdir ./node-A/data ./node-B/data # 'data' dirs will be created with root owner
echo "------------------------------------"
echo "Starting Docker containers..."
echo "------------------------------------"
docker compose up -d

waitForDCService nodeA
waitForDCService nodeB
docker compose up --wait

echo "------------------------------------"
echo "Creating NodeDIDs..."
Expand Down
4 changes: 1 addition & 3 deletions e2e-tests/ops/key-rotation/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ docker compose rm -f -v
echo "------------------------------------"
echo "Starting Docker containers..."
echo "------------------------------------"
docker compose up -d
waitForDCService nodeA
waitForDCService nodeB
docker compose up --wait

# Test description:
# Node A:
Expand Down
3 changes: 1 addition & 2 deletions e2e-tests/storage/backup-restore/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ mkdir -p ./node-data ./node-backup ./node-backup/vcr/ # 'data' dirs will be crea
echo "------------------------------------"
echo "Starting Docker containers..."
echo "------------------------------------"
docker compose up -d
waitForDCService nodeA
docker compose up --wait

echo "------------------------------------"
echo "Creating NodeDID..."
Expand Down
10 changes: 3 additions & 7 deletions e2e-tests/storage/backup-restore/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ source ../../util.sh
echo "------------------------------------"
echo "Starting Docker containers..."
echo "------------------------------------"
docker compose up -d

waitForDCService nodeA
docker compose up --wait

echo "------------------------------------"
echo "Issuing private VCs..."
Expand Down Expand Up @@ -40,17 +38,15 @@ mkdir ./node-data
removeNodeDID ./node-A/nuts.yaml
# Restart node, assert node data is empty
echo "Asserting node is empty"
BACKUP_INTERVAL=0 docker compose up -d
waitForDCService nodeA
BACKUP_INTERVAL=0 docker compose up --wait
assertDiagnostic "http://localhost:11323" "transaction_count: 0"
assertDiagnostic "http://localhost:11323" "credential_count: 0"
# Restore data and rebuild
echo "Restoring node data"
docker compose stop
runOnAlpine "$(pwd):/host/" rm -rf /host/node-data
runOnAlpine "$(pwd):/host/" mv -f /host/node-backup /host/node-data
BACKUP_INTERVAL=0 docker compose up -d
waitForDCService nodeA
BACKUP_INTERVAL=0 docker compose up --wait

echo "Rebuilding data"
docker compose exec nodeA nuts network reprocess "application/vc+json"
Expand Down
11 changes: 5 additions & 6 deletions e2e-tests/storage/redis/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ source ../../util.sh
echo "------------------------------------"
echo "Cleaning up running Docker containers and volumes, and key material..."
echo "------------------------------------"
docker compose down
docker compose stop
docker compose rm -f -v

echo "------------------------------------"
echo "Starting Docker containers..."
echo "------------------------------------"
docker compose up -d
waitForDCService nodeA
waitForDCService nodeB
docker compose up --wait nodeA nodeB

echo "------------------------------------"
echo "Creating root"
Expand Down Expand Up @@ -41,9 +40,9 @@ waitForTXCount "NodeB" "http://localhost:21323/status/diagnostics" 41 10
echo "------------------------------------"
echo "Restarting Docker containers..."
echo "------------------------------------"
docker compose restart nodeA nodeB redis
waitForDCService nodeA
waitForDCService nodeB
docker compose stop
docker compose up -d
docker compose up --wait nodeA nodeB

echo "----------------------------------------"
echo "Performing assertions after restart..."
Expand Down
27 changes: 1 addition & 26 deletions e2e-tests/util.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
#!/usr/bin/env bash

function waitForDCService {
SERVICE_NAME=$1
printf "Waiting for docker compose service '%s' to become healthy" $SERVICE_NAME
retry=0
healthy=0
while [ $retry -lt 30 ]; do
status=$(docker inspect -f {{.State.Health.Status}} $(docker compose ps -q $SERVICE_NAME))

if [[ "$status" == "healthy" ]]; then
healthy=1
break
fi

printf "."
sleep 0.5
retry=$[$retry+1]
done

if [ $healthy -eq 0 ]; then
echo "FAILED: Service took to long to start"
exitWithDockerLogs 1
fi
echo ""
}

function waitForTXCount {
SERVICE_NAME=$1
URL=$2
Expand Down Expand Up @@ -53,7 +28,7 @@ function waitForTXCount {
echo ""
}

# waitForDCService waits for a Nuts node's diagnostic to display a certain value for a given key
# waitForDiagnostic waits for a Nuts node's diagnostic to display a certain value for a given key
# Args: service name, key to check, expected value
function waitForDiagnostic {
SERVICE_NAME=$1
Expand Down