-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91fb3a3
commit f540396
Showing
9 changed files
with
285 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
APP_NAME=$1 | ||
TIMEOUT=${2:-60} # Default timeout is 60 seconds if not provided | ||
INTERVAL=5 | ||
__service=$1 | ||
|
||
while [ "${TIMEOUT}" -gt 0 ]; do | ||
STATUS=$(docker-compose ps --services --filter "status=running" | grep "${APP_NAME}") | ||
__containerID=$(docker-compose ps -q "${__service}") | ||
|
||
if [ -n "$STATUS" ]; then | ||
echo "$APP_NAME is running." | ||
exit 0 | ||
fi | ||
__initial_restart_count=$(docker inspect --format '{{ .RestartCount }}' "$__containerID") | ||
__is_running=$(docker inspect --format '{{ .State.Running }}' "$__containerID") | ||
sleep 10 | ||
__final_restart_count=$(docker inspect --format '{{ .RestartCount }}' "$__containerID") | ||
|
||
sleep "${INTERVAL}" | ||
TIMEOUT=$((TIMEOUT - INTERVAL)) | ||
done | ||
|
||
echo "Timed out waiting for $APP_NAME to start." | ||
exit 1 | ||
if [ "$__is_running" != "true" ] || [ "$__final_restart_count" -gt "$__initial_restart_count" ]; then | ||
echo "$__service is either not running or continuously restarting" | ||
docker-compose ps "${__service}" | ||
docker-compose logs "${__service}" | ||
exit 1 | ||
else | ||
echo "$__service is running" | ||
docker-compose ps "${__service}" | ||
exit 0 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
#!/usr/bin/env expect | ||
|
||
proc accept_default {} { | ||
global spawn_id | ||
send "\t\r" | ||
} | ||
|
||
proc yes {} { | ||
global spawn_id | ||
send "\r" | ||
} | ||
|
||
proc no {} { | ||
global spawn_id | ||
send "\t\r" | ||
} | ||
|
||
proc default-deployment {} { | ||
global spawn_id | ||
expect "Select Network" | ||
accept_default | ||
|
||
expect "Select deployment" | ||
accept_default | ||
|
||
expect "Select consensus" | ||
accept_default | ||
|
||
expect "Select execution" | ||
accept_default | ||
} | ||
|
||
proc all-defaults {} { | ||
global spawn_id | ||
default-deployment | ||
|
||
expect "Checkpoint Sync" | ||
yes | ||
|
||
expect "Configure checkpoint" | ||
accept_default | ||
|
||
expect "MEV Boost" | ||
yes | ||
|
||
expect "Configure MEV" | ||
accept_default | ||
|
||
expect "Grafana" | ||
yes | ||
|
||
expect "Configure rewards" | ||
accept_default | ||
|
||
expect "Configure Graffiti" | ||
accept_default | ||
|
||
expect EOF | ||
} | ||
|
||
proc no-checkpoint {} { | ||
global spawn_id | ||
default-deployment | ||
|
||
expect "Checkpoint Sync" | ||
no | ||
|
||
expect "MEV Boost" | ||
yes | ||
|
||
expect "Configure MEV" | ||
accept_default | ||
|
||
expect "Grafana" | ||
yes | ||
|
||
expect "Configure rewards" | ||
accept_default | ||
|
||
expect "Configure Graffiti" | ||
accept_default | ||
|
||
expect EOF | ||
} | ||
|
||
proc no-mev {} { | ||
global spawn_id | ||
default-deployment | ||
|
||
expect "Checkpoint Sync" | ||
yes | ||
|
||
expect "Configure checkpoint" | ||
accept_default | ||
|
||
expect "MEV Boost" | ||
no | ||
|
||
expect "Grafana" | ||
yes | ||
|
||
expect "Configure rewards" | ||
accept_default | ||
|
||
expect "Configure Graffiti" | ||
accept_default | ||
|
||
expect EOF | ||
} | ||
|
||
proc no-grafana {} { | ||
global spawn_id | ||
default-deployment | ||
|
||
expect "Checkpoint Sync" | ||
yes | ||
|
||
expect "Configure checkpoint" | ||
accept_default | ||
|
||
expect "MEV Boost" | ||
yes | ||
|
||
expect "Configure MEV" | ||
accept_default | ||
|
||
expect "Grafana" | ||
no | ||
|
||
expect "Configure rewards" | ||
accept_default | ||
|
||
expect "Configure Graffiti" | ||
accept_default | ||
|
||
expect EOF | ||
} | ||
|
||
set timeout 5 | ||
spawn ./ethd config | ||
|
||
# Check for the command-line argument | ||
if {$argc > 0} { | ||
set action [lindex $argv 0] | ||
switch -- $action { | ||
"all-defaults" all-defaults | ||
"no-checkpoint" no-checkpoint | ||
"no-mev" no-mev | ||
"no-grafana" no-grafana | ||
default { puts "Unknown action: $action"; exit 1 } | ||
} | ||
} else { | ||
puts "No specific test specified, using all-defaults" | ||
all-defaults | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Test ethd | ||
run-name: Test ethd | ||
|
||
on: | ||
push: | ||
pull_request: | ||
types: [opened, synchronize, labeled, unlabeled] | ||
branches: [main] | ||
|
||
jobs: | ||
test-ethd: | ||
if: | | ||
contains(github.event.pull_request.labels.*.name, 'test-ethd') || | ||
contains(github.event.pull_request.labels.*.name, 'test-all') || | ||
github.event_name == 'push' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Expect | ||
run: sudo apt-get install -y expect whiptail | ||
- name: Test ethd config defaults | ||
run: expect ./.github/test-ethd-config.exp all-defaults | ||
env: | ||
TERM: xterm | ||
- name: Test ethd config no checkpoint | ||
run: expect ./.github/test-ethd-config.exp no-checkpoint | ||
env: | ||
TERM: xterm | ||
- name: Test ethd config no mev | ||
run: expect ./.github/test-ethd-config.exp no-mev | ||
env: | ||
TERM: xterm | ||
- name: Test ethd config no grafana | ||
run: expect ./.github/test-ethd-config.exp no-grafana | ||
env: | ||
TERM: xterm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.