-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathverify.sh
executable file
·37 lines (26 loc) · 977 Bytes
/
verify.sh
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
35
36
37
#!/bin/bash -e
export NAME=mysql
export PORT_ADMIN="${MYSQL_PORT_ADMIN:-11300}"
# shellcheck source=verify-common.sh
. "$(dirname "${BASH_SOURCE[0]}")/../verify-common.sh"
_mysql () {
local mysql_client
mysql_client=(docker run --rm --network mysql_default mysql:latest mysql -h proxy -P 1999 -u root)
"${mysql_client[@]}" "${@}"
}
export -f _mysql
wait_for 40 bash -c "_mysql -e 'SHOW DATABASES;'"
run_log "Create a mysql database"
_mysql -e "CREATE DATABASE test;"
_mysql -e "show databases;" | grep test
run_log "Create a mysql table"
_mysql -e "USE test; CREATE TABLE test ( text VARCHAR(255) ); INSERT INTO test VALUES ('hello, world!');"
_mysql -e "SELECT COUNT(*) from test.test;" | grep 1
run_log "Check mysql egress stats"
responds_with \
egress_mysql \
"http://localhost:${PORT_ADMIN}/stats?filter=egress_mysql"
run_log "Check mysql TCP stats"
responds_with \
mysql_tcp \
"http://localhost:${PORT_ADMIN}/stats?filter=mysql_tcp"