-
Notifications
You must be signed in to change notification settings - Fork 240
/
test-run-mysql
executable file
·35 lines (31 loc) · 1.03 KB
/
test-run-mysql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
start-test() {
local ip=$(cat $TEST_DIR/databases/*/metadata/ip)
local port=$(cat $TEST_DIR/databases/*/metadata/port)
local pass=$(cat $TEST_DIR/databases/*/metadata/password)
local image=$(cat $TEST_DIR/databases/*/metadata/image)
DB_CONNECTION_TEST="
docker run --rm
--name connection-test
$image
mysql
--host=$ip
--port=$port
--user=root
--password=$pass
--execute=status" \
timeout --foreground 1m bash -c "wait-for-db-connection"
KINE_IMAGE=$IMAGE KINE_ENDPOINT="mysql://root:$pass@tcp($ip:$port)/kine" provision-kine
local kine_url=$(cat $TEST_DIR/kine/*/metadata/url)
K3S_DATASTORE_ENDPOINT=$kine_url provision-cluster
}
export -f start-test
VERSION_LIST="\
mysql 8.0
mysql 5.7
mariadb 10.11
mariadb 10.5
mariadb 10.4"
while read ENGINE VERSION; do
LABEL=$ENGINE-$VERSION DB_PASSWORD_ENV=MYSQL_ROOT_PASSWORD DB_IMAGE=docker.io/library/$ENGINE:$VERSION run-test
done <<< $VERSION_LIST