Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 48787c0

Browse files
committed
MAGECLOUD-3684 add functional testing
1 parent 236e6be commit 48787c0

File tree

4 files changed

+150
-27
lines changed

4 files changed

+150
-27
lines changed

_data/toc/cloud-guide.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ pages:
108108
- label: Connect to the database
109109
url: /cloud/docker/docker-database.html
110110

111+
- label: Functional testing in Docker
112+
url: /cloud/docker/docker-development-testing.html
113+
111114
- label: Docker quick reference
112115
url: /cloud/docker/docker-quick-reference.html
113116

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
group: cloud-guide
3+
title: Functional testing in Docker
4+
functional_areas:
5+
- Cloud
6+
- Docker
7+
- Configuration
8+
---
9+
10+
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).
11+
12+
## Prerequisites
13+
14+
Before you run functional tests, you must prepare your environment with the following steps.
15+
16+
1. Stop all services that use the following ports:
17+
18+
- `80`—varnish
19+
- `443`—web, tls
20+
- `3306`—apache, mysql
21+
22+
1. Switch to the preferred PHP version for running tests.
23+
24+
1. Update the project dependencies.
25+
26+
```bash
27+
composer update
28+
```
29+
30+
1. Add credentials to the Docker environment.
31+
32+
```bash
33+
echo "COMPOSER_MAGENTO_USERNAME=your_public_key" >> ./.docker/composer.env
34+
```
35+
36+
```bash
37+
echo "COMPOSER_MAGENTO_PASSWORD=your_private_key" >> ./.docker/composer.env
38+
```
39+
40+
## Run tests
41+
42+
By default, tests produce a short output. If you need a more detailed output, you can edit the `codeception.dist.yml` file and set the `printOutput:` property to `true`. !!! need location and example of `codeception.dist.yml`
43+
44+
### Run a specific test
45+
46+
Use the following format to run a specific functional test:
47+
48+
```bash
49+
./vendor/bin/codecept run Acceptance <TestName>Cest
50+
```
51+
52+
For example, the following runs a test on the post deploy...explain more here...
53+
54+
```bash
55+
./vendor/bin/codecept run Acceptance PostDeployCest
56+
```
57+
58+
Sample response:
59+
60+
```terminal
61+
Need sample output here.
62+
```
63+
{: .no-copy}
64+
65+
### Run all tests
66+
67+
The following lists the scripts to run all tests for each version of PHP.
68+
69+
- **PHP 7.0**
70+
71+
```bash
72+
./vendor/bin/codecept run -g php70 --steps
73+
```
74+
75+
- **PHP 7.1**
76+
77+
```bash
78+
./vendor/bin/codecept run -g php71 --steps
79+
```
80+
81+
- **PHP 7.2**
82+
83+
```bash
84+
./tests/travis/prepare_functional_parallel.sh
85+
```
86+
87+
```bash
88+
./vendor/bin/codecept run -g php72parallel_1 --steps
89+
```
90+
91+
```bash
92+
./vendor/bin/codecept run -g php72parallel_2 --steps
93+
```
94+
95+
```bash
96+
./vendor/bin/codecept run -g php72parallel_3 --steps
97+
```

guides/v2.1/cloud/docker/docker-development.md

Lines changed: 48 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,27 @@ functional_areas:
99

1010
{{site.data.var.ece}} provides a Docker environment option for those who use their local environment for development, test, or automation tasks. The {{site.data.var.ece}} Docker environment requires three, essential components: a {{site.data.var.ee}} v2 template, Docker Compose, and the {{site.data.var.ece}} `{{site.data.var.ct}}` package. See the instructions in [Launch Docker]({{page.baseurl}}/cloud/docker/docker-config.html).
1111

