This repository was archived by the owner on Nov 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
MAGECLOUD-3684 functional testing in Docker #4828
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f003618
MAGECLOUD-3684 add functional testing
hguthrie 499d278
add to all versions
hguthrie bf21160
Update examples and leftover questions
hguthrie b42b6a1
slight fix
hguthrie a627d61
fix bad formatting in docker arch
hguthrie 6a4f325
forgot about version 2.2
hguthrie a1600a6
Apply suggestions from code review
hguthrie 3885e91
Update from feedback
hguthrie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
--- | ||
group: cloud-guide | ||
title: Functional testing in Docker | ||
functional_areas: | ||
- Cloud | ||
- Docker | ||
- Configuration | ||
--- | ||
|
||
You can use the `{{site.data.var.ct}}` package to run functional tests in the Docker environment. Functional tests are in the `src/Test/Functional/Acceptance` folder. See an example in the [ece-tools repository](https://github.com/magento/ece-tools/tree/develop/src/Test/Functional/Acceptance). | ||
|
||
## Prerequisites | ||
|
||
Before you run functional tests, you must prepare your environment with the following steps. | ||
|
||
1. Stop all services that use the following ports: | ||
|
||
- `80`—varnish | ||
- `443`—web, tls | ||
- `3306`—apache, mysql | ||
|
||
1. Switch to the preferred PHP version for running tests. | ||
|
||
1. Update the project dependencies. | ||
|
||
```bash | ||
composer update | ||
``` | ||
|
||
1. Add credentials to the Docker environment. | ||
|
||
```bash | ||
echo "COMPOSER_MAGENTO_USERNAME=your_public_key" >> ./.docker/composer.env | ||
``` | ||
|
||
```bash | ||
echo "COMPOSER_MAGENTO_PASSWORD=your_private_key" >> ./.docker/composer.env | ||
``` | ||
|
||
## Run tests | ||
|
||
The `codeception.dist.yml` file in the `{{site.data.var.ct}}` root directory contains the global testing configuration. See the [`{{site.data.var.ct}}` repository](https://github.com/magento/ece-tools/blob/develop/codeception.dist.yml). | ||
|
||
By default, functional tests produce a short output. You can receive a more detailed output by editing the `codeception.dist.yml` file to set the `printOutput:` property to `true`. | ||
|
||
```yaml | ||
modules: | ||
config: | ||
Magento\MagentoCloud\Test\Functional\Codeception\Docker: | ||
... | ||
printOutput: true | ||
``` | ||
{:.no-copy} | ||
|
||
### Run a specific test | ||
|
||
Use the following command format to run a specific functional test: | ||
|
||
```bash | ||
./vendor/bin/codecept run Acceptance <TestName>Cest | ||
``` | ||
|
||
For example, the following test verifies that the post-deploy task runs successfully. | ||
|
||
```bash | ||
./vendor/bin/codecept run Acceptance PostDeployCest | ||
``` | ||
|
||
Sample response: | ||
|
||
```terminal | ||
Codeception PHP Testing Framework v2.5.6 | ||
Powered by PHPUnit 6.5.14 by Sebastian Bergmann and contributors. | ||
Running with seed: | ||
Acceptance Tests (1) ----------------------------------------------------------------------------------------------- | ||
-------------------------------------------------------------------------------------------------------------------- | ||
------------------------------------------------------------------------------- | ||
PostDeployCest: Test post deploy | {"ADMIN_EMAIL":"admin@example.com"} | ||
[Magento\MagentoCloud\Test\Functional\Robo\Tasks\GenerateDockerCompose] Running ./bin/ece-tools docker:build | ||
--mode=functional --php=7.2 | ||
... | ||
... | ||
✔ PostDeployCest: Test post deploy | {"ADMIN_EMAIL":"admin@example.com"} (210.41s) | ||
``` | ||
{: .no-copy} | ||
|
||
### Run all tests | ||
|
||
The following list provides the commands to run all available tests for each version of PHP. | ||
|
||
- **PHP 7.0** | ||
|
||
```bash | ||
./vendor/bin/codecept run -g php70 --steps | ||
``` | ||
|
||
- **PHP 7.1** | ||
|
||
```bash | ||
./vendor/bin/codecept run -g php71 --steps | ||
``` | ||
|
||
- **PHP 7.2** | ||
|
||
```bash | ||
./tests/travis/prepare_functional_parallel.sh | ||
``` | ||
|
||
```bash | ||
./vendor/bin/codecept run -g php72parallel_1 --steps | ||
``` | ||
|
||
```bash | ||
./vendor/bin/codecept run -g php72parallel_2 --steps | ||
``` | ||
|
||
```bash | ||
./vendor/bin/codecept run -g php72parallel_3 --steps | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
--- | ||
group: cloud-guide | ||
title: Functional testing in Docker | ||
functional_areas: | ||
- Cloud | ||
- Docker | ||
- Configuration | ||
--- | ||
|
||
You can use the `{{site.data.var.ct}}` package to run functional tests in the Docker environment. Functional tests are in the `src/Test/Functional/Acceptance` folder. See an example in the [ece-tools repository](https://github.com/magento/ece-tools/tree/develop/src/Test/Functional/Acceptance). | ||
|
||
## Prerequisites | ||
|
||
Before you run functional tests, you must prepare your environment with the following steps. | ||
|
||
1. Stop all services that use the following ports: | ||
|
||
- `80`—varnish | ||
- `443`—web, tls | ||
- `3306`—apache, mysql | ||
|
||
1. Switch to the preferred PHP version for running tests. | ||
|
||
1. Update the project dependencies. | ||
|
||
```bash | ||
composer update | ||
``` | ||
|
||
1. Add credentials to the Docker environment. | ||
|
||
```bash | ||
echo "COMPOSER_MAGENTO_USERNAME=your_public_key" >> ./.docker/composer.env | ||
``` | ||
|
||
```bash | ||
echo "COMPOSER_MAGENTO_PASSWORD=your_private_key" >> ./.docker/composer.env | ||
``` | ||
|
||
## Run tests | ||
|
||
The `codeception.dist.yml` file in the `{{site.data.var.ct}}` root directory contains the global testing configuration. See the [`{{site.data.var.ct}}` repository](https://github.com/magento/ece-tools/blob/develop/codeception.dist.yml). | ||
|
||
By default, functional tests produce a short output. You can receive a more detailed output by editing the `codeception.dist.yml` file to set the `printOutput:` property to `true`. | ||
|
||
```yaml | ||
modules: | ||
config: | ||
Magento\MagentoCloud\Test\Functional\Codeception\Docker: | ||
... | ||
printOutput: true | ||
``` | ||
{:.no-copy} | ||
|
||
### Run a specific test | ||
|
||
Use the following command format to run a specific functional test: | ||
|
||
```bash | ||
./vendor/bin/codecept run Acceptance <TestName>Cest | ||
``` | ||
|
||
For example, the following test verifies that the post-deploy task runs successfully. | ||
|
||
```bash | ||
./vendor/bin/codecept run Acceptance PostDeployCest | ||
``` | ||
|
||
Sample response: | ||
|
||
```terminal | ||
Codeception PHP Testing Framework v2.5.6 | ||
Powered by PHPUnit 6.5.14 by Sebastian Bergmann and contributors. | ||
Running with seed: | ||
Acceptance Tests (1) ----------------------------------------------------------------------------------------------- | ||
-------------------------------------------------------------------------------------------------------------------- | ||
------------------------------------------------------------------------------- | ||
PostDeployCest: Test post deploy | {"ADMIN_EMAIL":"admin@example.com"} | ||
[Magento\MagentoCloud\Test\Functional\Robo\Tasks\GenerateDockerCompose] Running ./bin/ece-tools docker:build | ||
--mode=functional --php=7.2 | ||
... | ||
... | ||
✔ PostDeployCest: Test post deploy | {"ADMIN_EMAIL":"admin@example.com"} (210.41s) | ||
``` | ||
{: .no-copy} | ||
|
||
### Run all tests | ||
|
||
The following list provides the commands to run all available tests for each version of PHP. | ||
|
||
- **PHP 7.0** | ||
|
||
```bash | ||
./vendor/bin/codecept run -g php70 --steps | ||
``` | ||
|
||
- **PHP 7.1** | ||
|
||
```bash | ||
./vendor/bin/codecept run -g php71 --steps | ||
``` | ||
|
||
- **PHP 7.2** | ||
|
||
```bash | ||
./tests/travis/prepare_functional_parallel.sh | ||
``` | ||
|
||
```bash | ||
./vendor/bin/codecept run -g php72parallel_1 --steps | ||
``` | ||
|
||
```bash | ||
./vendor/bin/codecept run -g php72parallel_2 --steps | ||
``` | ||
|
||
```bash | ||
./vendor/bin/codecept run -g php72parallel_3 --steps | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../v2.2/cloud/docker/docker-development-testing.md |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be helpful to provide hint here --Consider providing link to Versions, or provide example command