Point classic UI at mounted /servers.json in Docker entrypoint (#870)
Some checks failed
Docker / e2e (push) Has been cancelled
Docker / build (./Dockerfile, , ghcr.io/${{ github.repository }}) (push) Has been cancelled
Docker / build (./Dockerfile.alpine, -alpine, ghcr.io/${{ github.repository }}) (push) Has been cancelled

* Initial plan

* Apply remaining changes

Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>

* Apply remaining changes

Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>

* Reuse SERVER_LIST_URL sed block for mounted servers.json

Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>

* Strengthen classic mounted server list E2E assertions

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>
Co-authored-by: Stefan Stidl <sti-github@stidl.com>
This commit is contained in:
Copilot 2026-10-22 07:36:01 +02:00 • committed by GitHub
parent a820d7cdf1
commit 4cf44ad6ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 31 additions and 0 deletions

View file

@ -91,6 +91,8 @@ if [[ "$MODE" == "frontend" || "$MODE" == "dual" || "$MODE" == "standalone" ]];
if [ -f /servers.json ]; then
echo "using mounted /servers.json for server-list.json"
cp /servers.json /var/www/html/server-list.json
# default the frontend list to the mounted file so the classic design uses it too
SERVER_LIST_URL="${SERVER_LIST_URL:-server-list.json}"
elif [ -n "$SERVER_LIST_URL" ]; then
echo "no /servers.json found, relying on SERVER_LIST_URL"
elif [ "$MODE" == "frontend" ]; then

View file

@ -0,0 +1,29 @@
const { test, expect } = require("@playwright/test");
const { baseUrls } = require("./helpers/env");
test.describe("Classic design with mounted server list", () => {
test("frontend classic page loads the mounted server-list.json", async ({ page, request }) => {
const html = await (await request.get(`${baseUrls.frontend}/index-classic.html`)).text();
expect(html).toMatch(/var SPEEDTEST_SERVERS = "server-list\.json";/);
const pageErrors = [];
page.on("pageerror", error => pageErrors.push(error.message));
// This fixture hostname only resolves inside Docker. Keep server selection
// deterministic without mocking the mounted server-list.json response.
await page.route("http://backend-testpoint:8080/empty.php*", route =>
route.fulfill({ status: 200, headers: { "Access-Control-Allow-Origin": "*" }, body: "" })
);
const listResponse = page.waitForResponse(response => response.url().endsWith("/server-list.json"));
await page.goto(`${baseUrls.frontend}/index-classic.html`);
const response = await listResponse;
expect(response.ok()).toBeTruthy();
// Verify the fetched config was applied to the classic server selector.
await expect(page.locator("#server option")).toHaveText(["Backend testpoint"], { timeout: 10_000 });
await expect(page.locator("#startStopBtn")).toBeVisible();
expect(pageErrors).toEqual([]);
});
});