Skip to content
This repository has been archived by the owner on Feb 4, 2019. It is now read-only.

Commit

Permalink
acceptance test changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Auris committed Sep 14, 2016
1 parent 12a7c82 commit ee7b290
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 48 deletions.
3 changes: 2 additions & 1 deletion codeception.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
actor: Tester

include:
- vendor/spryker/spryker/Bundles/*
- tests/*


paths:
tests: tests
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Project",
"license": "MIT",
"require": {
"spryker/spryker": "dev-master",
"spryker/spryker": "dev-testing_enviroment",
"php": "~5.6.0",
"braintree/braintree_php": "~3.15.0",
"guzzlehttp/guzzle": "~6.2.1",
Expand Down
25 changes: 18 additions & 7 deletions deploy/setup/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,31 @@ function restoreDevelopmentDatabase {
read -r -p "Restore database ${DATABASE_NAME} ? [y/N] " response
case $response in
[yY][eE][sS]|[yY])
export PGPASSWORD=$DATABASE_PASSWORD
export LC_ALL="en_US.UTF-8"

sudo pg_ctlcluster 9.4 main restart --force
sudo dropdb $DATABASE_NAME
sudo createdb $DATABASE_NAME
pg_restore -i -h 127.0.0.1 -p 5432 -U $DATABASE_USER -d $DATABASE_NAME -v $DATABASE_NAME.backup
dropAndRestoreDatabase
;;
*)
echo "Nothing done."
;;
esac
}

function dropAndRestoreDatabase {

if [[ -z "$1" ]]; then
DATABASE_BACKUP_PATH=$DATABASE_NAME.backup;
else
DATABASE_BACKUP_PATH=$1
fi

export PGPASSWORD=$DATABASE_PASSWORD
export LC_ALL="en_US.UTF-8"

sudo pg_ctlcluster 9.4 main restart --force
sudo dropdb $DATABASE_NAME
sudo createdb $DATABASE_NAME
pg_restore -i -h 127.0.0.1 -p 5432 -U $DATABASE_USER -d $DATABASE_NAME -v $DATABASE_BACKUP_PATH

}
function installDemoshop {
labelText "Preparing to install Spryker Platform..."

Expand Down
2 changes: 1 addition & 1 deletion setup
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ do
installZed
;;
"--reset" | "-r" )
resetDevelopmentState
resetDevelopmentState ø
;;
"--dump-db" | "-ddb" )
dumpDevelopmentDatabase
Expand Down
71 changes: 33 additions & 38 deletions setup_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,63 @@

set -o pipefail


SETUP='spryker'
DATABASE_NAME='DE_test_zed'
DATABASE_USER='development'
DATABASE_PASSWORD='mate20mg'
VERBOSITY='-v'
CONSOLE=vendor/bin/console
PHANTOMJS_CDNURL='https://github.com/Medium/phantomjs/'
DATABASE_BACKUP_PATH='data/test.backup'

export APPLICATION_ENV='test'

. deploy/setup/functions.sh

warningText "This script should be used only in development and NEVER IN PRODUCTION"


function installTestingEnv {

# zed
labelText "Flushing Elasticsearch de_search_test"
curl -XDELETE 'http://localhost:10005/de_search_test/'
writeErrorMessage "Elasticsearch reset failed"

labelText "Flushing Redis db 3"
echo -e "select 3\nflushdb" | redis-cli -p 10009
writeErrorMessage "Redis reset failed"
function backupTestingEnvData {

dropDevelopmentDatabase

labelText "Running setup:install"
$CONSOLE setup:install $VERBOSITY
writeErrorMessage "Setup install failed"

labelText "Running propel code generation/migrations"
$CONSOLE propel:install $VERBOSITY
$CONSOLE propel:diff $VERBOSITY
$CONSOLE propel:migrate $VERBOSITY

labelText "Importing Demo data"
$CONSOLE import:demo-data $VERBOSITY
writeErrorMessage "DemoData import failed"

labelText "Initializing DB"
$CONSOLE setup:init-db $VERBOSITY
writeErrorMessage "DB setup failed"

labelText "Setting up data stores"
$CONSOLE collector:search:export $VERBOSITY
$CONSOLE collector:storage:export $VERBOSITY
writeErrorMessage "DataStore setup failed"


# backup
dumpDevelopmentDatabase "data/test.backup"

labelText "Backup redis to data/test.backup"
echo -e "select 3\nsave" | redis-cli -p 10009
runCollectors

labelText "Backup elastic search"
curl -XPUT http://localhost:10005/_snapshot/test -d '{"type":"fs","settings":{"location":"test","compress":true}}'
curl -XPUT http://localhost:10005/_snapshot/test/de_search_test -d '{"indicies":"de_search_test"}'
dumpDevelopmentDatabase $DATABASE_BACKUP_PATH

#---
successText "Backup successful."
}

#antelopeInstallZed
function restoreTestingEnvData {

sleep 1
dropAndRestoreDatabase $DATABASE_BACKUP_PATH
}

# yves
#installYves
function runCollectors() {

configureCodeception
export PGPASSWORD=$DATABASE_PASSWORD
labelText "Reset touch table."
psql -h 127.0.0.1 -U $DATABASE_USER -d $DATABASE_NAME -c 'UPDATE spy_touch set touched=now()' -w

successText "Setup successful"
infoText "\nYves URL: http://www.de.spryker.dev/\nZed URL: http://zed.de.spryker.dev/\n"
labelText "Run collectors."
$CONSOLE collector:search:export $VERBOSITY
$CONSOLE collector:storage:export $VERBOSITY
}

if [ $# -eq 0 ]; then
Expand All @@ -81,9 +70,17 @@ for arg in "$@"
do
case $arg in

"--test" | "-t" )
installTestingEnv
"--restore" | "-r" )
restoreTestingEnvData
;;

"--backup" | "-b" )
backupTestingEnvData
;;
"--collectors" | "-c" )
runCollectors
;;

*)
displayHeader
echo ""
Expand All @@ -94,6 +91,4 @@ do
done




exit 0

0 comments on commit ee7b290

Please sign in to comment.