| # Builds binaries, starts up services, waits a few seconds, then checks that the |
| # store browser responds with valid data. |
| readonly THIS_SCRIPT="$0" |
| readonly WORK_DIR=$(mktemp -d) |
| trap onexit INT TERM EXIT |
| [[ $# -gt 0 ]] && echo "${THIS_SCRIPT} $*" |
| make build || fail "line ${LINENO}: failed to build" |
| ./run.sh >/dev/null 2>&1 & |
| sleep 5 # Wait for services to warm up. |
| URL="http://localhost:5000" |
| FILE="${WORK_DIR}/index.html" |
| curl 2>/dev/null "${URL}" -o "${FILE}" || fail "line ${LINENO}: failed to fetch ${URL}" |
| if grep -q moviesbox "${FILE}"; then |
| fail "line ${LINENO}: fetched page does not meet expectations" |