nutritious-island-37975
07/20/2020, 9:40 AMdocker/sdk testing codecept run -c tests/PyzTest/Zed/StringReverser results in:
PyzTest\Zed\StringReverser.Business Tests (1)
E StringReverserFacadeTest: String is reversed correctly
E StringReverserFacadeTest: String is reversed correctly (0.00s)
In ConnectionFactory.php line 43:
Unable to open connection
In PdoAdapter.php line 72:
Unable to open PDO connection
In PdoConnection.php line 59:
SQLSTATE[08006] [7] could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
This is not the desired Exception, in the bootcamp the exception was FacadeNotFoundException. And I don’t think there should be a PDOException since there is no DB involved (or is it, the test runs in the Business Layer 🤔)?
Running docker desktop 2.3.0.3 (stable) on macOS Catalina v 10.15.5 with recommended docker settings.
Can you help me or point me in a direction to get the tests working in docker? 🤗quick-account-45953
07/20/2020, 10:26 AMhigh-pencil-62400
07/20/2020, 10:33 AMdocker/sdk testing codecept run -g StringReverser
To speed up the run you can change codeception.yml or create your own and set include: to include only necessary test.nutritious-island-37975
07/20/2020, 10:44 AMnamespace: PyzTest\Zed\StringReverser
paths:
tests: .
data: _data
support: _support
log: _output
coverage:
enabled: true
remote: false
whitelist: { include: ['../../../../src/*'] }
suites:
Business:
path: Business
class_name: StringReverserBusinessTester
modules:
enabled:
- Asserts
- \PyzTest\Shared\Testify\Helper\Environment
- \SprykerTest\Shared\Testify\Helper\ConfigHelper
- \SprykerTest\Shared\Testify\Helper\DependencyHelper
- \SprykerTest\Shared\Propel\Helper\TransactionHelper
- \SprykerTest\Shared\Testify\Helper\LocatorHelper:
projectNamespaces: ['Pyz']
1:1 from the bootcampnutritious-island-37975
07/20/2020, 10:46 AMquick-account-45953
07/20/2020, 10:47 AMquick-account-45953
07/20/2020, 10:48 AMnutritious-island-37975
07/20/2020, 10:48 AMquick-account-45953
07/20/2020, 10:48 AMnutritious-island-37975
07/20/2020, 10:48 AMquick-account-45953
07/20/2020, 10:48 AMnutritious-island-37975
07/20/2020, 10:51 AMnamespace attribute, that defines the group?quick-account-45953
07/20/2020, 10:51 AMquick-account-45953
07/20/2020, 10:52 AMnutritious-island-37975
07/20/2020, 10:52 AMnutritious-island-37975
07/20/2020, 10:53 AM[PyzTest\Zed\StringReverser]: tests from /data/tests/PyzTest/Zed/StringReverser
PyzTest\Zed\StringReverser.Business Tests (0)nutritious-island-37975
07/20/2020, 10:57 AMnutritious-island-37975
07/20/2020, 10:57 AMnutritious-island-37975
07/20/2020, 10:58 AMquick-account-45953
07/20/2020, 10:58 AMquick-account-45953
07/20/2020, 10:59 AMnutritious-island-37975
07/20/2020, 11:09 AMimportant-lunch-21173
10/20/2020, 9:09 AMquick-account-45953
10/20/2020, 9:24 AMwhite-helmet-93908
10/25/2020, 5:51 PM\SprykerTest\Shared\Propel\Helper\TransactionHelper from codeception.yml was enough (run codecept build -c tests/PyzTest/Zed/StringReverser afterwards) – neither test nor module use persistence so it shouldn't be required. Main issue seems to be that the docker.dev environment which the testing container uses sets up the database connection by including common/config_services-devvm.php where the DB host is set to localhost (which seems wrong to me at first glance).high-pencil-62400
10/26/2020, 7:59 AMhigh-pencil-62400
10/26/2020, 8:00 AM<?php
/**
* This file is part of the Spryker Suite.
* For full license information, please view the LICENSE file that was distributed with this source code.
*/
namespace PyzTest\Shared\Testify\Helper;
use Codeception\Module;
use Spryker\Shared\Kernel\CodeBucket\Config\CodeBucketConfig;
use Spryker\Shared\Kernel\CodeBucket\Config\CodeBucketConfigInterface;
class Environment extends Module
{
protected const TESTING_APPLICATION_ENV_NAME = 'devtest';
/**
* @return void
*/
public function _initialize()
{
$rootDir = realpath(__DIR__ . '/../../../../../../');
$applicationEnv = $this->getApplicationEnv();
defined('APPLICATION_ENV') || define('APPLICATION_ENV', $applicationEnv);
defined('APPLICATION_STORE') || define('APPLICATION_STORE', (isset($_SERVER['APPLICATION_STORE'])) ? $_SERVER['APPLICATION_STORE'] : 'DE');
putenv('APPLICATION_STORE=' . APPLICATION_STORE);
defined('APPLICATION') || define('APPLICATION', '');
defined('APPLICATION_ROOT_DIR') || define('APPLICATION_ROOT_DIR', $rootDir);
defined('APPLICATION_SOURCE_DIR') || define('APPLICATION_SOURCE_DIR', APPLICATION_ROOT_DIR . '/src');
defined('APPLICATION_VENDOR_DIR') || define('APPLICATION_VENDOR_DIR', APPLICATION_ROOT_DIR . '/vendor');
defined('APPLICATION_CODE_BUCKET') || define('APPLICATION_CODE_BUCKET', $this->createCodeBucketConfig()->getCurrentCodeBucket());
putenv('APPLICATION_CODE_BUCKET=' . APPLICATION_CODE_BUCKET);
}
/**
* @return string
*/
protected function getApplicationEnv(): string
{
if (getenv('SPRYKER_TESTING_ENABLED')) {
return getenv('APPLICATION_ENV');
}
return static::TESTING_APPLICATION_ENV_NAME;
}
/**
* @return \Spryker\Shared\Kernel\CodeBucket\Config\CodeBucketConfigInterface
*/
protected function createCodeBucketConfig(): CodeBucketConfigInterface
{
return new CodeBucketConfig();
}
}