borkweb / products-test-automation

Other
3 stars 0 forks source link

Using tric in event-tickets #69

Open Luc45 opened 4 years ago

Luc45 commented 4 years ago

(tl;dr This is partially solved, check the next comment)

Hey folks,

First of all, amazing work.

Secondly but hereafter therefore after all not less important, I faced a couple of issues while trying to run tric, specifically with event-tickets.

1 - Pressing "Enter" will skip the option

Before I get to that, just one observation: When I'm presented with an option such as "Do you want to run composer (yes)", if I just press ENTER, it will skip, I'd expect it to default to "yes".

So, back to the issue at hand. I could succesfully run wpunit on the-events-calendar with these commands:

While running the same for event-tickets give me some errors:

2 - Function mocker cache path not writeable

The first of them is related to the cache path of function mocker:

Click here to see the full output of `tric run wpunit` ``` ➜ event-tickets git:(master) ✗ tric run wpunit tric version 0.0.1 - Modern Tribe local testing and development tool Using event-tickets Creating dev_db_1 ... done Creating dev_chrome_1 ... done Creating dev_redis_1 ... done Creating dev_wordpress_1 ... done Fixing file ownership issues... fixuid: fixuid should only ever be used on development systems. DO NOT USE IN PRODUCTION fixuid: runtime UID '1000' already matches container user 'docker' UID fixuid: updating group 'docker' to GID '1001 fixuid: recursively searching path /project WordPress db is unavailable, waiting... WordPress db is unavailable, waiting... WordPress db is unavailable, waiting... WordPress db is unavailable, waiting... WordPress db is unavailable, waiting... WordPress db is unavailable, waiting... WordPress db is unavailable, waiting... WordPress db is unavailable, waiting... WordPress db up. Waiting for WordPress site to be available at http://wordpress.test... WordPress available at http://wordpress.test. Waiting 3 seconds... Changing directory to /var/www/html/wp-content/plugins/event-tickets Using project Codeception binary. Codeception PHP Testing Framework v2.5.6 Powered by PHPUnit 6.5.14 by Sebastian Bergmann and contributors. Running with seed: Function Mocker cache path: /tmp/function-mocker Warning: Uncaught Patchwork\Exceptions\CachePathUnavailable: The specified cache path is inexistent or read-only: /tmp/function-mocker in /var/www/html/wp-content/plugins/event-tickets/vendor/antecedent/patchwork/src/CodeManipulation.php:56 Stack trace: #0 /var/www/html/wp-content/plugins/event-tickets/vendor/antecedent/patchwork/src/CodeManipulation.php(105): Patchwork\CodeManipulation\cacheEnabled() #1 /var/www/html/wp-content/plugins/event-tickets/vendor/antecedent/patchwork/src/CodeManipulation.php(117): Patchwork\CodeManipulation\internalToCache('/var/www/html/w...') #2 /var/www/html/wp-content/plugins/event-tickets/vendor/antecedent/patchwork/src/CodeManipulation/Stream.php(46): Patchwork\CodeManipulation\transformAndOpen('/var/www/html/w...') #3 /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/includes/mock-mailer.php(2): Patchwork\CodeManipulation\Stream->stream_open('/var/www/html/w...', 'rb', 16512, NULL) #4 /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browse in /var/www/html/wp-content/plugins/event-tickets/vendor/antecedent/patchwork/src/CodeManipulation.php on line 56 Call Stack: 0.0002 411200 1. {main}() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/codecept:0 0.0860 6949168 2. Codeception\Application->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/codecept:43 0.0860 6949168 3. Codeception\Application->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Application.php:108 0.0961 7166240 4. Codeception\Application->doRun() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:148 0.0968 7172240 5. Codeception\Application->doRunCommand() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:255 0.0968 7172240 6. Codeception\Command\Run->run() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:987 0.0973 7175624 7. Codeception\Command\Run->execute() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Command/Command.php:255 0.1186 8125424 8. Codeception\Command\Run->runSuites() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Command/Run.php:390 0.1186 8125424 9. Codeception\Codecept->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Command/Run.php:495 0.1275 8131864 10. Codeception\Codecept->runSuite() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Codecept.php:159 0.1340 8742224 11. Codeception\SuiteManager->initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Codecept.php:188 0.1838 11637080 12. Codeception\Module\WPLoader->_initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/SuiteManager.php:80 0.1838 11637080 13. Codeception\Module\WPLoader->initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:205 0.1863 11832168 14. Codeception\Module\WPLoader->_loadWordpress() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:225 0.1875 11941872 15. Codeception\Module\WPLoader->installAndBootstrapInstallation() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:316 0.1878 11975544 16. require_once('/var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/includes/bootstrap.php') /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:504 0.1882 11997368 17. require_once('/var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/includes/mock-mailer.php') /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/includes/bootstrap.php:55 Fatal error: Codeception\Module\WPLoader::main(): Failed opening required '/var/www/html//wp-includes/class-phpmailer.php' (include_path='.:/usr/local/lib/php') in /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/includes/mock-mailer.php on line 2 Call Stack: 0.0002 411200 1. {main}() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/codecept:0 0.0860 6949168 2. Codeception\Application->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/codecept:43 0.0860 6949168 3. Codeception\Application->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Application.php:108 0.0961 7166240 4. Codeception\Application->doRun() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:148 0.0968 7172240 5. Codeception\Application->doRunCommand() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:255 0.0968 7172240 6. Codeception\Command\Run->run() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:987 0.0973 7175624 7. Codeception\Command\Run->execute() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Command/Command.php:255 0.1186 8125424 8. Codeception\Command\Run->runSuites() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Command/Run.php:390 0.1186 8125424 9. Codeception\Codecept->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Command/Run.php:495 0.1275 8131864 10. Codeception\Codecept->runSuite() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Codecept.php:159 0.1340 8742224 11. Codeception\SuiteManager->initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Codecept.php:188 0.1838 11637080 12. Codeception\Module\WPLoader->_initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/SuiteManager.php:80 0.1838 11637080 13. Codeception\Module\WPLoader->initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:205 0.1863 11832168 14. Codeception\Module\WPLoader->_loadWordpress() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:225 0.1875 11941872 15. Codeception\Module\WPLoader->installAndBootstrapInstallation() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:316 0.1878 11975544 16. require_once('/var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/includes/bootstrap.php') /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:504 0.1882 11997368 17. require_once('/var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/includes/mock-mailer.php') /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/includes/bootstrap.php:55 ```

