Skip to content

Commit

Permalink
Updates on tools for test suites
Browse files Browse the repository at this point in the history
  • Loading branch information
jmrenouard committed Sep 30, 2019
1 parent f792052 commit 3fd2e1c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
21 changes: 21 additions & 0 deletions build/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,27 @@ gen_mysqlalias()
done < "$input"
}

exec_mysql()
{
input="$1"
name=$2
db=$3
sqlfile=$4
while IFS='' read -r line
do
[ -z "$line" ] && continue
echo "$line" | grep -q $name
[ $? -ne 0 ] && continue
container_port=$(echo "$line" | cut -d\; -f1)
container_name=$(echo "$line" | cut -d\; -f2)
container_datadir=$(echo "$line" | cut -d\; -f3)
image_name=$(echo "$line" | cut -d\; -f4)


echo "* Executing $sqlfile on $container_name"
cat $sqlfile | mysql -u root -h 127.0.0.1 -P $container_port
done < "$input"
}
exec_mysqls()
{
input="$1"
Expand Down
7 changes: 3 additions & 4 deletions build/createMassDockerImages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ do
docker ps -a | grep -qE "$container_name^"
docker rm -f $container_name

if [ 1 -eq 0 ]; then
echo "* DELETING DATADIR: $container_datadir"
sudo rm -rf $container_datadir
[ "$1" = "clean" ] && continue

echo "* CREATING DATADIR: $container_datadir"
sudo mkdir $container_datadir
sudo mkdir -p $container_datadir
fi
#sudo chown -R mysql.mysql $container_datadir
sudo chmod 777 $container_datadir
echo "* STARTING CONTAINER: $container_name($container_port/TCP) BASED ON $image_name -> $container_datadir"
Expand All @@ -72,11 +74,8 @@ do
ls -ls $container_datadir
#break
docker logs $container_name | grep -q "ready for connections"
alias mysql_$container_name="mysql -u root -P $container_port"
done < "$input"

[ "$1" = "clean" ] || docker system prune -a -f

echo "* LISTING DOCKER IMAGES"
docker images

Expand Down

0 comments on commit 3fd2e1c

Please sign in to comment.