mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-19 19:01:42 +00:00
39 lines
1.0 KiB
Bash
39 lines
1.0 KiB
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
SCRIPT_DIR=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
|
|
CASE=$(mktemp -d)
|
|
trap 'rm -rf "${CASE}"' EXIT
|
|
|
|
source_time_handoff="${CASE}/source-time"
|
|
configured_handoff="${CASE}/configured"
|
|
mkdir -p "${configured_handoff}"
|
|
touch "${configured_handoff}/bootstrap.env"
|
|
printf 'RDS_HANDOFF_DIR=%s\n' "${configured_handoff}" >"${CASE}/agent.env"
|
|
|
|
# Simulate OpenRC sourcing the service before start_pre loads agent.env.
|
|
export RDS_HANDOFF_DIR="${source_time_handoff}"
|
|
# shellcheck source=rds-agent.initd
|
|
. "${SCRIPT_DIR}/rds-agent.initd"
|
|
export AGENT_ENV="${CASE}/agent.env"
|
|
export handoff_timeout=0
|
|
|
|
EEND_STATUS=
|
|
ebegin() { :; }
|
|
einfo() { :; }
|
|
eend() { EEND_STATUS=$1; }
|
|
|
|
start_pre
|
|
start_post
|
|
|
|
if [ "${HANDOFF_ENV}" != "${configured_handoff}/bootstrap.env" ]; then
|
|
echo "FAIL: handoff path did not use RDS_HANDOFF_DIR from agent.env" >&2
|
|
exit 1
|
|
fi
|
|
if [ "${EEND_STATUS}" != "0" ]; then
|
|
echo "FAIL: post-start wait did not find the configured handoff" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "rds-agent.initd: all tests passed"
|