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):

        networks:
traefik_webgateway:
external: true
internal:
external: false

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

The Traefik container:

services:
Proxy:
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
networks:
- Web portal
ports:
- "80:80"
- "8080: 8080"
- "443: 443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./ssl:/ssl
- ./traefik.toml:/traefik.toml

networks:
Web portal:
driver: bridge

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

[docker]



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

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.