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..

Hey, I am trying to add a testing database to my docker setup. What is the right way to do so? I tri

UME3Z31P0
UME3Z31P0 Posts: 15 🧑🏻‍🚀 - Cadet

Hey, I am trying to add a testing database to my docker setup. What is the right way to do so? I tried adding a new “testing” region in the deploy file, but that doesn’t seem right and it doesn’t work anyway. Thanks!

Comments

  • sprymiker
    sprymiker Sprykee Posts: 781 🧑🏻‍🚀 - Cadet

    Do you want to create dedicated store for the testing?

  • UME3Z31P0
    UME3Z31P0 Posts: 15 🧑🏻‍🚀 - Cadet

    Not neccessarily, I just want a seperate database for testing.

  • sprymiker
    sprymiker Sprykee Posts: 781 🧑🏻‍🚀 - Cadet
    edited January 2020

    There are 2 possible options:
    1. Separate store. Should work OOTB. But it will need
    • Changing deploy.yml file by adding region, group, endpoints. Also pointing right store in docker:testing:store:
    • Copying demo data (in csv files)
    • Adding store in config/Shared/stores.php
    2. Overriding database only for test mode. Not OOTB. But it can be done by managing of nginx and env files.

  • sprymiker
    sprymiker Sprykee Posts: 781 🧑🏻‍🚀 - Cadet

    Also I see 3 option:
    separate deploy.yml file for testing. But it makes impossible to use testing and dev mode at the same time. So docker/sdk boot {file} && docker/sdk up each time you need to switch the mode.

  • sprymiker
    sprymiker Sprykee Posts: 781 🧑🏻‍🚀 - Cadet

    What is the reason you want separate database for testing?

  • UME3Z31P0
    UME3Z31P0 Posts: 15 🧑🏻‍🚀 - Cadet

    Thanks! I just assumed that I need a seperate database since the devtest_DE config specifies a “DE_devtest_zed” database 😅

  • sprymiker
    sprymiker Sprykee Posts: 781 🧑🏻‍🚀 - Cadet

    devtest_DE does not used in docker SDK at all. In docker setup only config_docker is used.

  • UME3Z31P0
    UME3Z31P0 Posts: 15 🧑🏻‍🚀 - Cadet

    Maybe it’s because I’m still on the 201907.0 b2c-demoshop, but the devtest-DE config seems to be read when running codeception commands inside the cli

  • sprymiker
    sprymiker Sprykee Posts: 781 🧑🏻‍🚀 - Cadet

    For running tests with Docker SDK you need:

    docker/sdk testing -> and then codecept ...

    docker/sdk testing codecept run 
    
  • UME3Z31P0
    UME3Z31P0 Posts: 15 🧑🏻‍🚀 - Cadet

    Thats what I am doing, but when I change config values in devtest_DE, for example ZED_DB_DATABASE, it affects the tests.

  • UME3Z31P0
    UME3Z31P0 Posts: 15 🧑🏻‍🚀 - Cadet

    I’ll try to setup a clean project using the latest release, maybe I just broke something

  • sprymiker
    sprymiker Sprykee Posts: 781 🧑🏻‍🚀 - Cadet

    It should not get into devtest environment.

  • sprymiker
    sprymiker Sprykee Posts: 781 🧑🏻‍🚀 - Cadet

    vendor/spryker/spryker/Bundles/Testify/tests/SprykerTest/Shared/Testify/_support/Helper/Environment.php

    Do you have the following code inside?

            if (getenv('SPRYKER_TESTING_ENABLED')) {
                return getenv('APPLICATION_ENV');
            }
    
  • UME3Z31P0
    UME3Z31P0 Posts: 15 🧑🏻‍🚀 - Cadet

    I just installed the new release of the b2c-demoshop and both, my old and the new shop, are missing the entire vendor/spryker/spryker directory. However, I have a Environment.php in tests/PyzTest/Shared/Testify/_support/Helper/, but the code you mentioned is not present there.

  • UME3Z31P0
    UME3Z31P0 Posts: 15 🧑🏻‍🚀 - Cadet

    My colleague is also missing the directory in his b2b shop

  • sprymiker
    sprymiker Sprykee Posts: 781 🧑🏻‍🚀 - Cadet

    it seems you need to update testify module to have possibility to run tests in docker.
    Use the last one please to check.

  • sprymiker
    sprymiker Sprykee Posts: 781 🧑🏻‍🚀 - Cadet

    composer update spryker/testify

  • sprymiker
    sprymiker Sprykee Posts: 781 🧑🏻‍🚀 - Cadet

    It seems that does not help. I need time to figure out why that code was missed.

  • sprymiker
    sprymiker Sprykee Posts: 781 🧑🏻‍🚀 - Cadet

    Wait. I found the file:

    tests/SprykerTest/Shared/Testify/_support/Helper/Environment.php

  • sprymiker
    sprymiker Sprykee Posts: 781 🧑🏻‍🚀 - Cadet

    And code is there. So just update testify

  • UME3Z31P0
    UME3Z31P0 Posts: 15 🧑🏻‍🚀 - Cadet
    edited January 2020

    Exactly, was just about to say that the file is just in another location now. But it wasn’t there before I updated testify, so thanks a lot! 😁

  • sprymiker
    sprymiker Sprykee Posts: 781 🧑🏻‍🚀 - Cadet

    Thanks for feedback.