test: add e2e testing base on docker compose

This commit is contained in:
rick
2024-06-20 01:29:43 +00:00
committed by Rick
parent 0f6d84dab2
commit 630a1fd3cd
5 changed files with 113 additions and 0 deletions

6
e2e/Dockerfile Normal file
View File

@@ -0,0 +1,6 @@
FROM ghcr.io/linuxsuren/api-testing:v0.0.17
WORKDIR /workspace
COPY . .
CMD [ "/workspace/entrypoint.sh" ]

3
e2e/entrypoint.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
set -e
atest run -p testsuite.yaml --report md

50
e2e/testsuite.yaml Normal file
View File

@@ -0,0 +1,50 @@
#!api-testing
# yaml-language-server: $schema=https://linuxsuren.github.io/api-testing/api-testing-schema.json
name: orion-visor
api: |
{{default "http://orion-visor-service:80" (env "SERVER")}}
items:
- name: login
request:
api: /orion-visor/api/infra/auth/login
method: POST
header:
Content-type: application/json
body: |
{"username":"admin","password":"admin"}
expect:
bodyFieldsExpect:
code: 200
- name: userPermission
request:
api: /orion-visor/api/infra/permission/user?s={{.login.data.token}}
header:
Authorization: Bearer {{.login.data.token}}
expect:
bodyFieldsExpect:
code: 200
message: "success"
- name: menu
request:
api: /orion-visor/api/infra/permission/menu
expect:
bodyFieldsExpect:
code: 200
message: "success"
- name: haveUnRead
request:
api: /orion-visor/api/infra/system-message/has-unread
expect:
bodyFieldsExpect:
data: false
- name: queryOperatorLog
request:
api: /orion-visor/api/infra/mine/query-operator-log
method: POST
- name: hostList
request:
api: /orion-visor/api/infra/tag/list?type=HOST
- name: queryHost
request:
api: /orion-visor/api/asset/host/query
method: POST