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
Remove tables_prefix on db tests #15387
Conversation
what kind of confusion did you have with the prefix? 🤔 |
@sgiehl thank you for your time. To try explain my point of vision, take a look below. First I create the db test: mysql \
-h 127.0.0.1 \
-P 3306 \
-u root \
-p'root' \
-v <<-\EOSQL
CREATE DATABASE IF NOT EXISTS `matomo_test`;
GRANT ALL PRIVILEGES ON `matomo_test`.* TO 'matomo'@'%';
FLUSH PRIVILEGES;
EOSQL Second, I import data from db dev to my db test: mysqldump \
-h 127.0.0.1 \
-P 3306 \
-u matomo \
-p'matomo' \
matomo_dev | \
sed 's/matomodev_/matomotests_/' | \
mysql \
-h 127.0.0.1 \
-P 3306 \
-u matomo \
-p'matomo' \
matomo_test After that, need necessary configuration to db test: ./console development:enable
./console config:set \
'database_tests.host="127.0.0.1"' \
'database_tests.username="matomo"' \
'database_tests.password="matomo"' \
'database_tests.dbname="matomo_test"' \
'database_tests.tables_prefix="matomotests_"'
./console config:set \
'tests.http_host="127.0.0.1"' \
'tests.request_uri="/"' \
'tests.port="8080"' When run the unit test, I will get failures because is not empty the db prefix table: ./console tests:run \
--options='--stop-on-error' \
--testsuite unit [...]
15) Piwik\Tests\Unit\DataAccess\JoinGeneratorTest::test_generate_getJoinString_allTables
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'log_action AS log_action LEFT JOIN log_link_visit_action AS log_link_visit_action ON log_link_visit_action.idaction_url = log_action.idaction LEFT JOIN log_visit AS log_visit ON log_visit.idvisit = log_link_visit_action.idvisit LEFT JOIN log_conversion AS log_conversion ON log_conversion.idvisit = log_link_visit_action.idvisit LEFT JOIN log_conversion_item AS log_conversion_item ON log_conversion_item.idvisit = log_link_visit_action.idvisit AND `log_conversion_item`.deleted = 0'
+'matomotests_log_action AS log_action LEFT JOIN matomotests_log_link_visit_action AS log_link_visit_action ON log_link_visit_action.idaction_url = log_action.idaction LEFT JOIN matomotests_log_visit AS log_visit ON log_visit.idvisit = log_link_visit_action.idvisit LEFT JOIN matomotests_log_conversion AS log_conversion ON log_conversion.idvisit = log_link_visit_action.idvisit LEFT JOIN matomotests_log_conversion_item AS log_conversion_item ON log_conversion_item.idvisit = log_link_visit_action.idvisit AND `log_conversion_item`.deleted = 0'
/Users/brunowego/Workspace/github.com/matomo-org/matomo/tests/PHPUnit/Unit/DataAccess/LogQueryBuilder/JoinGeneratorTest.php:265
FAILURES!
Tests: 7007, Assertions: 11202, Failures: 15. |
Another point, is a exception when gtime -v php \
-d memory_limit=8G \
./console tests:run-ui --plugin Insights [Exception]
To generate OmniFixture for the UI tests, you must set an empty tables_prefix in [database_tests] |
Makes sense I reckon. I have actually mine set to empty tables prefix as well. I'll restart the tests and check that it won't break tests and then merge into 4.x |
Remove value of attribute
tables_prefix
indatabase_tests
to prevent confusion when running tests.