add a script to clean up test databases
Running the tests locally created a bunch of separate databases that were then left on the filesystem. This script finds those databases and removes them. Change-Id: Iecb8f2df039acd54dc9eaa7ef02be9af70a7b2b6 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
c9ac23bf9e
commit
0b50d5752e
24
tools/test-cleanup.sh
Executable file
24
tools/test-cleanup.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash -xe
|
||||||
|
|
||||||
|
# Remove any lingering storyboard_test_db_% databases.
|
||||||
|
|
||||||
|
DB_ROOT_PW=${MYSQL_ROOT_PW:-insecure_slave}
|
||||||
|
|
||||||
|
# The 'show databases' output looks like:
|
||||||
|
#
|
||||||
|
# +---------------------------------------------------------+
|
||||||
|
# | Database (storyboard_test_db_%) |
|
||||||
|
# +---------------------------------------------------------+
|
||||||
|
# | storyboard_test_db_03033b25_dd78_40c0_9b93_c1af5e3dc983 |
|
||||||
|
# | storyboard_test_db_0393fbbc_133d_46b3_8af1_e3b5aa40eb0f |
|
||||||
|
# | storyboard_test_db_07ec9cd9_7f30_4424_802a_a54e2d56bd41 |
|
||||||
|
# | storyboard_test_db_09442795_dfdf_4839_8572_f4e53bc152d9 |
|
||||||
|
# +---------------------------------------------------------+
|
||||||
|
#
|
||||||
|
# Build the list of databases, removing the table heading.
|
||||||
|
DATABASES=$(mysql -u root -e "show databases like 'storyboard_test_db_%';" |
|
||||||
|
grep storyboard_test_db | grep -v Database | cut -f1 -d\| )
|
||||||
|
|
||||||
|
for db in $DATABASES; do
|
||||||
|
mysql -u root -e "drop database $db;"
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user