I got around that by setting $cache_path = __DIR__ . '/.function-mocker-cache'; in event-tickets/tests/_function-mocker-bootstrap.php

3 - Can't connect to database

Notwithstanding my efforts, it can't connect to the test database, and it claims that wp_kses() has already been declared (as if it were trying to load the WordPress environment twice):

Click to see the output of `tric run wpunit` again ``` ➜ event-tickets git:(master) ✗ tric run wpunit tric version 0.0.1 - Modern Tribe local testing and development tool Using event-tickets Starting dev_db_1 ... done Starting dev_redis_1 ... done Starting dev_chrome_1 ... done Starting dev_wordpress_1 ... done Fixing file ownership issues... fixuid: fixuid should only ever be used on development systems. DO NOT USE IN PRODUCTION fixuid: runtime UID '1000' already matches container user 'docker' UID fixuid: updating group 'docker' to GID '1001 fixuid: recursively searching path /project WordPress db up. Waiting for WordPress site to be available at http://wordpress.test... WordPress available at http://wordpress.test. Waiting 3 seconds... Changing directory to /var/www/html/wp-content/plugins/event-tickets Using project Codeception binary. Codeception PHP Testing Framework v2.5.6 Powered by PHPUnit 6.5.14 by Sebastian Bergmann and contributors. Running with seed: Function Mocker cache path: /var/www/html/wp-content/plugins/event-tickets/tests/.function-mocker-cache Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/plugins/event-tickets/tests/_function-mocker-bootstrap.php:41) in /var/www/html/wp-includes/pluggable.php on line 1281 Call Stack: 0.0002 411200 1. {main}() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/codecept:0 0.0809 6949168 2. Codeception\Application->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/codecept:43 0.0809 6949168 3. Codeception\Application->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Application.php:108 0.0862 7166240 4. Codeception\Application->doRun() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:148 0.0868 7172240 5. Codeception\Application->doRunCommand() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:255 0.0869 7172240 6. Codeception\Command\Run->run() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:987 0.0874 7175624 7. Codeception\Command\Run->execute() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Command/Command.php:255 0.1023 8125424 8. Codeception\Command\Run->runSuites() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Command/Run.php:390 0.1023 8125424 9. Codeception\Codecept->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Command/Run.php:495 0.1081 8131864 10. Codeception\Codecept->runSuite() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Codecept.php:159 0.1160 8742224 11. Codeception\SuiteManager->initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Codecept.php:188 0.1607 11636528 12. Codeception\Module\WPLoader->_initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/SuiteManager.php:80 0.1607 11636528 13. Codeception\Module\WPLoader->initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:205 0.1638 11831616 14. Codeception\Module\WPLoader->_loadWordpress() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:225 0.1655 11941320 15. Codeception\Module\WPLoader->installAndBootstrapInstallation() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:316 0.1661 11974992 16. require_once('/var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/includes/bootstrap.php') /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:504 0.4933 12997536 17. require_once('/var/www/html/wp-settings.php') /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/includes/bootstrap.php:162 0.5618 21199048 18. wp_not_installed() /var/www/html/wp-settings.php:161 0.5814 22079608 19. wp_redirect() /var/www/html/wp-includes/load.php:614 0.5823 22079712 20. header() /var/www/html/wp-includes/pluggable.php:1281 Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/plugins/event-tickets/tests/_function-mocker-bootstrap.php:41) in /var/www/html/wp-includes/pluggable.php on line 1284 Call Stack: 0.0002 411200 1. {main}() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/codecept:0 0.0809 6949168 2. Codeception\Application->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/codecept:43 0.0809 6949168 3. Codeception\Application->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Application.php:108 0.0862 7166240 4. Codeception\Application->doRun() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:148 0.0868 7172240 5. Codeception\Application->doRunCommand() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:255 0.0869 7172240 6. Codeception\Command\Run->run() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:987 0.0874 7175624 7. Codeception\Command\Run->execute() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Command/Command.php:255 0.1023 8125424 8. Codeception\Command\Run->runSuites() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Command/Run.php:390 0.1023 8125424 9. Codeception\Codecept->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Command/Run.php:495 0.1081 8131864 10. Codeception\Codecept->runSuite() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Codecept.php:159 0.1160 8742224 11. Codeception\SuiteManager->initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Codecept.php:188 0.1607 11636528 12. Codeception\Module\WPLoader->_initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/SuiteManager.php:80 0.1607 11636528 13. Codeception\Module\WPLoader->initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:205 0.1638 11831616 14. Codeception\Module\WPLoader->_loadWordpress() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:225 0.1655 11941320 15. Codeception\Module\WPLoader->installAndBootstrapInstallation() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:316 0.1661 11974992 16. require_once('/var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/includes/bootstrap.php') /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:504 0.4933 12997536 17. require_once('/var/www/html/wp-settings.php') /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/includes/bootstrap.php:162 0.5618 21199048 18. wp_not_installed() /var/www/html/wp-settings.php:161 0.5814 22079608 19. wp_redirect() /var/www/html/wp-includes/load.php:614 0.5825 22079736 20. header() /var/www/html/wp-includes/pluggable.php:1284 Fatal error: Cannot redeclare wp_kses() (previously declared in /var/www/html/wp-includes/kses.php:731) in /var/www/html/wp-includes/kses.php on line 739 Call Stack: 0.0002 411200 1. {main}() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/codecept:0 0.0809 6949168 2. Codeception\Application->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/codecept:43 0.0809 6949168 3. Codeception\Application->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Application.php:108 0.0862 7166240 4. Codeception\Application->doRun() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:148 0.0868 7172240 5. Codeception\Application->doRunCommand() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:255 0.0869 7172240 6. Codeception\Command\Run->run() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:987 0.0874 7175624 7. Codeception\Command\Run->execute() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Command/Command.php:255 0.1023 8125424 8. Codeception\Command\Run->runSuites() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Command/Run.php:390 0.1023 8125424 9. Codeception\Codecept->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Command/Run.php:495 0.1081 8131864 10. Codeception\Codecept->runSuite() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Codecept.php:159 0.1160 8742224 11. Codeception\SuiteManager->initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Codecept.php:188 0.1607 11636528 12. Codeception\Module\WPLoader->_initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/SuiteManager.php:80 0.1607 11636528 13. Codeception\Module\WPLoader->initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:205 0.1638 11831616 14. Codeception\Module\WPLoader->_loadWordpress() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:225 0.1655 11941320 15. Codeception\Module\WPLoader->installAndBootstrapInstallation() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:316 0.1661 11974992 16. require_once('/var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/includes/bootstrap.php') /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:504 0.4933 12997536 17. require_once('/var/www/html/wp-settings.php') /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/includes/bootstrap.php:162 WordPress database error Table 'test.test_options' doesn't exist for query SELECT option_value FROM test_options WHERE option_name = 'WPLANG' LIMIT 1 made by Patchwork\CallRerouting\{closure}, ReflectionMethod->invokeArgs, WP_Fatal_Error_Handler->handle, load_default_textdomain, determine_locale, get_locale, get_option

WordPress database error: [Table 'test.test_options' doesn't exist]
SELECT option_value FROM test_options WHERE option_name = 'WPLANG' LIMIT 1

% ```
Same command without loading FunctionMocker ``` ➜ event-tickets git:(master) ✗ tric run wpunit tric version 0.0.1 - Modern Tribe local testing and development tool Using event-tickets Starting dev_db_1 ... done Starting dev_chrome_1 ... done Starting dev_wordpress_1 ... done Fixing file ownership issues... fixuid: fixuid should only ever be used on development systems. DO NOT USE IN PRODUCTION fixuid: runtime UID '1000' already matches container user 'docker' UID fixuid: updating group 'docker' to GID '1001 fixuid: recursively searching path /project WordPress db up. Waiting for WordPress site to be available at http://wordpress.test... WordPress available at http://wordpress.test. Waiting 3 seconds... Changing directory to /var/www/html/wp-content/plugins/event-tickets Using project Codeception binary. Codeception PHP Testing Framework v2.5.6 Powered by PHPUnit 6.5.14 by Sebastian Bergmann and contributors. Running with seed: Fatal error: Cannot redeclare wp_kses() (previously declared in /var/www/html/wp-includes/kses.php:731) in /var/www/html/wp-includes/kses.php on line 739 Call Stack: 0.0003 411200 1. {main}() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/codecept:0 0.0656 6941560 2. Codeception\Application->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/codecept:43 0.0656 6941560 3. Codeception\Application->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Application.php:108 0.0708 7158632 4. Codeception\Application->doRun() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:148 0.0715 7164632 5. Codeception\Application->doRunCommand() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:255 0.0715 7164632 6. Codeception\Command\Run->run() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Application.php:987 0.0720 7168016 7. Codeception\Command\Run->execute() /var/www/html/wp-content/plugins/event-tickets/vendor/symfony/console/Command/Command.php:255 0.0861 8094240 8. Codeception\Command\Run->runSuites() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Command/Run.php:390 0.0861 8094240 9. Codeception\Codecept->run() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Command/Run.php:495 0.0916 8099928 10. Codeception\Codecept->runSuite() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Codecept.php:159 0.0973 8710288 11. Codeception\SuiteManager->initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/Codecept.php:188 0.0976 8717520 12. Codeception\Module\WPLoader->_initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/codeception/codeception/src/Codeception/SuiteManager.php:80 0.0976 8717520 13. Codeception\Module\WPLoader->initialize() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:205 0.0994 8910096 14. Codeception\Module\WPLoader->_loadWordpress() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:225 0.1002 8951448 15. Codeception\Module\WPLoader->installAndBootstrapInstallation() /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:316 0.1005 8984880 16. require_once('/var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/includes/bootstrap.php') /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/Codeception/Module/WPLoader.php:504 0.3856 9736664 17. require_once('/var/www/html/wp-settings.php') /var/www/html/wp-content/plugins/event-tickets/vendor/lucatume/wp-browser/src/includes/bootstrap.php:162 WordPress database error Table 'test.test_options' doesn't exist for query SELECT option_value FROM test_options WHERE option_name = 'WPLANG' LIMIT 1 made by WP_Fatal_Error_Handler->handle, load_default_textdomain, determine_locale, get_locale, get_option

WordPress database error: [Table 'test.test_options' doesn't exist]
SELECT option_value FROM test_options WHERE option_name = 'WPLANG' LIMIT 1

% ```

