testing – Running functional / browser tests in Docker + Traefik + TLS

Disclaimer: I am new to Drupal / PHP tests.

I am experiencing connectivity issues while running functional tests on my local Drupal 8 environment.

My environment consists of two services that I manage via Docker Compose and a Traefik proxy container.

The Apache / PHP 7.1 container from Alpine Linux (v3.7) (I only show elements that I find relevant):

external: true
external: false

            DOCUMENT_ROOT: / var / www / localhost / web
PHP_IDE_CONFIG: "serverName = d8test.docker.localhost"
- internal
- traefik_webgateway
- traefik.backend = d8test
- traefik.frontend.rule = d8test.docker.localhost
- traefik.docker.network = traefik_webgateway
- traefik.port = 80

The Traefik container:

image: traefik: last
command: --entryPoints = & # 39; Name: http Address :: 80 & # 39; --entryPoints = & # 39; Name: https Address :: 443 TLS: /ssl/localhost.crt,/ssl/localhost.key' --defaultEntryPoints = http, https --docker --docker.domain = docker.localhost --docker.watch --logLevel = Debug --api
- Web portal
- "80:80"
- "8080: 8080"
- "443: 443"
- /var/run/docker.sock:/var/run/docker.sock
- ./ssl:/ssl
- ./traefik.toml:/traefik.toml

Web portal:
driver: bridge

In my traefik.toml file, the following options are defined:


endpoint = "unix: ///var/run/docker.sock"
domain = "docker.localhost"
watch = true
dashboard = true
exposedbydefault = false
swarmmode = false

In my phpunit.xml, I configured the following:

Unit and kernel tests seem to work well, but when I try to create a simple functional test (BrowserTestBase extension), and then run it from the d8test container (apache / php), the message d & rsquo; Following error in the poster:

Drupal Tests jj_login Functional LoginTest :: testStuff
GuzzleHttp Exception ConnectException: error cURL 35:
error: 1400410B: SSL Routines: CONNECT_CR_SRVR_HELLO: Incorrect Version Number
(see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

I've tried changing the URL value of SIMPLETEST_BASE_URL, I have tried different ports, http and https, but I usually get the error below:

curl: (7) Can not connect to [url] Harbor [port]: Connection refused.

I suspect that my problem has something to do with Traefik requiring a valid certificate (I've generated a self-signed certificate that I use to access the site in Chrome / FF), but I'm really not sure to know if going in the right direction here, maybe I miss something more fundamental. Any help would be appreciated.