fair-plugin/tests/sites/docker-compose.base.yml
Chuck Adams 0ed8f2bfa7
refactor: flatten tests/sites/ephemeral/ → tests/sites/
Move everything from tests/sites/ephemeral/ up one level to tests/sites/.
The 'ephemeral' qualifier didn't add value — all sites under tests/sites/
are ephemeral Docker setups by design.

- tests/sites/Dockerfile.wp (shared WP image)
- tests/sites/docker-compose.base.yml (shared template)
- tests/sites/integration/ (WP + mock-server, used by both integration & HTTP)
- tests/sites/browser-test/ (WP + mock-server, used by Playwright)
- tests/sites/mutation/ (PHP 8.5 + Infection, isolated composer.json)

All context and volume mount paths updated for the new depth:
  context: ../../../.. → ../../..
  volumes: ../../../../ → ../../..

bin/run-integration.sh refactored:
- SUITE argument now gates which tests run: 'integration', 'http', or 'all'
- Both integration and http share the integration compose stack
- Separate project names (fair-integration-integration vs fair-integration-http)
  avoid port conflicts when both run in sequence

composer.json:
- test:integration → integration tests only
- test:http → HTTP tests only (own compose cycle)
- test:all chains unit, multisite, integration, http

Verified: test:all exits 0 (262+262+12+12 tests). Browser 15/15 pass.
Signed-off-by: Chuck Adams <chaz@chaz.works>
2026-06-09 16:25:09 -06:00

94 lines
2.7 KiB
YAML

# ────────────────────────────────────────────────────────────────────
# Base Docker Compose for FAIR integration tests.
# Include this from suite-specific compose files.
# ────────────────────────────────────────────────────────────────────
services:
mysql:
image: mariadb:10.6
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress_test
tmpfs:
- /var/lib/mysql
healthcheck:
test: ["CMD", "mariadb-admin", "ping", "--silent"]
interval: 2s
retries: 30
start_period: 5s
networks:
- fair-test-net
wordpress:
build:
context: .
dockerfile: Dockerfile.wp
args:
WORDPRESS_VERSION: "${WORDPRESS_VERSION:-6.4}"
PHP_VERSION: "${PHP_VERSION:-8.0}"
depends_on:
mysql:
condition: service_healthy
mock-server:
condition: service_healthy
environment:
WORDPRESS_DB_HOST: mysql
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: password
WORDPRESS_DB_NAME: wordpress_test
WORDPRESS_TABLE_PREFIX: wptests_
WORDPRESS_CONFIG_EXTRA: |
define('FAIR_DEFAULT_REPO_DOMAIN', 'mock-server:8080');
define('FAIR_PLC_DIRECTORY_URL', 'http://mock-server:8080');
volumes:
- ../../..:/var/www/html/wp-content/plugins/fair-plugin:delegated
- wp-data:/var/www/html
networks:
- fair-test-net
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/"]
interval: 3s
retries: 30
start_period: 10s
wp-cli:
image: "wordpress:cli-php${PHP_VERSION:-8.0}"
command: tail -f /dev/null
depends_on:
wordpress:
condition: service_healthy
volumes:
- ../../..:/var/www/html/wp-content/plugins/fair-plugin:delegated
- wp-data:/var/www/html
user: "33:33"
environment:
WORDPRESS_DB_HOST: mysql
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: password
WORDPRESS_DB_NAME: wordpress_test
WORDPRESS_TABLE_PREFIX: wptests_
networks:
- fair-test-net
healthcheck:
test: ["CMD", "php", "-v"]
interval: 5s
retries: 3
mock-server:
build:
context: ../..
dockerfile: tests/mock-server/Dockerfile
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 2s
retries: 15
start_period: 2s
networks:
- fair-test-net
networks:
fair-test-net:
driver: bridge
volumes:
wp-data: