Replace mosquitto service containers with detached process startup (#1000)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: thomasnordquist <7721625+thomasnordquist@users.noreply.github.com>
This commit is contained in:
Copilot
2025-12-24 14:59:11 +01:00
committed by GitHub
parent 4eb58df233
commit 6612e10a66
3 changed files with 43 additions and 39 deletions

View File

@@ -34,24 +34,25 @@ jobs:
TESTS_MQTT_BROKER_HOST: localhost TESTS_MQTT_BROKER_HOST: localhost
TESTS_MQTT_BROKER_PORT: 1883 TESTS_MQTT_BROKER_PORT: 1883
services:
# MQTT broker for testing
mosquitto:
image: ghcr.io/thomasnordquist/mqtt-explorer-ui-tests:latest
ports:
- 1883:1883
entrypoint: /bin/sh
args: ["-c", "mosquitto -c /etc/mosquitto/conf.d/default.conf"]
options: >-
--health-cmd "mosquitto_sub -t '$SYS/#' -C 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install and Start Mosquitto
run: |
sudo apt-get update
sudo apt-get install -y mosquitto mosquitto-clients
# Create a minimal configuration file for testing
sudo tee /etc/mosquitto/conf.d/test.conf > /dev/null <<EOF
listener 1883
allow_anonymous true
persistence false
EOF
# Start mosquitto in detached mode
sudo mosquitto -c /etc/mosquitto/mosquitto.conf -d
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3

View File

@@ -174,22 +174,24 @@ jobs:
env: env:
TESTS_MQTT_BROKER_HOST: localhost TESTS_MQTT_BROKER_HOST: localhost
TESTS_MQTT_BROKER_PORT: 1883 TESTS_MQTT_BROKER_PORT: 1883
services:
mosquitto:
image: ghcr.io/thomasnordquist/mqtt-explorer-ui-tests:latest
ports:
- 1883:1883
entrypoint: /bin/sh
args: ["-c", "mosquitto -c /etc/mosquitto/conf.d/default.conf"]
options: >-
--health-cmd "mosquitto_sub -t '$SYS/#' -C 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
ref: ${{ github.event.pull_request.head.sha }} ref: ${{ github.event.pull_request.head.sha }}
- name: Install and Start Mosquitto
run: |
sudo apt-get update
sudo apt-get install -y mosquitto mosquitto-clients
# Create a minimal configuration file for testing
sudo tee /etc/mosquitto/conf.d/test.conf > /dev/null <<EOF
listener 1883
allow_anonymous true
persistence false
EOF
# Start mosquitto in detached mode
sudo mosquitto -c /etc/mosquitto/mosquitto.conf -d
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:

View File

@@ -93,20 +93,21 @@ Tests the traditional Electron desktop application:
Tests the new browser/server mode: Tests the new browser/server mode:
- **Environment**: Ubuntu latest with Node.js 24 - **Environment**: Ubuntu latest with Node.js 24
- **Services**: - **MQTT Broker**: Mosquitto v2 on port 1883
- **Mosquitto MQTT Broker**: Eclipse Mosquitto v2 on port 1883 - Started detached with `-d` flag
- Health checks enabled
- Anonymous connections allowed - Anonymous connections allowed
- No persistence
- **Steps**: - **Steps**:
1. Setup Node.js 24 1. Install and start Mosquitto in detached mode
2. Install dependencies 2. Setup Node.js 24
3. Install Playwright browsers (`npx playwright install --with-deps chromium`) 3. Install dependencies
4. Build browser mode (`yarn build:server`) 4. Install Playwright browsers (`npx playwright install --with-deps chromium`)
5. Run unit tests (app + backend) 5. Build browser mode (`yarn build:server`)
6. Start server in background with test credentials 6. Run unit tests (app + backend)
7. Wait for server to be ready 7. Start server in background with test credentials
8. Run browser smoke tests 8. Wait for server to be ready
9. Clean up server process 9. Run browser smoke tests
10. Clean up server process
**Environment Variables**: **Environment Variables**:
- `MQTT_EXPLORER_USERNAME=test` - `MQTT_EXPLORER_USERNAME=test`