12-
The [Magento Cloud Docker repository](https://github.com/magento/magento-cloud-docker) contains build information for the following Docker images:
12+
The [Magento Cloud Docker repository](https://github.com/magento/magento-cloud-docker) contains build information for the following Docker containers.
1313

14-
Image | Docker link
15-
:------------------ | :-------------------------------------------
16-
**DB** | [mariadb:10.0](https://hub.docker.com/_/mariadb)
17-
**FPM**<br>PHP-CLI: version 7<br>PHP-FPM: version 7 | [magento/magento-cloud-docker-php](https://hub.docker.com/r/magento/magento-cloud-docker-php)
18-
**ElasticSearch** | [magento/magento-cloud-docker-elasticsearch](https://hub.docker.com/r/magento/magento-cloud-docker-elasticsearch)
19-
**NGINX** |[magento/magento-cloud-docker-nginx](https://hub.docker.com/r/magento/magento-cloud-docker-nginx)
20-
**Node** | [official Node Docker image](https://hub.docker.com/_/node/)
21-
**RabbitMQ** | [rabbitmq](https://hub.docker.com/_/rabbitmq)
22-
**Redis** | [magento/magento-cloud-docker-redis](https://hub.docker.com/r/magento/magento-cloud-docker-redis)
23-
**TLS** | [magento/magento-cloud-docker-tls](https://hub.docker.com/r/magento/magento-cloud-docker-tls)
24-
**Varnish** | [magento/magento-cloud-docker-varnish](https://hub.docker.com/r/magento/magento-cloud-docker-varnish)
14+
## Database container
2515

26-
{:.bs-callout .bs-callout-info}
27-
See the [service version values available]({{page.baseurl}}/cloud/docker/docker-config.html) for use when launching Docker.
16+
The database container is based on the [mariadb](https://hub.docker.com/_/mariadb) image.
2817

29-
## Web container
18+
- Port: 3306
19+
- Volumes:
20+
- `/var/lib/mysql`
21+
- `./docker/mysql`
22+
23+
#### To import a database dump:
3024

31-
The web container works with the [PHP-FPM](https://php-fpm.org) to serve PHP code, the **DB** image for the local database, and the **Varnish** image to send requests and cache the results.
25+
Place the SQL file into the `.docker/mysql/docker-entrypoint-initdb.d` folder.
26+
27+
The `{{site.data.var.ct}}` package imports and processes the SQL file the next time you build and start the Docker environment using the `docker-compose up` command.
28+
29+
Although it is a more complex approach, you can use GZIP by _sharing_ the `.sql.gz` file using the `.docker/mnt` directory and importing it inside the Docker container.
3230

3331
## CLI containers
32+
**FPM**<br>PHP-CLI: version 7<br>PHP-FPM: version 7 | [magento/magento-cloud-docker-php](https://hub.docker.com/r/magento/magento-cloud-docker-php)
3433

3534
The following CLI containers, which are based on a PHP-CLI image, provide `magento-cloud` and `{{site.data.var.ct}}` commands to perform file system operations:
3635

@@ -56,7 +55,7 @@ The configured state is not ideal
5655
```
5756
{: .no-copy}
5857

59-
## Cron container
58+
### Cron container
6059

6160
The Cron container is based on PHP-CLI images, and executes operations in the background immediately after the Docker environment start. It uses the cron configuration defined in the [`crons` property of the `.magento.app.yaml` file]({{page.baseurl}}/cloud/project/project-conf-files_magento-app.html#crons).
6261

@@ -66,28 +65,50 @@ The Cron container is based on PHP-CLI images, and executes operations in the ba
6665
docker-compose run deploy bash -c "cat /app/var/cron.log"
6766
```
6867

69-
## Node Container
68+
### Node container
7069

71-
The Node container is based on the [official Node Docker image](https://hub.docker.com/_/node/). It can be used to install NPM dependencies or run any Node-based command line tools.
70+
The Node container is based on the [official Node Docker image](https://hub.docker.com/_/node/). It can be used to install NPM dependencies, such as [Gulp](), or run any Node-based command line tools.
7271

73-
## Database container
72+
## PHP-FPM container
7473

75-
The database container is based on the `mariadb:10` image.
74+
The PHP-FPM container is based on the [magento/magento-cloud-docker-php](https://hub.docker.com/r/magento/magento-cloud-docker-php) image.
7675

77-
#### To import a database dump:
76+
- Port: 9000
77+
- Read-only volumes:
78+
- `/app`
79+
- `/app/vendor`
80+
- `/app/generated`
81+
- `/app/setup`
82+
- Read/Write volumes:
83+
- `/app/var`
84+
- `/app/app/etc`
85+
- `/app/pub/static`
86+
- `/app/pub/media`
7887

79-
Place the SQL file into the `.docker/mysql/docker-entrypoint-initdb.d` folder.
88+
### Web container
8089

81-
The `{{site.data.var.ct}}` package imports and processes the SQL file the next time you build and start the Docker environment using the `docker-compose up` command.
90+
The web container works with the [PHP-FPM](https://php-fpm.org) to serve PHP code, the [**DB** image](#database-container) for the local database, and the **Varnish** image to send requests and cache the results.
8291

83-
Although it is a more complex approach, you can use GZIP by _sharing_ the `.sql.gz` file using the `.docker/mnt` directory and importing it inside the Docker container.
92+
### Varnish container
8493

85-
## Varnish container
94+
The Varnish container is based on the [magento/magento-cloud-docker-varnish](https://hub.docker.com/r/magento/magento-cloud-docker-varnish) image. Varnish works on port 80.
8695

87-
The Varnish container is based on the `magento-cloud-docker-varnish` image. Varnish works on port 80.
96+
### TLS container
8897

8998
The TLS termination proxy container, based on the [magento/magento-cloud-docker-tls](https://hub.docker.com/r/magento/magento-cloud-docker-tls) image, facilitates the Varnish SSL termination over HTTPS.
9099

100+
## Service containers
101+
102+
Service | Image
103+
------- | -----
104+
**ElasticSearch** | [magento/magento-cloud-docker-elasticsearch](https://hub.docker.com/r/magento/magento-cloud-docker-elasticsearch)
105+
**NGINX** | [magento/magento-cloud-docker-nginx](https://hub.docker.com/r/magento/magento-cloud-docker-nginx)
106+
**RabbitMQ** | [rabbitmq](https://hub.docker.com/_/rabbitmq)
107+
**Redis** | [magento/magento-cloud-docker-redis](https://hub.docker.com/r/magento/magento-cloud-docker-redis)
108+
109+
{:.bs-callout .bs-callout-info}
110+
See the [service version values available]({{page.baseurl}}/cloud/docker/docker-config.html) for use when launching Docker.
111+
91112
## Sharing data between host machine and container
92113

93114
You can share files easily between your machine and a Docker container by placing the files in the `.docker/mnt` directory. You can find the files in the `/mnt` directory the next time you build and start the Docker environment using the `docker-compose up` command.

guides/v2.1/cloud/release-notes/cloud-tools.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ The release notes include:
3535

3636
- {:.new}<!-- MAGECLOUD-3451 -->Added a new command to the `{{site.data.var.ct}}` package that displays environment services, routes, or variables. See [Services, routes, and variable]({{page.baseurl}}/cloud/reference/ece-tools-reference.html#services-routes-and-variables). [Feature submitted by Vladimir Kerkhoff](https://github.com/magento/ece-tools/pull/486).
3737

38+
- {:.new}<!-- MAGECLOUD-3129/3684 -->You can now perform functional testing using the `{{site.data.var.ct}}` package in the Docker environment. See [Functional testing in Docker]({{page.baseurl}}/cloud/docker/docker-development-testing.html).
39+
3840
## v2002.0.19
3941

4042
- {:.fix}<!-- MAGECLOUD-3668 -->Fixed an issue that overwrites the `env.php` file during a deploy, resulting in a loss of custom configurations. This update ensures that {{site.data.var.ece}} updates the `env.php` file with every deployment, while preserving custom configurations.

0 commit comments

Comments
 (0)