Skip to content

Commit

Permalink
mdc check for resolve-deps. Stop run-tests.sh if mdc fails.
Browse files Browse the repository at this point in the history
It's easy to forget `npm install` for a clean conlink checkout.  With
this change, mdc now fails if resolve-deps isn't found and prompts the
user with a possible resolution.

run-test.sh should also stop running tests if mdc fails.
  • Loading branch information
jonsmock committed Mar 20, 2024
1 parent a4f4857 commit c1720ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions mdc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ LS=$(which ls)
RESOLVE_DEPS="${RESOLVE_DEPS-./node_modules/@lonocloud/resolve-deps/resolve-deps.py}"
DOCKER_COMPOSE="${DOCKER_COMPOSE:-docker-compose}"

[ -f "${RESOLVE_DEPS}" ] || die "Missing ${RESOLVE_DEPS}. Perhaps 'npm install'?"
MODE_SPEC="${1}"; shift
if [ "${RESOLVE_DEPS}" ]; then
MODES="$(${RESOLVE_DEPS} "${MODES_DIR}" ${MODE_SPEC})"
Expand Down
7 changes: 4 additions & 3 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ declare FAIL=0
die() { echo >&2 "${*}"; exit 1; }
vecho() { [ "${VERBOSE}" ] && echo "${*}" || true; }
dc() { docker-compose "${@}"; }
mdc() { ./mdc "${@}" || die "mdc invocation failed"; }

dc_init() {
local cont="${1}" idx="${2}"
Expand Down Expand Up @@ -94,13 +95,13 @@ echo -e "\n\n>>> test4: multiple compose / mdc"
GROUP=test4
export MODES_DIR=./examples/test4-multiple/modes

./mdc node1
mdc node1
dc_init; dc_wait 10 r0_1 'ip addr | grep "10\.1\.0\.100"' \
|| die "test4 node1 startup failed"
echo " >> Ping the r0 router host from node1"
dc_test node1_1 ping -c1 10.0.0.100

./mdc node1,nodes2
mdc node1,nodes2
dc_init; dc_wait 10 node2_2 'ip addr | grep "10\.2\.0\.2"' \
|| die "test4 node1,nodes2 startup failed"
echo " >> From both node2 replicas, ping node1 across the r0 router"
Expand All @@ -110,7 +111,7 @@ echo " >> From node1, ping both node2 replicas across the r0 router"
dc_test node1 ping -c1 10.2.0.1
dc_test node1 ping -c1 10.2.0.2

./mdc all
mdc all
dc_init; dc exec -T r0 /scripts/wait.sh -t 10.0.0.100:80 \
|| die "test4 all startup failed"
echo " >> From node2, download from the web server in r0"
Expand Down

0 comments on commit c1720ce

Please sign in to comment.