4 - Racing conditions between ET and Common

And lastly, I do believe we still face racing conditions between ET and Common, even in tric. This is tricky (pun intended) since it can cause some errors that are really hard to debug. The solution for that was to run composer install --no-dev in event-tickets/common:

composer install --no-dev ``` ➜ common git:(924035ead) ✗ composer install --no-dev in `common` Loading composer repositories with package information Installing dependencies from lock file Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update `. Package operations: 0 installs, 0 updates, 119 removals - Removing xamin/handlebars.php (v0.10.4) - Removing wp-coding-standards/wpcs (2.2.1) - Removing wp-cli/wp-config-transformer (v1.2.6) - Removing wp-cli/wp-cli (v1.5.1) - Removing wp-cli/widget-command (v1.0.5) - Removing wp-cli/super-admin-command (v1.0.6) - Removing wp-cli/shell-command (v1.0.5) - Removing wp-cli/server-command (v1.0.9) - Removing wp-cli/search-replace-command (v1.3.1) - Removing wp-cli/scaffold-command (v1.2.0) - Removing wp-cli/role-command (v1.1.0) - Removing wp-cli/rewrite-command (v1.0.5) - Removing wp-cli/php-cli-tools (v0.11.11) - Removing wp-cli/package-command (v1.0.14) - Removing wp-cli/mustangostang-spyc (0.6.3) - Removing wp-cli/media-command (v1.1.4) - Removing wp-cli/language-command (v1.0.6) - Removing wp-cli/import-command (v1.0.7) - Removing wp-cli/extension-command (v1.2.2) - Removing wp-cli/export-command (v1.0.7) - Removing wp-cli/eval-command (v1.0.5) - Removing wp-cli/entity-command (v1.3.1) - Removing wp-cli/embed-command (v1.0.0) - Removing wp-cli/db-command (v1.3.5) - Removing wp-cli/cron-command (v1.0.5) - Removing wp-cli/core-command (v1.0.12) - Removing wp-cli/config-command (v1.2.0) - Removing wp-cli/checksum-command (v1.0.5) - Removing wp-cli/cache-command (v1.0.6) - Removing wp-cli/autoload-splitter (v0.1.5) - Removing webmozart/assert (1.6.0) - Removing vlucas/phpdotenv (v3.6.0) - Removing theseer/tokenizer (1.1.3) - Removing symfony/yaml (v3.4.37) - Removing symfony/translation (v3.4.37) - Removing symfony/process (v3.4.37) - Removing symfony/polyfill-mbstring (v1.13.1) - Removing symfony/polyfill-ctype (v1.13.1) - Removing symfony/finder (v3.4.37) - Removing symfony/filesystem (v3.4.37) - Removing symfony/event-dispatcher (v3.4.37) - Removing symfony/dom-crawler (v3.4.37) - Removing symfony/dependency-injection (v3.4.37) - Removing symfony/debug (v3.4.37) - Removing symfony/css-selector (v3.4.37) - Removing symfony/console (v3.4.37) - Removing symfony/config (v3.4.37) - Removing symfony/browser-kit (v3.4.37) - Removing squizlabs/php_codesniffer (3.5.4) - Removing seld/phar-utils (1.0.2) - Removing seld/jsonlint (1.7.2) - Removing sebastian/version (2.0.1) - Removing sebastian/resource-operations (1.0.0) - Removing sebastian/recursion-context (3.0.0) - Removing sebastian/object-reflector (1.1.1) - Removing sebastian/object-enumerator (3.0.3) - Removing sebastian/global-state (2.0.0) - Removing sebastian/exporter (3.1.2) - Removing sebastian/environment (3.1.0) - Removing sebastian/diff (2.0.1) - Removing sebastian/comparator (2.1.3) - Removing sebastian/code-unit-reverse-lookup (1.0.1) - Removing rmccue/requests (v1.7.0) - Removing ramsey/array_column (1.1.3) - Removing ralouphie/getallheaders (3.0.3) - Removing psr/simple-cache (1.0.1) - Removing psr/http-message (1.0.1) - Removing psr/container (1.0.0) - Removing phpunit/phpunit-mock-objects (5.0.10) - Removing phpunit/phpunit (6.5.14) - Removing phpunit/php-token-stream (2.0.2) - Removing phpunit/php-timer (1.0.9) - Removing phpunit/php-text-template (1.2.1) - Removing phpunit/php-file-iterator (1.4.5) - Removing phpunit/php-code-coverage (5.3.2) - Removing phpspec/prophecy (v1.10.2) - Removing phpoption/phpoption (1.7.2) - Removing phpdocumentor/type-resolver (0.5.1) - Removing phpdocumentor/reflection-docblock (4.3.4) - Removing phpdocumentor/reflection-common (1.0.1) - Removing phar-io/version (1.0.1) - Removing phar-io/manifest (1.0.1) - Removing nilportugues/sql-query-formatter (v1.2.2) - Removing nesbot/carbon (1.39.1) - Removing nb/oxymel (v0.1.0) - Removing myclabs/deep-copy (1.7.0) - Removing mustache/mustache (v2.13.0) - Removing moderntribe/tribalscents (dev-master a6adf7f) - Removing mikemclin/laravel-wp-password (2.0.1) - Removing lucatume/wp-browser-commons (1.2.10) - Removing lucatume/function-mocker-le (1.0.1) - Removing kylekatarnls/update-helper (1.2.0) - Removing justinrainbow/json-schema (5.2.9) - Removing illuminate/support (v5.5.44) - Removing illuminate/contracts (v5.5.44) - Removing hautelook/phpass (0.3.5) - Removing guzzlehttp/psr7 (1.6.1) - Removing guzzlehttp/promises (v1.3.1) - Removing guzzlehttp/guzzle (6.5.2) - Removing facebook/webdriver (1.7.1) - Removing doctrine/instantiator (1.0.5) - Removing doctrine/inflector (v1.2.0) - Removing dg/mysql-dump (v1.5.1) - Removing dealerdirect/phpcodesniffer-composer-installer (v0.4.4) - Removing composer/xdebug-handler (1.4.0) - Removing composer/spdx-licenses (1.5.2) - Removing composer/semver (1.5.1) - Removing composer/composer (1.9.3) - Removing composer/ca-bundle (1.2.6) - Removing codeception/stub (2.1.0) - Removing codeception/phpunit-wrapper (6.8.0) - Removing codeception/codeception (2.5.6) - Removing behat/gherkin (v4.6.0) - Removing bacon/bacon-string-utils (1.1.0) - Removing automattic/vipwpcs (2.0.0) - Removing antecedent/patchwork (2.1.12) - Removing moderntribe/tribe-testing-facilities (dev-spotfix/include-views-exclusion-for-data-attr-breakpoints 239335c) - Removing lucatume/wp-browser (2.2.6) - Removing gumlet/php-image-resize (1.9.2) Generating autoload files > xrstf\Composer52\Generator::onPostInstallCmd > xrstf\Composer52\Generator::onPostInstallCmd ```

If common and ET have different versions for any of this package it would rely on racing conditions to load one or the other because of namespace conflicts in Composer [1], [2], etc

We can either prefix require-dev on Common and ET (or Common and TEC, etc), with Mozart or PHP-Scoper, or we can run composer install --no-dev on Common in event-tickets and the-events-calendar and have a development version of common in a separate directory that won't cause conflicts.

Debug information

My system information ``` ➜ event-tickets git:(master) ✗ docker --version Docker version 19.03.8-ce, build afacb8b7f0 ``` ``` ➜ event-tickets git:(master) ✗ id uid=1000(lucas) gid=1001(lucas) groups=1001(lucas),3(sys),90(network),98(power),965(docker),991(lp),998(wheel),1000(autologin) ``` ``` ➜ event-tickets git:(master) ✗ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 744dec9ce6a2 wordpress:5.4.1-apache "docker-entrypoint.s…" About an hour ago Up About an hour 0.0.0.0:8888->80/tcp dev_wordpress_1 fb1a18bec139 selenium/standalone-chrome:3.141.59-oxygen "/opt/bin/entry_poin…" About an hour ago Up About an hour 4444/tcp dev_chrome_1 d9b52bd9511c mariadb "docker-entrypoint.s…" About an hour ago Up About an hour 3306/tcp dev_db_1 bc5bda6f4c89 redis "docker-entrypoint.s…" About an hour ago Up About an hour 0.0.0.0:8379->6379/tcp dev_redis_1 ``` ``` ➜ event-tickets git:(master) ✗ docker exec -it d9b52bd9511c bash root@d9b52bd9511c:/# mariadb -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 39 Server version: 10.4.13-MariaDB-1:10.4.13+maria~bionic mariadb.org binary distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> use test Database changed MariaDB [test]> show tables; Empty set (0.001 sec) MariaDB [test]> ``` ``` ➜ event-tickets git:(master) ✗ inxi -Fxxxza System: Host: lucas-gl502vs Kernel: 5.6.12-1-MANJARO x86_64 bits: 64 compiler: gcc v: 9.3.0 parameters: BOOT_IMAGE=/boot/vmlinuz-5.6-x86_64 root=UUID=a4c38697-f422-447b-9572-597499bf038b rw quiet apparmor=1 security=apparmor udev.log_priority=3 Desktop: KDE Plasma 5.18.5 tk: Qt 5.14.2 wm: kwin_x11 dm: SDDM Distro: Manjaro Linux Machine: Type: Laptop System: ASUSTeK product: GL502VS v: 1.0 serial: Mobo: ASUSTeK model: GL502VS v: 1.0 serial: UEFI: American Megatrends v: GL502VS.306 date: 05/17/2019 Battery: ID-1: BAT0 charge: 54.9 Wh condition: 55.7/62.6 Wh (89%) volts: 15.2/15.2 model: ASUSTeK ASUS Battery type: Li-ion serial: status: Not charging cycles: 53 Device-1: hidpp_battery_0 model: Logitech Wireless Keyboard serial: charge: 55% (should be ignored) rechargeable: yes status: Discharging CPU: Topology: Quad Core model: Intel Core i7-6700HQ bits: 64 type: MT MCP arch: Skylake-S family: 6 model-id: 5E (94) stepping: 3 microcode: D6 L2 cache: 6144 KiB flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 41621 Speed: 800 MHz min/max: 800/3500 MHz Core speeds (MHz): 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 Vulnerabilities: Type: itlb_multihit status: KVM: Split huge pages Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable Type: mds mitigation: Clear CPU buffers; SMT vulnerable Type: meltdown mitigation: PTI Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl and seccomp Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional, IBRS_FW, STIBP: conditional, RSB filling Type: tsx_async_abort mitigation: Clear CPU buffers; SMT vulnerable Graphics: Device-1: NVIDIA GP104BM [GeForce GTX 1070 Mobile] vendor: ASUSTeK driver: nvidia v: 440.82 bus ID: 01:00.0 chip ID: 10de:1be1 Display: x11 server: X.Org 1.20.8 driver: modesetting,nvidia compositor: kwin_x11 resolution: 1920x1080~60Hz, 1920x1080~60Hz, 1920x1080~60Hz OpenGL: renderer: GeForce GTX 1070/PCIe/SSE2 v: 4.6.0 NVIDIA 440.82 direct render: Yes Audio: Device-1: Intel 100 Series/C230 Series Family HD Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel bus ID: 00:1f.3 chip ID: 8086:a170 Device-2: NVIDIA GP104 High Definition Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel bus ID: 01:00.1 chip ID: 10de:10f0 Device-3: Logitech HD Pro Webcam C920 type: USB driver: snd-usb-audio,uvcvideo bus ID: 1-5.1:5 chip ID: 046d:082d serial: Device-4: Logitech [G533 Wireless Headset Dongle] type: USB driver: hid-generic,snd-usb-audio,usbhid bus ID: 1-5.4:10 chip ID: 046d:0a66 Sound Server: ALSA v: k5.6.12-1-MANJARO Network: Device-1: Intel Wireless 8260 driver: iwlwifi v: kernel port: e000 bus ID: 02:00.0 chip ID: 8086:24f3 IF: wlp2s0 state: down mac: Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: ASUSTeK driver: r8169 v: kernel port: d000 bus ID: 03:00.0 chip ID: 10ec:8168 IF: enp3s0 state: up speed: 100 Mbps duplex: full mac: IF-ID-1: br-02b9ded2bf1a state: up speed: 10000 Mbps duplex: unknown mac: IF-ID-2: br-29cc343626aa state: down mac: IF-ID-3: br-b58a877a29dd state: up speed: 10000 Mbps duplex: unknown mac: IF-ID-4: docker0 state: down mac: IF-ID-5: veth06df6b8 state: up speed: 10000 Mbps duplex: full mac: IF-ID-6: veth10119ff state: up speed: 10000 Mbps duplex: full mac: IF-ID-7: veth14bcbcd state: up speed: 10000 Mbps duplex: full mac: IF-ID-8: veth1fcc7b0 state: up speed: 10000 Mbps duplex: full mac: IF-ID-9: veth37606d9 state: up speed: 10000 Mbps duplex: full mac: IF-ID-10: veth6124878 state: up speed: 10000 Mbps duplex: full mac: IF-ID-11: veth710dbc1 state: up speed: 10000 Mbps duplex: full mac: IF-ID-12: vethd482172 state: up speed: 10000 Mbps duplex: full mac: IF-ID-13: vethe8657ad state: up speed: 10000 Mbps duplex: full mac: IF-ID-14: vethede0d5d state: up speed: 10000 Mbps duplex: full mac: IF-ID-15: vethf80e347 state: up speed: 10000 Mbps duplex: full mac: IF-ID-16: vethf8cad62 state: up speed: 10000 Mbps duplex: full mac: IF-ID-17: vmnet1 state: unknown speed: N/A duplex: N/A mac: IF-ID-18: vmnet8 state: unknown speed: N/A duplex: N/A mac: Drives: Local Storage: total: 2.77 TiB used: 145.66 GiB (5.1%) ID-1: /dev/nvme0n1 vendor: Intel model: SSDPEKNW020T8 size: 1.86 TiB block size: physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 serial: rev: 002C scheme: GPT ID-2: /dev/sda vendor: HGST (Hitachi) model: HTS721010A9E630 size: 931.51 GiB block size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s rotation: 7200 rpm serial: rev: A3J0 scheme: GPT Partition: ID-1: / raw size: 977.93 GiB size: 961.58 GiB (98.33%) used: 67.39 GiB (7.0%) fs: ext4 dev: /dev/nvme0n1p6 Sensors: System Temperatures: cpu: 58.5 C mobo: N/A gpu: nvidia temp: 52 C Fan Speeds (RPM): cpu: 1900 Info: Processes: 373 Uptime: 1h 42m Memory: 15.58 GiB used: 7.67 GiB (49.2%) Init: systemd v: 245 Compilers: gcc: 9.3.0 Shell: zsh v: 5.8 running in: konsole inxi: 3.0.37 ```
Luc45 commented 4 years ago

