mirror of
https://github.com/librespeed/speedtest.git
synced 2026-10-21 15:51:14 +00:00
Fix SERVER_LIST_URL frontend startup
Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>
This commit is contained in:
parent
99248e0d81
commit
bd8ec153cd
6 changed files with 50 additions and 1 deletions
|
|
@ -56,7 +56,7 @@ fi
|
|||
|
||||
|
||||
# Copy servers.json for stability page (frontend/dual modes)
|
||||
if [[ "$MODE" == "frontend" || "$MODE" == "dual" ]]; then
|
||||
if [[ "$MODE" == "frontend" || "$MODE" == "dual" ]] && [ -f /servers.json ]; then
|
||||
cp /servers.json /var/www/html/servers.json
|
||||
fi
|
||||
|
||||
|
|
@ -91,6 +91,11 @@ 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
|
||||
elif [ -n "$SERVER_LIST_URL" ]; then
|
||||
echo "no /servers.json found, relying on SERVER_LIST_URL"
|
||||
elif [ "$MODE" == "frontend" ]; then
|
||||
echo "ERROR: /servers.json not found and SERVER_LIST_URL is not set" >&2
|
||||
exit 1
|
||||
else
|
||||
echo "no /servers.json found, create one for local host"
|
||||
# generate config for just the local server
|
||||
|
|
|
|||
|
|
@ -78,6 +78,19 @@ services:
|
|||
ports:
|
||||
- "18182:8080"
|
||||
|
||||
frontend-remote:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: Dockerfile
|
||||
depends_on:
|
||||
- backend-testpoint
|
||||
environment:
|
||||
- MODE=frontend
|
||||
- WEBPORT=8080
|
||||
- SERVER_LIST_URL=http://127.0.0.1:18184/tests/e2e/fixtures/servers-frontend-remote.json
|
||||
ports:
|
||||
- "18188:8080"
|
||||
|
||||
dual:
|
||||
build:
|
||||
context: ..
|
||||
|
|
|
|||
11
tests/e2e/fixtures/servers-frontend-remote.json
Normal file
11
tests/e2e/fixtures/servers-frontend-remote.json
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[
|
||||
{
|
||||
"name": "Remote frontend backend",
|
||||
"server": "http://127.0.0.1:18181/",
|
||||
"dlURL": "garbage.php",
|
||||
"ulURL": "empty.php",
|
||||
"pingURL": "empty.php",
|
||||
"getIpURL": "getIP.php",
|
||||
"id": 1
|
||||
}
|
||||
]
|
||||
|
|
@ -71,5 +71,6 @@ module.exports = async () => {
|
|||
await waitForReady('standalone-alpine', 'http://127.0.0.1:18187/index.html', timeoutMs);
|
||||
await waitForReady('backend', 'http://127.0.0.1:18181/empty.php', timeoutMs);
|
||||
await waitForReady('frontend', 'http://127.0.0.1:18182/index-modern.html', timeoutMs);
|
||||
await waitForReady('frontend-remote', 'http://127.0.0.1:18188/index-modern.html', timeoutMs);
|
||||
await waitForReady('dual', 'http://127.0.0.1:18183/index-modern.html', timeoutMs);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ const baseUrls = {
|
|||
backend: 'http://127.0.0.1:18181',
|
||||
frontend: 'http://127.0.0.1:18182',
|
||||
dual: 'http://127.0.0.1:18183',
|
||||
frontendRemote: 'http://127.0.0.1:18188',
|
||||
standaloneNew: 'http://127.0.0.1:18185',
|
||||
standaloneApostrophe: 'http://127.0.0.1:18186',
|
||||
standaloneAlpine: 'http://127.0.0.1:18187',
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ const { baseUrls } = require('./helpers/env');
|
|||
const { modernStartButton } = require('./helpers/ui');
|
||||
|
||||
const defaultTagline = 'No Flash, No Java, No Websockets, No Bullsh*t';
|
||||
const frontendRemoteServerListUrl = 'http://127.0.0.1:18184/tests/e2e/fixtures/servers-frontend-remote.json';
|
||||
|
||||
test.describe('Runtime mode smoke coverage', () => {
|
||||
test('standalone exposes UI and local backend endpoints', async ({ page, request }) => {
|
||||
|
|
@ -52,6 +53,23 @@ test.describe('Runtime mode smoke coverage', () => {
|
|||
await expect(page.locator('#selected-server')).not.toHaveText(/searching nearest server/i);
|
||||
});
|
||||
|
||||
test('frontend starts with SERVER_LIST_URL without requiring /servers.json', async ({ page, request }) => {
|
||||
const index = await request.get(`${baseUrls.frontendRemote}/index-modern.html`);
|
||||
expect(index.ok()).toBeTruthy();
|
||||
await expect(await index.text()).toContain(frontendRemoteServerListUrl);
|
||||
|
||||
const stability = await request.get(`${baseUrls.frontendRemote}/stability.html`);
|
||||
expect(stability.ok()).toBeTruthy();
|
||||
await expect(await stability.text()).toContain(frontendRemoteServerListUrl);
|
||||
|
||||
const localBackendEndpoint = await request.get(`${baseUrls.frontendRemote}/backend/empty.php`);
|
||||
expect(localBackendEndpoint.status()).toBe(404);
|
||||
|
||||
await page.goto(`${baseUrls.frontendRemote}/index-modern.html`);
|
||||
await expect(modernStartButton(page)).toBeVisible();
|
||||
await expect(page.locator('#selected-server')).toContainText('Remote frontend backend', { timeout: 10_000 });
|
||||
});
|
||||
|
||||
test('dual combines frontend and local backend availability', async ({ page, request }) => {
|
||||
const serverList = await request.get(`${baseUrls.dual}/server-list.json`);
|
||||
expect(serverList.ok()).toBeTruthy();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue