module-db
module-db copied to clipboard
[PDOException] SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for host.docker.internal failed: Name or service not known
I'm trying to use Docker to run module-db tests locally.
Steps to reproduce:
docker compose up -d
docker exec -it module-db-php81-1 bash -c "composer install"
docker exec -it module-db-php81-1 bash -c "php vendor/bin/codecept run unit Codeception/Module/Db/MySqlDbTest:testGrabColumnFromDatabase -vvv""
Output has error: [PDOException] SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for host.docker.internal failed: Name or service not known
Console output with -vvv mode:
Codeception PHP Testing Framework v5.0.10 https://helpukrainewin.org
actor is empty
Unit Tests (1) --------------------------------------------------------------------------------------------------------------------------------------------------------------
Modules:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
E MySqlDbTest: Grab column from database(0.08s)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Time: 00:00.110, Memory: 12.00 MB
There was 1 error:
1) MySqlDbTest: Grab column from database
Test tests/unit/Codeception/Module/Db/MySqlDbTest.php:testGrabColumnFromDatabase
[PDOException] SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for host.docker.internal failed: Name or service not known
/var/www/html/src/Codeception/Lib/Driver/Db.php:83
/var/www/html/src/Codeception/Lib/Driver/Db.php:58
/var/www/html/tests/unit/Codeception/Module/Db/AbstractDbTest.php:22
/var/www/html/vendor/codeception/codeception/src/PHPUnit/TestCase.php:10
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php:2085
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php:2027
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php:626
/var/www/html/vendor/codeception/codeception/src/Codeception/Test/TestCaseWrapper.php:148
/var/www/html/vendor/codeception/codeception/src/Codeception/Test/Test.php:170
/var/www/html/vendor/codeception/codeception/src/Codeception/Suite.php:130
/var/www/html/vendor/codeception/codeception/src/Codeception/SuiteManager.php:148
/var/www/html/vendor/codeception/codeception/src/Codeception/Codecept.php:260
/var/www/html/vendor/codeception/codeception/src/Codeception/Codecept.php:216
/var/www/html/vendor/codeception/codeception/src/Codeception/Command/Run.php:435
/var/www/html/vendor/symfony/console/Command/Command.php:326
/var/www/html/vendor/symfony/console/Application.php:1063
/var/www/html/vendor/symfony/console/Application.php:320
/var/www/html/vendor/symfony/console/Application.php:174
/var/www/html/vendor/codeception/codeception/src/Codeception/Application.php:112
/var/www/html/vendor/codeception/codeception/app.php:45
/var/www/html/vendor/codeception/codeception/app.php:46
/var/www/html/vendor/codeception/codeception/codecept:7
/var/www/html/vendor/bin/codecept:120
ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
Details
- Codeception version: 5.0.10
- PHP Version: 8.1.17 (cli)
- Operating System: Linux
- Installation type: Dockerized
- List of installed packages (
composer show)
behat/gherkin dev-master 01379b1 Gherkin DSL parser for PHP
codeception/codeception 5.0.x-dev ed4af7f BDD-style testing framework
codeception/lib-asserts 2.1.0 Assertion methods used by Codeception core and Asserts module
codeception/stub 4.1.0 Flexible Stub wrapper for PHPUnit's Mock Builder
myclabs/deep-copy 1.x-dev 928a96f Create deep copies (clones) of your objects
nikic/php-parser 4.x-dev 0ffddce A PHP parser written in PHP
phar-io/manifest dev-master 36d8a21 Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version 3.2.1 Library for handling version information and constraints
phpunit/php-code-coverage dev-main 913f51a Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator dev-main 83f6271 FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker dev-main 5994330 Invoke callables with a timeout
phpunit/php-text-template dev-main 9914010 Simple template engine.
phpunit/php-timer dev-main fe67739 Utility class for timing
phpunit/phpunit dev-main b79f52f The PHP Unit Testing framework.
psr/container dev-master 90db7b9 Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher dev-master e275e2d Standard interfaces for event handling.
psy/psysh dev-main 6c8c0fd An interactive shell for modern PHP.
sebastian/cli-parser dev-main 9215d45 Library for parsing CLI options
sebastian/code-unit dev-main 362736b Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup dev-main cd740da Looks up which function or method a line of code belongs to
sebastian/comparator dev-main 5d09783 Provides the functionality to compare PHP values for equality
sebastian/complexity dev-main 27d3bd5 Library for calculating the complexity of PHP code units
sebastian/diff dev-main 2c9aad8 Diff implementation
sebastian/environment dev-main 54b3f6e Provides functionality to handle HHVM/PHP environments
sebastian/exporter dev-main d6e9b3c Provides the functionality to export PHP variables for visualization
sebastian/global-state dev-main 3b3c08e Snapshotting of global state
sebastian/lines-of-code dev-main a1e716d Library for counting the lines of code in PHP source code
sebastian/object-enumerator dev-main ac568e5 Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector dev-main 4bf3974 Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context dev-main 8343512 Provides functionality to recursively process PHP variables
sebastian/type dev-main 1a33327 Collection of value objects that represent the types of the PHP type system
sebastian/version dev-main a7fa65c Library that helps with managing the version number of Git-hosted PHP projects
symfony/console 6.3.x-dev 2655810 Eases the creation of beautiful and testable command line interfaces
symfony/css-selector 6.3.x-dev 88453e6 Converts CSS selectors to XPath expressions
symfony/deprecation-contracts dev-main e2d1534 A generic function and convention to trigger deprecation notices
symfony/event-dispatcher 6.3.x-dev 3aa5237 Provides tools that allow your application components to communicate with each other by dispatching events and lis...
symfony/event-dispatcher-contracts dev-main 0ad3b6f Generic abstractions related to dispatching event
symfony/finder 6.3.x-dev f5891f0 Finds files and directories via an intuitive fluent interface
symfony/polyfill-ctype dev-main ea208ce Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme dev-main 875e90a Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-normalizer dev-main 8c4ad05 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring dev-main f9c7aff Symfony polyfill for the Mbstring extension
symfony/service-contracts dev-main a8c9ced Generic abstractions related to writing services
symfony/string 6.3.x-dev 0120462 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unif...
symfony/var-dumper 6.3.x-dev efc8f5d Provides mechanisms for walking through any arbitrary PHP variable
symfony/yaml 6.3.x-dev 55071ed Loads and dumps YAML files
theseer/tokenizer 1.2.1 A small library for converting tokenized PHP source code into XML and potentially other formats