Aha! Got it.

I've switched to a branch where I update all test-related packages to the latest version, AND I've removed Function Mocker.

Now it's running :rocket: .

Now I just have to fix FunctionMocker, instead of removing it.

[1] Node version ``` ➜ common git:(ae1e144ce) ✗ cat .nvmrc 8.9.4 ➜ common git:(ae1e144ce) ✗ node --version v8.9.4 ```
Luc45 commented 4 years ago

It seems that /tmp/function-mocker is not writable by the PHP process inside Tric:

CONTAINER ID        IMAGE                                        COMMAND                  CREATED             STATUS              PORTS                    NAMES
78ec061677a6        lucatume/codeception:cc3.1.0                 "docker-entrypoint.s…"   2 minutes ago       Up 2 minutes                                 dev_codeception_run_4649ebc820c9
➜  common git:(ae1e144ce) ✗ docker exec -it 78ec061677a6 bash 
docker@94b950b41d1b:/tmp$ ls -la /tmp
total 12
drwxrwxrwt 1 root root 4096 May 22 15:40 .
drwxr-xr-x 1 root root 4096 May 22 15:40 ..
drwxr-xr-x 2 root root 4096 May 22 10:24 function-mocker

/tmp folder is 777, but function-mocker is 755.

Since it's owned by root, it probably wasn't created by PHP. I'm not sure where this function-mocker folder is coming from inside the codeception container. I'll keep looking, but I'm open for suggestions.

-- Edit

tric-stack.yml

    volumes:
      - function-mocker-cache:/tmp/function-mocker

Not sure how to solve it, OOO next hour

Luc45 commented 4 years ago

@lucatume , perhaps a chmod 0777 /tmp/function-mocker in the Codeception image Dockerfile could solve this? https://github.com/lucatume/dockerfiles/blob/master/containers/codeception/Dockerfile

lucatume commented 4 years ago

@Luc45 I'm not updating a docker image I'm using elsewhere, and often w/o function-mocker to fit an application. It seems like, in the function-mocker bootstrap PHP file, we should check and create, or update, the function-mocker cache application to have 0777 file mode.

Luc45 commented 4 years ago

@lucatume we can't do that in PHP because the folder is owned by root (created by Docker)

We could probably just get rid of this volume, then, and let PHP create it since /tmp has 0777 anyway: https://github.com/moderntribe/products-test-automation/blob/master/dev/tric-stack.yml#L171

Function Mocker will try to create and use that folder by default: https://github.com/moderntribe/event-tickets/blob/master/tests/_function-mocker-bootstrap.php#L30

So we can just get Docker out of the way for PHP to do it instead