-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script to setup integration tests #293
Script to setup integration tests #293
Conversation
b1ed58d
to
62010da
Compare
compose/bin/setup-integration-tests
Outdated
REAL_SRC=$(cd -P "src" && pwd) | ||
MYSQL_CONFIG=dev/tests/integration/etc/install-config-mysql.php | ||
INTEGRATION_DB=magento_integration_tests | ||
CREATE_DB="bin/clinotty mysqladmin -hdb -uroot -p${MYSQL_ROOT_PASSWORD} create ${INTEGRATION_DB}" && echo "Database ${INTEGRATION_DB} created." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find cleaner way to handle exit code from command run on a container. Suggestions are welcome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would this line be better?
CREATE_DB="bin/clinotty mysqladmin -hdb -uroot -p${MYSQL_ROOT_PASSWORD} create ${INTEGRATION_DB}" || exit
compose/bin/setup-integration-tests
Outdated
CREATE_DB="bin/clinotty mysqladmin -hdb -uroot -p${MYSQL_ROOT_PASSWORD} create ${INTEGRATION_DB}" && echo "Database ${INTEGRATION_DB} created." | ||
bin/clinotty mysql -hdb -uroot -p${MYSQL_ROOT_PASSWORD} ${INTEGRATION_DB} -e exit &> /dev/null || $CREATE_DB | ||
|
||
sed -e "s/'db-host' => 'localhost'/'db-host' => 'db'/" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we ok with using root user or do we want to create a separate user?
We could put credentials in env/db.env
if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think root
user is fine, as most of these scripts are meant for development. However, I think putting creds in env/db.env
are the right way to go:
...
MYSQL_INTEGRATION_ROOT_PASSWORD=magento
MYSQL_INTEGRATION_DATABASE=magento_integration
MYSQL_INTEGRATION_USER=magento
MYSQL_INTEGRATION_PASSWORD=magento
etc
Note renaming INTEGRATION_DB
to MYSQL_INTEGRATION_DATABASE
and moving that into the env.db file. I'd also keep all the users/creds/etc magento
for simplicity sake.
compose/bin/setup-integration-tests
Outdated
src/dev/tests/integration/etc/install-config-mysql.php.dist > src/dev/tests/integration/etc/install-config-mysql.php | ||
|
||
# Workaround until coping nested files works as expected | ||
docker cp $REAL_SRC/$MYSQL_CONFIG $(docker-compose ps -q phpfpm|awk '{print $1}'):/var/www/html/$MYSQL_CONFIG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified after #295 is merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#295 has been merged
compose/bin/setup-integration-tests
Outdated
REAL_SRC=$(cd -P "src" && pwd) | ||
MYSQL_CONFIG=dev/tests/integration/etc/install-config-mysql.php | ||
INTEGRATION_DB=magento_integration_tests | ||
CREATE_DB="bin/clinotty mysqladmin -hdb -uroot -p${MYSQL_ROOT_PASSWORD} create ${INTEGRATION_DB}" && echo "Database ${INTEGRATION_DB} created." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would this line be better?
CREATE_DB="bin/clinotty mysqladmin -hdb -uroot -p${MYSQL_ROOT_PASSWORD} create ${INTEGRATION_DB}" || exit
compose/bin/setup-integration-tests
Outdated
CREATE_DB="bin/clinotty mysqladmin -hdb -uroot -p${MYSQL_ROOT_PASSWORD} create ${INTEGRATION_DB}" && echo "Database ${INTEGRATION_DB} created." | ||
bin/clinotty mysql -hdb -uroot -p${MYSQL_ROOT_PASSWORD} ${INTEGRATION_DB} -e exit &> /dev/null || $CREATE_DB | ||
|
||
sed -e "s/'db-host' => 'localhost'/'db-host' => 'db'/" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think root
user is fine, as most of these scripts are meant for development. However, I think putting creds in env/db.env
are the right way to go:
...
MYSQL_INTEGRATION_ROOT_PASSWORD=magento
MYSQL_INTEGRATION_DATABASE=magento_integration
MYSQL_INTEGRATION_USER=magento
MYSQL_INTEGRATION_PASSWORD=magento
etc
Note renaming INTEGRATION_DB
to MYSQL_INTEGRATION_DATABASE
and moving that into the env.db file. I'd also keep all the users/creds/etc magento
for simplicity sake.
Update command to handle db creation and permissions
62010da
to
db0bb72
Compare
@markshust it should be ready for another round. Credentials are used from env/db.env. If everything goes as expected you should be able to run
|
@piotrkwiecinski I merged in because there aren't any breaking updates here, but I got this error when running it:
|
Later in the error I also see this...
|
@markshust tasklist exec should be resolved by: 1b71f7f but I'm not sure if you update an image after that change was merged. I'll have a look a the amqp tomorrow or on saturday. That branch is a bit old :). |
Ah thanks -- I'll test with the new image build |
Just for reference, here's output with the new PHP image:
|
Script to setup env for integration tests
It creates a integration database and generates
install-config-mysql.php
based on the .dist version.