test/connector/tcp/mysql/start
#!/bin/bash -ex
SECRETLESS_HOST=secretless
devmode=false
while getopts :d opt; do
case $opt in
d) SECRETLESS_HOST=secretless-dev; devmode=true;;
\?) echo "Unknown option -$OPTARG"; exit 1;;
esac
done
./stop
# ./ssl is REQUIRED during the build phase to make test ssl cert artifacts available to the docker context
# The ssl certs are stored in ROOT/test/util/ssl and need to be copied because they are shared
#
mkdir -p ssl
rm -rf ssl/*
cp -rf ../../../util/ssl/* ssl
docker compose build
report_dir="./test-coverage"
mkdir -p "$report_dir"
chmod 777 "$report_dir"
docker compose up -d mysql mysql_no_tls
./wait-for-mysql mysql_no_tls
./wait-for-mysql mysql
if [[ "$devmode" != true ]]; then
# Generate secretless.yml fixtures for automated tests. Not needed in dev mode
# since we use secretless.dev.yml instead of generating them on the fly.
docker compose run --rm test \
bash -c "go run ./test/util/testutil/cmd/generate_secretless_yml.go"
fi
# start secretless once mysql is running
docker compose up -d "$SECRETLESS_HOST"
./wait-for-secretless "$SECRETLESS_HOST"
# In dev mode, start the test container and leave it running
#
if [[ "$devmode" = true ]]; then
echo 'Starting test container in dev mode...'
docker compose up -d test
fi