-
Notifications
You must be signed in to change notification settings - Fork 13
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
Feature/integration tests config #5
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.1/phpunit.xsd" | ||
colors="true" | ||
columns="max" | ||
beStrictAboutTestsThatDoNotTestAnything="false" | ||
bootstrap="./dev/tests/integration/framework/bootstrap.php" | ||
stderr="true" | ||
testSuiteLoaderClass="Magento\TestFramework\SuiteLoader" | ||
testSuiteLoaderFile="framework/Magento/TestFramework/SuiteLoader.php" | ||
> | ||
<!-- Test suites definition --> | ||
<testsuites> | ||
<testsuite name="{{PROJECT_NAME}} Integration Tests"> | ||
<directory suffix="Test.php">../../../{{PROJECT_SOURCE_FOLDER}}</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<!-- PHP INI settings and constants definition --> | ||
<php> | ||
<includePath>.</includePath> | ||
<includePath>testsuite</includePath> | ||
<ini name="date.timezone" value="America/Los_Angeles"/> | ||
<ini name="xdebug.max_nesting_level" value="2000"/> | ||
<!-- Local XML configuration file ('.dist' extension will be added, if the specified file doesn't exist) --> | ||
<const name="TESTS_INSTALL_CONFIG_FILE" value="etc/install-config-mysql.php"/> | ||
<!-- Local XML configuration file ('.dist' extension will be added, if the specified file doesn't exist) --> | ||
<const name="TESTS_GLOBAL_CONFIG_FILE" value="etc/config-global.php"/> | ||
<!-- Semicolon-separated 'glob' patterns, that match global XML configuration files --> | ||
<const name="TESTS_GLOBAL_CONFIG_DIR" value="../../../app/etc"/> | ||
<!-- Whether to cleanup the application before running tests or not --> | ||
<const name="TESTS_CLEANUP" value="disabled"/> | ||
<!-- Memory usage and estimated leaks thresholds --> | ||
<!--<const name="TESTS_MEM_USAGE_LIMIT" value="1024M"/>--> | ||
<const name="TESTS_MEM_LEAK_LIMIT" value=""/> | ||
<!-- Path to Percona Toolkit bin directory --> | ||
<!--<const name="PERCONA_TOOLKIT_BIN_DIR" value=""/>--> | ||
<!-- CSV Profiler Output file --> | ||
<!--<const name="TESTS_PROFILER_FILE" value="profiler.csv"/>--> | ||
<!-- Bamboo compatible CSV Profiler Output file name --> | ||
<!--<const name="TESTS_BAMBOO_PROFILER_FILE" value="profiler.csv"/>--> | ||
<!-- Metrics for Bamboo Profiler Output in PHP file that returns array --> | ||
<!--<const name="TESTS_BAMBOO_PROFILER_METRICS_FILE" value="../../build/profiler_metrics.php"/>--> | ||
<!-- Whether to output all CLI commands executed by the bootstrap and tests --> | ||
<const name="TESTS_EXTRA_VERBOSE_LOG" value="1"/> | ||
<!-- Magento mode for tests execution. Possible values are "default", "developer" and "production". --> | ||
<const name="TESTS_MAGENTO_MODE" value="developer"/> | ||
<!-- Minimum error log level to listen for. Possible values: -1 ignore all errors, and level constants form http://tools.ietf.org/html/rfc5424 standard --> | ||
<const name="TESTS_ERROR_LOG_LISTENER_LEVEL" value="-1"/> | ||
<!-- Connection parameters for MongoDB library tests --> | ||
<!--<const name="MONGODB_CONNECTION_STRING" value="mongodb://localhost:27017"/>--> | ||
<!--<const name="MONGODB_DATABASE_NAME" value="magento_integration_tests"/>--> | ||
<!-- Connection parameters for RabbitMQ tests --> | ||
<!--<const name="RABBITMQ_MANAGEMENT_PORT" value="15672"/>--> | ||
<!--<const name="TESTS_PARALLEL_RUN" value="1"/>--> | ||
<const name="USE_OVERRIDE_CONFIG" value="enabled"/> | ||
</php> | ||
<!-- Test listeners --> | ||
<listeners> | ||
<listener class="Magento\TestFramework\Event\PhpUnit"/> | ||
<listener class="Magento\TestFramework\ErrorLog\Listener"/> | ||
</listeners> | ||
</phpunit> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
'🐿 - Integration Tests': | ||
stage: '🦄 - Unit-/Integration Tests' | ||
coverage: '/^\s*Lines:\s*\d+.\d+\%/' | ||
services: | ||
- name: mariadb:10.4 | ||
alias: db | ||
command: ["--innodb-buffer-pool-size=1024M --innodb-log-buffer-size=32M --max_allowed_packet=325058560"] | ||
- name: docker.elastic.co/elasticsearch/elasticsearch:7.6.2 | ||
alias: elasticsearch | ||
command: [ "bin/elasticsearch", "-Expack.security.enabled=false", "-Ediscovery.type=single-node" ] | ||
extends: .composer_cache_pull | ||
needs: ["📦 - Preparation"] | ||
variables: | ||
PHP_BIN: ${PHP_BIN:=php} | ||
|
||
# db config for tests-integration and artifact | ||
MYSQL_ROOT_PASSWORD: root | ||
APP_DB_HOST: db | ||
APP_DB_USER: root | ||
APP_DB_PASS: $MYSQL_ROOT_PASSWORD | ||
APP_DB_NAME: db01 | ||
|
||
# elasticsearch config | ||
ELASTICSEARCH_HOST: elasticsearch | ||
ELASTICSEARCH_PORT: 9200 | ||
|
||
# mysql config for integration tests | ||
INSTALL_CONFIG_MYSQL: > | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this and point the Var to the default Magento path. We have to check in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To set the ENVIRONMENT Variables, you can work with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace only on lines matching the line pattern: |
||
<?php | ||
|
||
return [ | ||
'db-host' => '${APP_DB_HOST}', | ||
'db-user' => '${APP_DB_USER}', | ||
'db-password' => '${APP_DB_PASS}', | ||
'db-name' => '${APP_DB_NAME}', | ||
'db-prefix' => '', | ||
'backend-frontname' => 'backend', | ||
'admin-user' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, | ||
'admin-password' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD, | ||
'admin-email' => \Magento\TestFramework\Bootstrap::ADMIN_EMAIL, | ||
'admin-firstname' => \Magento\TestFramework\Bootstrap::ADMIN_FIRSTNAME, | ||
'admin-lastname' => \Magento\TestFramework\Bootstrap::ADMIN_LASTNAME, | ||
'elasticsearch-host' => '${ELASTICSEARCH_HOST}', | ||
'elasticsearch-port' => '${ELASTICSEARCH_PORT}', | ||
]; | ||
|
||
|
||
script: | ||
- set -e | ||
- docker-php-ext-enable xdebug | ||
# composer | ||
- $COMPOSER_BIN install --prefer-dist | ||
# prepare dbs | ||
- mysqladmin --host=$APP_DB_HOST --user=$APP_DB_USER --password=$APP_DB_PASS create $APP_DB_NAME | ||
# do installation | ||
- echo "---------- MAGENTO CLI CHECK ----------" | ||
- ${PHP_BIN} bin/magento | ||
- echo "---------- MAGENTO SETUP:INSTALL ----------" | ||
## install magento, using 'yes' to answer all interaction questions (yes |) and ignoring all warnings that could occur while installation ( || true) | ||
- yes | ${PHP_BIN} bin/magento setup:install --db-host=${APP_DB_HOST} --db-name=${APP_DB_NAME} --db-password=${APP_DB_PASS} --db-user=${APP_DB_USER} --search-engine="elasticsearch7" --elasticsearch-host=${ELASTICSEARCH_HOST} --elasticsearch-port=${ELASTICSEARCH_PORT} [email protected] --admin-firstname=Admin --admin-lastname=Admin --admin-password=admin123 --admin-user=admin --backend-frontname=admin --base-url=http://build.run-as-root.test --currency=EUR --language=en_US --session-save=files --timezone=Europe/Berlin --use-rewrites=1 -vvv || true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please also use redis caching here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rename the |
||
- echo "---------- MAGENTO SETUP:UPGRADE ----------" | ||
- ${PHP_BIN} bin/magento setup:upgrade | ||
# configure tests | ||
- echo "---------- INTEGRATION TESTS CONFIG ----------" | ||
- rm -f dev/tests/integration/etc/install-config-mysql.php | ||
- mkdir -p dev/tests/integration/etc/ && echo $INSTALL_CONFIG_MYSQL > dev/tests/integration/etc/install-config-mysql.php | ||
- cat dev/tests/integration/etc/install-config-mysql.php | ||
- cp dev/tests/integration/etc/config-global.php.dist dev/tests/integration/etc/config-global.php | ||
# run tests | ||
- echo "---------- INTEGRATION TESTS PHPUNIT ----------" | ||
- ${PHP_BIN} vendor/bin/phpunit -c phpunit-integration.xml --no-coverage --colors=never --disable-coverage-ignore | ||
artifacts: | ||
paths: | ||
- build/output/ | ||
expire_in: 2 days |
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.
Research if this can be dynamic