1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/libnetwork/test/integration/helpers.bash
Brian Goff 4b981436fe Fixup libnetwork lint errors
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-01 23:48:32 +00:00

49 lines
1.1 KiB
Bash

#!/bin/bash
# Root directory of the repository.
MACHINE_ROOT=/usr/bin
PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
ARCH="amd64"
else
ARCH="386"
fi
MACHINE_BIN_NAME=docker-machine_$PLATFORM-$ARCH
BATS_LOG=/tmp/bats.log
touch ${BATS_LOG}
rm ${BATS_LOG}
teardown() {
echo "$BATS_TEST_NAME
----------
$output
----------
" >> ${BATS_LOG}
}
EXTRA_ARGS_CFG='EXTRA_ARGS'
EXTRA_ARGS='--tlsverify --tlscacert=/var/lib/boot2docker/ca.pem --tlskey=/var/lib/boot2docker/server-key.pem --tlscert=/var/lib/boot2docker/server.pem --label=provider=virtualbox -H tcp://0.0.0.0:2376'
TMP_EXTRA_ARGS_FILE=/tmp/tmp_extra_args
DAEMON_CFG_FILE=${BATS_TEST_DIRNAME}/daemon.cfg
set_extra_config() {
if [ -f ${TMP_EXTRA_ARGS_FILE} ]; then
rm ${TMP_EXTRA_ARGS_FILE}
fi
echo -n "${EXTRA_ARGS_CFG}='" > ${TMP_EXTRA_ARGS_FILE}
echo -n "$1 " >> ${TMP_EXTRA_ARGS_FILE}
echo "${EXTRA_ARGS}'" >> ${TMP_EXTRA_ARGS_FILE}
}
if [ ! -e $MACHINE_ROOT/$MACHINE_BIN_NAME ]; then
echo "${MACHINE_ROOT}/${MACHINE_BIN_NAME} not found"
exit 1
fi
function machine() {
${MACHINE_ROOT}/$MACHINE_BIN_NAME "$@"
}