This is an automated email from the ASF dual-hosted git repository.
young pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new 6c24fa939 chore(e2e): use apisix dev image as e2e server base image
(#3229)
6c24fa939 is described below
commit 6c24fa9399af70a31402abb245feabd1a957b55d
Author: YYYoung <[email protected]>
AuthorDate: Fri Oct 17 09:58:19 2025 +0800
chore(e2e): use apisix dev image as e2e server base image (#3229)
---
.devcontainer/docker-compose.yml | 2 +-
.github/workflows/e2e.yml | 7 ++--
e2e/server/Dockerfile | 6 +--
e2e/server/docker-compose.common.yml | 48 ----------------------
e2e/server/docker-compose.yml | 48 ++++++++++++----------
e2e/server/nginx.conf | 36 ----------------
.../stream_routes.show-disabled-error.spec.ts | 5 ++-
e2e/utils/env.ts | 4 +-
src/components/form/Editor.tsx | 2 +-
vite.config.ts | 2 +-
10 files changed, 41 insertions(+), 119 deletions(-)
diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml
index 3180bb90e..f784a1ded 100644
--- a/.devcontainer/docker-compose.yml
+++ b/.devcontainer/docker-compose.yml
@@ -1,6 +1,6 @@
include:
- path:
- - ../e2e/server/docker-compose.common.yml
+ - ../e2e/server/docker-compose.yml
- docker-compose.override.yml
services:
apisix-dashboard:
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index 01aa48dc0..b41569dcd 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -72,14 +72,13 @@ jobs:
- name: Waiting dashboard service to be healthy
working-directory: ./e2e/server
run: |
- E2E_SERVER="dashboard-e2e"
TIMEOUT=30
timeout $TIMEOUT bash -c '
- until [ "$(docker inspect --format="{{.State.Health.Status}}"
$(docker compose ps -q '$E2E_SERVER'))" = "healthy" ]; do
- echo "'$E2E_SERVER' is starting..."
+ until curl -f http://127.0.0.1:9180/ui > /dev/null 2>&1; do
+ echo "Waiting for APISIX dashboard to be ready..."
sleep 5
done
- ' || (echo "$E2E_SERVER not healthy after $TIMEOUT seconds" && exit
1)
+ ' || (echo "APISIX dashboard not ready after $TIMEOUT seconds" &&
exit 1)
- name: Run e2e tests
run: |
diff --git a/e2e/server/Dockerfile b/e2e/server/Dockerfile
index 3d675a471..8bbf363ff 100644
--- a/e2e/server/Dockerfile
+++ b/e2e/server/Dockerfile
@@ -35,6 +35,6 @@ COPY . .
RUN apk add --no-cache git
RUN corepack enable pnpm && pnpm build
-# serve ui
-FROM nginx:1.28.0-alpine-slim AS runner
-COPY --from=builder /app/dist /usr/share/nginx/html
+# embed dashboard ui into apisix
+FROM apache/apisix:dev
+COPY --from=builder /app/dist /usr/local/apisix/ui/
diff --git a/e2e/server/docker-compose.common.yml
b/e2e/server/docker-compose.common.yml
deleted file mode 100644
index 8e7e16401..000000000
--- a/e2e/server/docker-compose.common.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-services:
- apisix:
- image: 'apache/apisix:dev'
- restart: always
- volumes:
- - ./apisix_conf.yml:/usr/local/apisix/conf/config.yaml:ro
- depends_on:
- - etcd
- networks:
- - apisix
-
- etcd:
- image: bitnamilegacy/etcd:3.5
-
- restart: always
- volumes:
- - etcd_data:/bitnami/etcd
- environment:
- ETCD_ENABLE_V2: 'true'
- ALLOW_NONE_AUTHENTICATION: 'yes'
- ETCD_ADVERTISE_CLIENT_URLS: 'http://etcd:2379'
- ETCD_LISTEN_CLIENT_URLS: 'http://0.0.0.0:2379'
- networks:
- - apisix
-
-networks:
- apisix:
- driver: bridge
-
-volumes:
- etcd_data:
diff --git a/e2e/server/docker-compose.yml b/e2e/server/docker-compose.yml
index 0e558a548..6f03847ca 100644
--- a/e2e/server/docker-compose.yml
+++ b/e2e/server/docker-compose.yml
@@ -15,32 +15,38 @@
# limitations under the License.
#
-include:
- - docker-compose.common.yml
services:
- dashboard-e2e:
+ apisix:
build:
context: ../..
dockerfile: e2e/server/Dockerfile
+ restart: always
volumes:
- - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
- networks:
- - apisix
+ - ./apisix_conf.yml:/usr/local/apisix/conf/config.yaml:ro
ports:
- - '6174:6174'
+ - '9180:9180'
depends_on:
+ - etcd
+ networks:
+ - apisix
+
+ etcd:
+ image: bitnamilegacy/etcd:3.5
+
+ restart: always
+ volumes:
+ - etcd_data:/bitnami/etcd
+ environment:
+ ETCD_ENABLE_V2: 'true'
+ ALLOW_NONE_AUTHENTICATION: 'yes'
+ ETCD_ADVERTISE_CLIENT_URLS: 'http://etcd:2379'
+ ETCD_LISTEN_CLIENT_URLS: 'http://0.0.0.0:2379'
+ networks:
- apisix
- healthcheck:
- test:
- [
- 'CMD',
- 'wget',
- '--quiet',
- '--tries=1',
- '--spider',
- 'http://127.0.0.1:6174/ui/',
- ]
- interval: 10s
- timeout: 5s
- retries: 5
- start_period: 10s
+
+networks:
+ apisix:
+ driver: bridge
+
+volumes:
+ etcd_data:
diff --git a/e2e/server/nginx.conf b/e2e/server/nginx.conf
deleted file mode 100644
index 1fde87e09..000000000
--- a/e2e/server/nginx.conf
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-server {
- listen 6174;
-
- location /ui {
- rewrite ^/ui$ /ui/ permanent;
- }
-
- location /ui/ {
- alias /usr/share/nginx/html/;
- index index.html;
- try_files $uri $uri/ /ui/index.html;
- }
-
- location / {
- proxy_pass http://apisix:9180;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- }
-}
diff --git a/e2e/tests/stream_routes.show-disabled-error.spec.ts
b/e2e/tests/stream_routes.show-disabled-error.spec.ts
index 3de2ba253..1b4d8abac 100644
--- a/e2e/tests/stream_routes.show-disabled-error.spec.ts
+++ b/e2e/tests/stream_routes.show-disabled-error.spec.ts
@@ -36,6 +36,7 @@ import path from 'node:path';
import { promisify } from 'node:util';
import { streamRoutesPom } from '@e2e/pom/stream_routes';
+import { env } from '@e2e/utils/env';
import { test } from '@e2e/utils/test';
import { expect } from '@playwright/test';
import { produce, type WritableDraft } from 'immer';
@@ -67,11 +68,11 @@ const updateAPISIXConf = async (
const restartDockerServices = async () => {
await execAsync('docker compose restart apisix', { cwd: getE2EServerDir() });
- const url = 'http://127.0.0.1:6174/ui/';
+ const url = env.E2E_TARGET_URL;
const maxRetries = 20;
const interval = 1000;
for (let i = 0; i < maxRetries; i++) {
- const res = await fetch(url);
+ const res = await fetch(url).catch(() => ({ ok: false }));
if (res.ok) return;
await new Promise((resolve) => setTimeout(resolve, interval));
}
diff --git a/e2e/utils/env.ts b/e2e/utils/env.ts
index 58b6fc6f5..9dfc459d6 100644
--- a/e2e/utils/env.ts
+++ b/e2e/utils/env.ts
@@ -28,8 +28,8 @@ export const env = parseEnv(process.env, {
E2E_TARGET_URL: z
.string()
.url()
- .default(`http://localhost:6174${BASE_PATH}/`)
+ .default(`http://localhost:9180${BASE_PATH}/`)
.describe(
- `If you want to access the test server from dev container playwright to
host e2e server, try http://host.docker.internal:6174${BASE_PATH}/`
+ `If you want to access the test server from dev container playwright to
host e2e server, try http://host.docker.internal:9180${BASE_PATH}/`
),
});
diff --git a/src/components/form/Editor.tsx b/src/components/form/Editor.tsx
index d2832d335..761a5ebd5 100644
--- a/src/components/form/Editor.tsx
+++ b/src/components/form/Editor.tsx
@@ -16,7 +16,7 @@
*/
import { InputWrapper, type InputWrapperProps, Skeleton } from '@mantine/core';
import { Editor } from '@monaco-editor/react';
-import clsx from 'clsx';
+import { clsx } from 'clsx';
import { useEffect, useMemo, useRef, useState } from 'react';
import {
type FieldValues,
diff --git a/vite.config.ts b/vite.config.ts
index 8165d196e..799fdf323 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -41,7 +41,7 @@ export default defineConfig({
// as an example, if you want to use the e2e server as the api server,
proxy: {
[API_PREFIX]: {
- target: 'http://localhost:6174',
+ target: 'http://localhost:9180',
changeOrigin: true,
},
},