chore: add favicon for the web page (#316)
Co-authored-by: rick <LinuxSuRen@users.noreply.github.com>
This commit is contained in:
parent
105cea6caf
commit
ba51c74b33
|
@ -54,6 +54,9 @@ jobs:
|
||||||
sudo atest service install
|
sudo atest service install
|
||||||
sudo atest service restart
|
sudo atest service restart
|
||||||
sudo atest service status
|
sudo atest service status
|
||||||
|
|
||||||
|
# make test-ui-e2e
|
||||||
|
|
||||||
atest run -p '.github/testing/*.yaml' --request-ignore-error --report github --report-file bin/report.json --report-github-repo linuxsuren/api-testing --report-github-pr ${{ github.event.number }}
|
atest run -p '.github/testing/*.yaml' --request-ignore-error --report github --report-file bin/report.json --report-github-repo linuxsuren/api-testing --report-github-pr ${{ github.event.number }}
|
||||||
sudo atest service status
|
sudo atest service status
|
||||||
sudo atest service stop
|
sudo atest service stop
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -95,7 +95,7 @@ testlong:
|
||||||
test-ui:
|
test-ui:
|
||||||
cd console/atest-ui && npm run test:unit
|
cd console/atest-ui && npm run test:unit
|
||||||
test-ui-e2e:
|
test-ui-e2e:
|
||||||
cd console/atest-ui && npm run test:e2e
|
cd console/atest-ui && npm i && npm run test:e2e
|
||||||
test-collector:
|
test-collector:
|
||||||
go test github.com/linuxsuren/api-testing/extensions/collector/./... -cover -v -coverprofile=collector-coverage.out
|
go test github.com/linuxsuren/api-testing/extensions/collector/./... -cover -v -coverprofile=collector-coverage.out
|
||||||
go tool cover -func=collector-coverage.out
|
go tool cover -func=collector-coverage.out
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
|
@ -255,6 +255,7 @@ func (o *serverOption) runE(cmd *cobra.Command, args []string) (err error) {
|
||||||
mux.HandlePath(http.MethodGet, "/", frontEndHandlerWithLocation(o.consolePath))
|
mux.HandlePath(http.MethodGet, "/", frontEndHandlerWithLocation(o.consolePath))
|
||||||
mux.HandlePath(http.MethodGet, "/assets/{asset}", frontEndHandlerWithLocation(o.consolePath))
|
mux.HandlePath(http.MethodGet, "/assets/{asset}", frontEndHandlerWithLocation(o.consolePath))
|
||||||
mux.HandlePath(http.MethodGet, "/healthz", frontEndHandlerWithLocation(o.consolePath))
|
mux.HandlePath(http.MethodGet, "/healthz", frontEndHandlerWithLocation(o.consolePath))
|
||||||
|
mux.HandlePath(http.MethodGet, "/favicon.ico", frontEndHandlerWithLocation(o.consolePath))
|
||||||
mux.HandlePath(http.MethodGet, "/get", o.getAtestBinary)
|
mux.HandlePath(http.MethodGet, "/get", o.getAtestBinary)
|
||||||
|
|
||||||
postRequestProxyFunc := postRequestProxy(o.skyWalking)
|
postRequestProxyFunc := postRequestProxy(o.skyWalking)
|
||||||
|
@ -340,6 +341,9 @@ func frontEndHandlerWithLocation(consolePath string) func(w http.ResponseWriter,
|
||||||
case strings.HasSuffix(target, ".css"):
|
case strings.HasSuffix(target, ".css"):
|
||||||
content = uiResourceCSS
|
content = uiResourceCSS
|
||||||
customHeader[util.ContentType] = "text/css"
|
customHeader[util.ContentType] = "text/css"
|
||||||
|
case strings.HasSuffix(target, ".ico"):
|
||||||
|
content = uiResourceIcon
|
||||||
|
customHeader[util.ContentType] = "image/x-icon"
|
||||||
}
|
}
|
||||||
|
|
||||||
if content != "" {
|
if content != "" {
|
||||||
|
@ -447,3 +451,6 @@ var uiResourceCSS string
|
||||||
|
|
||||||
//go:embed data/index.html
|
//go:embed data/index.html
|
||||||
var uiResourceIndex string
|
var uiResourceIndex string
|
||||||
|
|
||||||
|
//go:embed data/favicon.ico
|
||||||
|
var uiResourceIcon string
|
||||||
|
|
|
@ -117,6 +117,15 @@ func TestFrontEndHandlerWithLocation(t *testing.T) {
|
||||||
assert.Equal(t, expect404, resp.GetBody().String())
|
assert.Equal(t, expect404, resp.GetBody().String())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.Run("favicon", func(t *testing.T) {
|
||||||
|
req, err := http.NewRequest(http.MethodGet, "/favicon.ico", nil)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
resp := newFakeResponseWriter()
|
||||||
|
handler(resp, req, map[string]string{})
|
||||||
|
assert.Equal(t, "image/x-icon", resp.Header().Get(util.ContentType))
|
||||||
|
})
|
||||||
|
|
||||||
t.Run("healthz", func(t *testing.T) {
|
t.Run("healthz", func(t *testing.T) {
|
||||||
req, err := http.NewRequest(http.MethodGet, "/healthz", nil)
|
req, err := http.NewRequest(http.MethodGet, "/healthz", nil)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
|
@ -4,10 +4,26 @@ import { defineConfig } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||||
|
|
||||||
|
function removeDataTestAttrs(node) {
|
||||||
|
if (node.type === 1 /* NodeTypes.ELEMENT */) {
|
||||||
|
node.props = node.props.filter(prop =>
|
||||||
|
prop.type === 6 /* NodeTypes.ATTRIBUTE */
|
||||||
|
? prop.name !== 'test-id'
|
||||||
|
: true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue({
|
||||||
|
template: {
|
||||||
|
compilerOptions: {
|
||||||
|
nodeTransforms: true ? [removeDataTestAttrs] : [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
vueJsx(),
|
vueJsx(),
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
|
|
|
@ -286,3 +286,10 @@ items:
|
||||||
request:
|
request:
|
||||||
api: |
|
api: |
|
||||||
{{.param.server}}/debug/pprof/cmdline
|
{{.param.server}}/debug/pprof/cmdline
|
||||||
|
- name: favicon
|
||||||
|
request:
|
||||||
|
api: |
|
||||||
|
{{ .param.server }}/favicon.ico
|
||||||
|
expect:
|
||||||
|
header:
|
||||||
|
Content-Type: image/x-icon
|
||||||
|
|
Loading…
Reference in New Issue