Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ jobs:
sudo atest service install
sudo atest service restart
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 }}
sudo atest service status
sudo atest service stop
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ testlong:
test-ui:
cd console/atest-ui && npm run test:unit
test-ui-e2e:
cd console/atest-ui && npm run test:e2e
cd console/atest-ui && npm i && npm run test:e2e
test-collector:
go test github.com/linuxsuren/api-testing/extensions/collector/./... -cover -v -coverprofile=collector-coverage.out
go tool cover -func=collector-coverage.out
Expand Down
Binary file added cmd/data/favicon.ico
Binary file not shown.
7 changes: 7 additions & 0 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, "/assets/{asset}", 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)

postRequestProxyFunc := postRequestProxy(o.skyWalking)
Expand Down Expand Up @@ -340,6 +341,9 @@ func frontEndHandlerWithLocation(consolePath string) func(w http.ResponseWriter,
case strings.HasSuffix(target, ".css"):
content = uiResourceCSS
customHeader[util.ContentType] = "text/css"
case strings.HasSuffix(target, ".ico"):
content = uiResourceIcon
customHeader[util.ContentType] = "image/x-icon"
}

if content != "" {
Expand Down Expand Up @@ -447,3 +451,6 @@ var uiResourceCSS string

//go:embed data/index.html
var uiResourceIndex string

//go:embed data/favicon.ico
var uiResourceIcon string
9 changes: 9 additions & 0 deletions cmd/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ func TestFrontEndHandlerWithLocation(t *testing.T) {
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) {
req, err := http.NewRequest(http.MethodGet, "/healthz", nil)
assert.NoError(t, err)
Expand Down
18 changes: 17 additions & 1 deletion console/atest-ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,26 @@ import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
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/
export default defineConfig({
plugins: [
vue(),
vue({
template: {
compilerOptions: {
nodeTransforms: true ? [removeDataTestAttrs] : [],
},
},
}),
vueJsx(),
],
resolve: {
Expand Down
7 changes: 7 additions & 0 deletions e2e/test-suite-common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,10 @@ items:
request:
api: |
{{.param.server}}/debug/pprof/cmdline
- name: favicon
request:
api: |
{{ .param.server }}/favicon.ico
expect:
header:
Content-Type: image/x-icon