What are the Slack Archives?
It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hi! I’ve installed
Hi!
I’ve installed spryker-b2b-demo in docker & dev mode.
I tried to get Tests running by using the bootcamp StringReverser example.
Running the tests in docker with docker/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? 🤗
Comments
-
anyway, first guess: the codeception.yml from our example loads too many unnecessary modules
0 -
Please, try different way to run tests:
docker/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.
0 -
@UJN2JRU4F codeception.yml
namespace: 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 bootcamp
0 -
@ULYHPR789 the command does not run any test with my current configuration. But I’ll investigate - thx for the hint. I’ll come back at you with new results 😄
0 -
another first guess (looks like my first guesses are not very good today 😊)
0 -
@ULYHPR789’s command calls a specific group
0 -
mondays.. 😄 ¯_(ツ)_/¯
0 -
the group does not exists on the test
0 -
i thought so, currently checking codeceptions documentation on how to fix it
0 -
oh, it does
0 -
is it the
namespace
attribute, that defines the group?0 -
(there are actually a lot of those)
0 -
ahh thx for pointing that out
0 -
[PyzTest\Zed\StringReverser]: tests from /data/tests/PyzTest/Zed/StringReverser PyzTest\Zed\StringReverser.Business Tests (0)
0 -
i am such an idiot…
0 -
i ran the
codeception
with the complete namespace not the groupStringReverser
🤦♂️0 -
thx @ULYHPR789 and @UJN2JRU4F
0 -
i will add the docker specific stuff to the bootcamp in the next iteration. thanks for pointing it out! 👍
0 -
main thing is that it works now 😉
0 -
yea it works - thanks again
0 -
What was the solution for this? I have the exact same problem (also using docker). All the"@group" tags within my test class are out-commented.
0 -
maybe @U014B6AG7EX?
0 -
For me removing the
\SprykerTest\Shared\Propel\Helper\TransactionHelper
from codeception.yml was enough (runcodecept 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 thedocker.dev
environment which the testing container uses sets up the database connection by includingcommon/config_services-devvm.php
where the DB host is set to localhost (which seems wrong to me at first glance).0 -
It APPLICATION_ENV=devtest instead of docker specific one.
0 -
This file https://github.com/spryker-shop/b2b-demo-shop/blob/master/tests/PyzTest/Shared/Testify/_support/Helper/Environment.php should be like this:
<?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(); } }
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 930 Developer Corner
- 788 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 33 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random