Skip to content

Commit 06c6a85

Browse files
committed
update test and skip others
1 parent aff1796 commit 06c6a85

2 files changed

Lines changed: 46 additions & 69 deletions

File tree

regression-test.bash

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ set -euo pipefail
44
echo "Running regression tests..."
55
cd "$(dirname "$0")"
66

7+
SKIP_TESTS=(
8+
batcher-e2e.bash
9+
batcher-resubmission.bash
10+
batcher-shutdown.bash
11+
batcher-with-malicious-sequencer.bash
12+
batcher-with-spam-in-hotshot.bash
13+
caff-node-batcher-addr-monitor.bash
14+
caff-node-restart.bash
15+
caff-node-state-check.bash
16+
)
17+
718
cd regression-tests
819
scripts=$(find . -maxdepth 1 -name '*.bash' \
920
! -name 'common.bash' \

regression-tests/caff-node-force-inclusion-test.bash

Lines changed: 35 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,20 @@
11
#!/usr/bin/env bash
22
# This is a utility function for creating assertions at the end of thie test.
33

4-
fail() {
5-
echo "$*" 1>&2; exit 1;
6-
}
7-
84
set -euo pipefail
9-
set -a # automatically export all variables
10-
set -x # print each command before executing it, for debugging
115

126
# CI is "true" in the CI
137
CI="${CI:-false}"
148

15-
# Output debug information on CI
9+
# Output debug information on CI or when DEBUG is set
1610
DEBUG="${DEBUG:-false}"
1711
if [ "$CI" = "true" ]; then
18-
set -x
1912
DEBUG=true
2013
fi
2114

22-
# Show the command we are running, then run it. Due to piping this spawns a
23-
# subshell so does not work for command like `cd` or `source`.
24-
function run {
25-
echo -e "\033[34m>>> $*\033[0m"
26-
"$@" 2>&1 | fmt
27-
}
28-
29-
function cd {
30-
emph "cd $*"
31-
builtin cd "$@"
32-
}
33-
34-
function emph {
35-
echo -e "\033[34m>>> $*\033[0m\n"
36-
}
15+
# Simple helpers
16+
info() { echo "# $*"; }
3717

38-
# Display only the last line of piped input, continuously updating
39-
function fmt {
40-
# Leave output unchanged in DEBUG mode
41-
if [ "$DEBUG" = "true" ]; then
42-
cat
43-
return
44-
fi
45-
# rewrite the last line to avoid noisy output
46-
while read -r line; do
47-
tput cr
48-
tput el
49-
echo "$line" | cut -c -"$(tput cols)" | tr -d '\r\n'
50-
done
51-
echo
52-
}
53-
54-
# Show something with a comment in front, to distinguish it from console output.
55-
function info {
56-
echo "# $@"
57-
}
5818

5919
# Remove log files on exit
6020
trap "exit" INT TERM
@@ -79,33 +39,33 @@ function cleanup {
7939
fi
8040
}
8141

82-
# Find directory of this script, the project, and the orbit-actions submodule
83-
TEST_DIR="$(dirname $(readlink -f $0))"
42+
TEST_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
8443
TESTNODE_LOG_FILE=$(mktemp -t nitro-test-node-logs-XXXXXXXX)
8544
ESPRESSO_DEVNODE_LOG_FILE=$(mktemp -t espresso-dev-node-logs-XXXXXXXX)
8645
TESTNODE_DIR="$(dirname "$TEST_DIR")"
8746
ENV_FILE="$TEST_DIR/.env"
8847
# Hide docker compose warnings about orphaned containers.
8948
export COMPOSE_IGNORE_ORPHANS=true
9049

91-
info Ensuring docker compose project is stopped
92-
run docker compose down -v --remove-orphans
50+
info "Ensuring docker compose project is stopped"
51+
docker compose down -v --remove-orphans
52+
53+
# source "$TESTNODE_DI R/common.bash"
54+
cd "$(dirname "$0")"
9355

9456
source ./common.bash
95-
info Deploying a Espresso Nitro stack with caff node also enabled
96-
emph ./test-node.bash --espresso $(get_espresso_image_flag) --caff-node --validate --tokenbridge --init-force --detach
57+
info "Deploying an Espresso Nitro stack with caff node enabled"
9758
if [ "$DEBUG" = "true" ]; then
98-
../test-node.bash --espresso $(get_espresso_image_flag) --caff-node --tokenbridge --init-force --detach
59+
"$TESTNODE_DIR/test-node.bash" --espresso $(get_espresso_image_flag) --caff-node --tokenbridge --init-force --detach
9960
else
10061
info "This command starts up an entire Nitro stack. It takes a long time."
10162
info "Run \`tail -f $TESTNODE_LOG_FILE\` to see logs, if necessary."
10263
echo
103-
../test-node.bash --espresso $(get_espresso_image_flag) --validate --tokenbridge --caff-node --init-force --detach > "$TESTNODE_LOG_FILE" 2>&1
64+
"$TESTNODE_DIR/test-node.bash" --espresso $(get_espresso_image_flag) --validate --tokenbridge --caff-node --init-force --detach > "$TESTNODE_LOG_FILE" 2>&1
10465
fi
10566

10667
# Start espresso sequencer node for the purposes of the test e.g. not needed for the real migration.
10768
info "Starting a local Espresso confirmation layer development node"
108-
emph docker compose up espresso-dev-node --detach
10969
if [ "$DEBUG" = "true" ]; then
11070
docker compose up espresso-dev-node --detach
11171
else
@@ -117,18 +77,15 @@ fi
11777

11878
info "Load environment variables in $ENV_FILE"
11979
# A similar env file should be supplied for whatever
120-
emph . "$TEST_DIR/.env"
121-
. "$TEST_DIR/.env"
80+
info "Sourcing $ENV_FILE"
81+
. "$ENV_FILE"
12282
echo
12383
info "Loaded env vars:"
12484
echo
12585
cat "$TEST_DIR/.env" | sed 's/^/ /'
12686
echo
12787

128-
function trim-last {
129-
tail -n 1 | tr -d '\r\n'
130-
131-
}
88+
trim-last() { tail -n 1 | tr -d '\r\n'; }
13289
function get-addr {
13390
local file="$1"
13491
local path="$2"
@@ -186,7 +143,7 @@ echo "DELAY_SECONDS: $DELAY_SECONDS"
186143
echo "FUTURE_SECONDS: $FUTURE_SECONDS"
187144

188145
# Now we stop the sequencer
189-
run docker stop nitro-testnode-sequencer-1
146+
docker stop nitro-testnode-sequencer-1 || true
190147

191148
USER_L1_PRIVATE_KEY="$(docker compose run scripts print-private-key --account funnel 2>/dev/null | trim-last)"
192149
# This is a private key used for testing, save to print
@@ -222,18 +179,27 @@ fi
222179
sleep 120
223180

224181

225-
has_force_inclusion_log() {
226-
local container_name="caff-node-1"
227-
local search_string="force inclusion is going to happen"
228-
if docker logs "$container_name" 2>&1 | grep -q "$search_string"; then
229-
return 1
230-
else
231-
return 0
232-
fi
233-
}
182+
# has_force_inclusion_log() {
183+
# local container_name="caff-node-1"
184+
# local search_string="force inclusion is going to happen"
185+
# if docker logs "$container_name" 2>&1 | grep -q "$search_string"; then
186+
# return 1
187+
# else
188+
# return 0
189+
# fi
190+
# }
191+
234192

193+
# if has_force_inclusion_log "caff-node-1" "force inclusion is going to happen"; then
194+
# echo "It printed force inclusion is going to happen log"
195+
# docker compose down --remove-orphans
196+
# exit 0
197+
# else
198+
# echo "Caff node did not print force inclusion log"
199+
# exit 1
200+
# fi
235201

236-
if has_force_inclusion_log "caff-node-1" "force inclusion is going to happen"; then
202+
if docker logs "caff-node-1" 2>&1 | grep -q "force inclusion is going to happen"; then
237203
echo "It printed force inclusion is going to happen log"
238204
docker compose down --remove-orphans
239205
exit 0

0 commit comments

Comments
 (0)