Skip to content

Commit

Permalink
Allow running zebrad in test mode
Browse files Browse the repository at this point in the history
  • Loading branch information
upbqdn committed Oct 11, 2024
1 parent 38837e4 commit 2ada296
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ ARG EXPERIMENTAL_FEATURES="journald prometheus filter-reload"
ENV ENTRYPOINT_FEATURES_EXPERIMENTAL="${ENTRYPOINT_FEATURES} ${EXPERIMENTAL_FEATURES}"

# Run tests specified by the env vars
ENTRYPOINT [ "entrypoint.sh", "tests" ]
ENTRYPOINT [ "entrypoint.sh", "test" ]

# In this stage we build a release (generate the zebrad binary)
#
Expand Down
13 changes: 11 additions & 2 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ run_cargo_test() {
}

# Runs tests depending on the env vars.
#
# Positional Parameters
#
# - $@: Arbitrary command that will be executed if no test env var is set.
run_tests() {
# Validate the test variables. For these tests, we activate the test features
# to avoid recompiling `zebrad`, but we don't actually run any gRPC tests.
Expand Down Expand Up @@ -325,6 +329,8 @@ run_tests() {
check_directory_files "${ZEBRA_CACHED_STATE_DIR}"
exec cargo test --locked --release --features "zebra-test" --package zebra-scan \
-- --nocapture --include-ignored scan_task_commands
else
exec "$@"
fi
}

Expand Down Expand Up @@ -356,9 +362,12 @@ case "$1" in
exec zebrad "$@"
fi
;;
tests)
test)
shift

prepare_env_vars
run_tests

run_tests "$@"
;;
monitoring)
# TODO: Impl logic for starting a monitoring node.
Expand Down

0 comments on commit 2ada296

Please sign in to comment.