Copilot commented on code in PR #12683:
URL: https://github.com/apache/apisix/pull/12683#discussion_r2438252100
##########
t/cli/test_admin_ui.sh:
##########
@@ -69,19 +80,30 @@ if [ ! $code -eq 200 ]; then
exit 1
fi
-## check /ui/assets/test.js accessible
+## check /ui/assets/*.js accessible
+
+js_file=$(find ui/assets -name "*.js" | head -n 1)
+code=$(curl -v -k -i -m 20 -o /dev/null -s -w %{http_code}
http://127.0.0.1:9180/ui/assets/${js_file})
Review Comment:
The `js_file` variable contains the full path (e.g., `ui/assets/file.js`),
but it's being appended to a URL that already includes `ui/assets/`. This will
result in an incorrect URL like
`http://127.0.0.1:9180/ui/assets/ui/assets/file.js`. Extract only the basename
using `basename \"$js_file\"`.
##########
t/cli/test_admin_ui.sh:
##########
@@ -69,19 +80,30 @@ if [ ! $code -eq 200 ]; then
exit 1
fi
-## check /ui/assets/test.js accessible
+## check /ui/assets/*.js accessible
+
+js_file=$(find ui/assets -name "*.js" | head -n 1)
+code=$(curl -v -k -i -m 20 -o /dev/null -s -w %{http_code}
http://127.0.0.1:9180/ui/assets/${js_file})
+if [ ! $code -eq 200 ]; then
+ echo "failed: ${js_file} not accessible"
+ exit 1
+fi
+
+## check /ui/assets/*.css accessible
-code=$(curl -v -k -i -m 20 -o /dev/null -s -w %{http_code}
http://127.0.0.1:9180/ui/assets/test.js)
+css_file=$(find ui/assets -name "*.css" | head -n 1)
+code=$(curl -v -k -i -m 20 -o /dev/null -s -w %{http_code}
http://127.0.0.1:9180/ui/assets/${css_file})
Review Comment:
The `css_file` variable contains the full path (e.g., `ui/assets/file.css`),
but it's being appended to a URL that already includes `ui/assets/`. This will
result in an incorrect URL. Extract only the basename using `basename
\"$css_file\"`.
```suggestion
css_basename=$(basename "$css_file")
code=$(curl -v -k -i -m 20 -o /dev/null -s -w %{http_code}
http://127.0.0.1:9180/ui/assets/${css_basename})
```
##########
t/cli/test_admin_ui.sh:
##########
@@ -69,19 +80,30 @@ if [ ! $code -eq 200 ]; then
exit 1
fi
-## check /ui/assets/test.js accessible
+## check /ui/assets/*.js accessible
+
+js_file=$(find ui/assets -name "*.js" | head -n 1)
+code=$(curl -v -k -i -m 20 -o /dev/null -s -w %{http_code}
http://127.0.0.1:9180/ui/assets/${js_file})
+if [ ! $code -eq 200 ]; then
+ echo "failed: ${js_file} not accessible"
+ exit 1
+fi
+
+## check /ui/assets/*.css accessible
-code=$(curl -v -k -i -m 20 -o /dev/null -s -w %{http_code}
http://127.0.0.1:9180/ui/assets/test.js)
+css_file=$(find ui/assets -name "*.css" | head -n 1)
+code=$(curl -v -k -i -m 20 -o /dev/null -s -w %{http_code}
http://127.0.0.1:9180/ui/assets/${css_file})
if [ ! $code -eq 200 ]; then
- echo "failed: /ui/assets/test.js not accessible"
+ echo "failed: ${css_file} not accessible"
exit 1
fi
-## check /ui/assets/test.css accessible
+## check /ui/assets/*.svg accessible
-code=$(curl -v -k -i -m 20 -o /dev/null -s -w %{http_code}
http://127.0.0.1:9180/ui/assets/test.css)
+svg_file=$(find ui/assets -name "*.svg" | head -n 1)
Review Comment:
The `svg_file` variable contains the full path (e.g., `ui/assets/file.svg`),
but it's being appended to a URL that already includes `ui/assets/`. This will
result in an incorrect URL. Extract only the basename using `basename
\"$svg_file\"`.
```suggestion
svg_file=$(find ui/assets -name "*.svg" | head -n 1)
svg_file=$(basename "$svg_file")
```
##########
t/cli/test_admin_ui.sh:
##########
@@ -31,6 +31,22 @@ if [ ! $? -eq 0 ]; then
exit 1
fi
+# build apisix-dashboard
+corepack enable pnpm
+
+## prepare apisix-dashboard source code
+source .requirements
+git clone --revision=${APISIX_DASHBOARD_COMMIT} --depth 1
https://github.com/apache/apisix-dashboard.git
+pushd apisix-dashboard
+
Review Comment:
The `--revision` flag is not a valid git clone option. Use `--branch` for
branches/tags or clone first then checkout the specific commit.
```suggestion
git clone --depth 1 https://github.com/apache/apisix-dashboard.git
pushd apisix-dashboard
git checkout ${APISIX_DASHBOARD_COMMIT}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]