From 5191583f0b3e38fb93a4556e5616b66d1eb5e29f Mon Sep 17 00:00:00 2001 From: Daniel Alves + Diego Araújo Date: Mon, 25 Feb 2013 18:05:37 -0300 Subject: [PATCH] [Mezuro] Creating mysql script for deleting datase entries. --- features/support/hooks.rb | 4 ++++ plugins/mezuro/script/delete_all_kalibro_entries.sh | 16 ++++++++++++++++ plugins/mezuro/script/run_acceptance_tests.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ plugins/mezuro/test/run_acceptance_tests.sh | 42 ------------------------------------------ 4 files changed, 62 insertions(+), 42 deletions(-) create mode 100644 features/support/hooks.rb create mode 100755 plugins/mezuro/script/delete_all_kalibro_entries.sh create mode 100755 plugins/mezuro/script/run_acceptance_tests.sh delete mode 100755 plugins/mezuro/test/run_acceptance_tests.sh diff --git a/features/support/hooks.rb b/features/support/hooks.rb new file mode 100644 index 0000000..817de4e --- /dev/null +++ b/features/support/hooks.rb @@ -0,0 +1,4 @@ +After ('@kalibro_restart') do + command = "#{RAILS_ROOT}/plugins/mezuro/script/delete_all_kalibro_entries.sh" + system command +end diff --git a/plugins/mezuro/script/delete_all_kalibro_entries.sh b/plugins/mezuro/script/delete_all_kalibro_entries.sh new file mode 100755 index 0000000..b5b7e5a --- /dev/null +++ b/plugins/mezuro/script/delete_all_kalibro_entries.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +DATABASE="kalibro_tests" +USER="kalibro" +PASSWORD="kalibro" +MYSQL_PARAMS="$DATABASE -u $USER -p$PASSWORD" +TABLES=($(mysql $MYSQL_PARAMS -e "show tables")) +LENGTH=${#TABLES} + +i=1 +while [ $i -le $LENGTH ] + do if [ ${#TABLES[$i]} -ne 0 ] + then mysql --force $MYSQL_PARAMS -e "delete from $DATABASE.${TABLES[$i]}" + fi + i=$(($i+1)) +done diff --git a/plugins/mezuro/script/run_acceptance_tests.sh b/plugins/mezuro/script/run_acceptance_tests.sh new file mode 100755 index 0000000..5a929d0 --- /dev/null +++ b/plugins/mezuro/script/run_acceptance_tests.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +TEST_FILE=$1 +PROFILE=$2 + +if [ -z "$PROFILE" ]; then + PROFILE='default' +fi + +# where are your .kalibro dir? +KALIBRO_HOME='/usr/share/tomcat6/.kalibro' + +# create a kalibro test dir +echo "--> Creating tests directory" +sudo mkdir $KALIBRO_HOME/tests +echo "--> Copying test settings" +sudo cp $KALIBRO_HOME/kalibro_tests.settings $KALIBRO_HOME/tests/kalibro.settings +echo "--> Changing owner of tests directory to tomcat6" +sudo chown -R tomcat6:tomcat6 $KALIBRO_HOME/tests + +# you must restart tomcat6 +#if you are using a tomcat installed from apt-get, for example: +sudo service tomcat6 restart + +#if you are using a tomcat installed a specific dir, for exemple: +#~/tomcat6/bin/shoutdown.sh +#~/tomcat6/bin/startup.sh + +# run test +cucumber $TEST_FILE -p $PROFILE + +#back to normal mode +echo "--> Removing tests directory" +sudo rm -rf $KALIBRO_HOME/tests + +# you must restart tomcat6 again +sudo service tomcat6 restart + +#or some thing like that... +#~/tomcat6/bin/shoutdown.sh +#~/tomcat6/bin/startup.sh + diff --git a/plugins/mezuro/test/run_acceptance_tests.sh b/plugins/mezuro/test/run_acceptance_tests.sh deleted file mode 100755 index 5a929d0..0000000 --- a/plugins/mezuro/test/run_acceptance_tests.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -TEST_FILE=$1 -PROFILE=$2 - -if [ -z "$PROFILE" ]; then - PROFILE='default' -fi - -# where are your .kalibro dir? -KALIBRO_HOME='/usr/share/tomcat6/.kalibro' - -# create a kalibro test dir -echo "--> Creating tests directory" -sudo mkdir $KALIBRO_HOME/tests -echo "--> Copying test settings" -sudo cp $KALIBRO_HOME/kalibro_tests.settings $KALIBRO_HOME/tests/kalibro.settings -echo "--> Changing owner of tests directory to tomcat6" -sudo chown -R tomcat6:tomcat6 $KALIBRO_HOME/tests - -# you must restart tomcat6 -#if you are using a tomcat installed from apt-get, for example: -sudo service tomcat6 restart - -#if you are using a tomcat installed a specific dir, for exemple: -#~/tomcat6/bin/shoutdown.sh -#~/tomcat6/bin/startup.sh - -# run test -cucumber $TEST_FILE -p $PROFILE - -#back to normal mode -echo "--> Removing tests directory" -sudo rm -rf $KALIBRO_HOME/tests - -# you must restart tomcat6 again -sudo service tomcat6 restart - -#or some thing like that... -#~/tomcat6/bin/shoutdown.sh -#~/tomcat6/bin/startup.sh - -- libgit2 0.21.2