|
| 1 | +services: |
| 2 | + |
| 3 | + # ── Home Assistant ────────────────────────────────────────────────────────── |
| 4 | + homeassistant: |
| 5 | + image: ghcr.io/home-assistant/home-assistant:stable |
| 6 | + container_name: homeassistant_test |
| 7 | + volumes: |
| 8 | + # Persistent HA config (survives container restarts; start fresh with |
| 9 | + # `docker compose down -v`). |
| 10 | + - ha_config:/config |
| 11 | + # Mount the ssh_docker integration source as a custom component so HA |
| 12 | + # loads it on startup without any extra copy step. |
| 13 | + - ./:/config/custom_components/ssh_docker:ro |
| 14 | + # Mount the ssh_command functional copy (required dependency of ssh_docker). |
| 15 | + - ./tests/playwright/ssh_command:/config/custom_components/ssh_command:ro |
| 16 | + # Startup wrapper that pre-populates /etc/hosts before launching HA. |
| 17 | + # Alpine Linux (musl libc) cannot resolve Docker container hostnames via |
| 18 | + # Python's socket module because of iptables/UDP limitations in this |
| 19 | + # environment. The wrapper uses busybox nslookup (which works) to add |
| 20 | + # entries to /etc/hosts so that all resolver calls succeed via the |
| 21 | + # "files" nsswitch path. |
| 22 | + - ./tests/playwright/ha-init-wrapper.sh:/ha-init-wrapper.sh:ro |
| 23 | + environment: |
| 24 | + - TZ=UTC |
| 25 | + entrypoint: ["/bin/sh", "/ha-init-wrapper.sh"] |
| 26 | + # Clear the external search domain that musl's resolver would try first, |
| 27 | + # which causes timeouts in this Azure-hosted environment. |
| 28 | + dns_search: "." |
| 29 | + restart: unless-stopped |
| 30 | + |
| 31 | + # ── Docker host ───────────────────────────────────────────────────────────── |
| 32 | + # Ubuntu 24.04 container running sshd and a mock Docker CLI. |
| 33 | + # The SSH Docker integration connects here via SSH and issues docker commands. |
| 34 | + # No DinD / privileged mode required — the mock CLI simulates container state |
| 35 | + # using plain files. |
| 36 | + # Credentials: user=foo password=pass |
| 37 | + docker-host: |
| 38 | + build: |
| 39 | + context: tests/playwright |
| 40 | + dockerfile: Dockerfile.dockerhost |
| 41 | + container_name: docker_host |
| 42 | + |
| 43 | + # ── Playwright E2E test runner ────────────────────────────────────────────── |
| 44 | + # Not started by default (`docker compose up`); invoke explicitly: |
| 45 | + # docker compose run --rm playwright-tests |
| 46 | + playwright-tests: |
| 47 | + build: |
| 48 | + context: . |
| 49 | + dockerfile: tests/playwright/Dockerfile |
| 50 | + environment: |
| 51 | + - HOMEASSISTANT_URL=http://homeassistant:8123 |
| 52 | + - DOCKER_HOST_NAME=docker_host |
| 53 | + - SSH_USER=foo |
| 54 | + - SSH_PASSWORD=pass |
| 55 | + - HA_USERNAME=admin |
| 56 | + - HA_PASSWORD=admin |
| 57 | + volumes: |
| 58 | + # Test results (JUnit XML) written here are available on the host after |
| 59 | + # the container exits, e.g. for CI artifact upload. |
| 60 | + - ./playwright-results:/app/playwright-results |
| 61 | + depends_on: |
| 62 | + - homeassistant |
| 63 | + - docker-host |
| 64 | + |
| 65 | +volumes: |
| 66 | + ha_config: |
0 commit comments