parent
88409cc1f0
commit
2f22246e29
@ -0,0 +1,11 @@
|
|||||||
|
# This configuration file was automatically generated by Gitpod.
|
||||||
|
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
|
||||||
|
# and commit this file to your remote git repository to share the goodness with others.
|
||||||
|
|
||||||
|
# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- init: go get && go build ./... && go test ./...
|
||||||
|
command: go run .
|
||||||
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
|||||||
|
FROM ghcr.io/linuxsuren/api-testing:master
|
||||||
|
|
||||||
|
WORKDIR /workspace
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
CMD [ "/workspace/entrypoint.sh" ]
|
@ -0,0 +1,14 @@
|
|||||||
|
version: '3.1'
|
||||||
|
services:
|
||||||
|
testing:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
SERVER: http://cloudreve:5212
|
||||||
|
depends_on:
|
||||||
|
cloudreve:
|
||||||
|
condition: service_started
|
||||||
|
links:
|
||||||
|
- cloudreve
|
||||||
|
cloudreve:
|
||||||
|
image: cloudreve/cloudreve:latest
|
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
atest run -p test-suite.yaml --report md
|
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
file=$1
|
||||||
|
if [ "$file" == "" ]
|
||||||
|
then
|
||||||
|
file=compose.yaml
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker-compose version
|
||||||
|
docker-compose -f "$file" up --build -d --pull=never
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
docker-compose -f "$file" ps | grep testing
|
||||||
|
if [ $? -eq 1 ]
|
||||||
|
then
|
||||||
|
code=-1
|
||||||
|
docker-compose -f "$file" logs | grep e2e-cloudreve
|
||||||
|
docker-compose -f "$file" logs | grep e2e-testing
|
||||||
|
docker-compose ps -a | grep e2e-testing | grep "Exited (0)"
|
||||||
|
if [ $? -eq 0 ]
|
||||||
|
then
|
||||||
|
code=0
|
||||||
|
echo "successed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker-compose -f "$file" down
|
||||||
|
set -e
|
||||||
|
exit $code
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
@ -0,0 +1,74 @@
|
|||||||
|
#!api-testing
|
||||||
|
# yaml-language-server: $schema=https://linuxsuren.github.io/api-testing/api-testing-schema.json
|
||||||
|
name: atest
|
||||||
|
api: |
|
||||||
|
{{default "http://localhost:5212" (env "SERVER")}}/api/v3
|
||||||
|
param:
|
||||||
|
username: admin@admin.com
|
||||||
|
password: "123456"
|
||||||
|
items:
|
||||||
|
- name: signup
|
||||||
|
request:
|
||||||
|
api: /user
|
||||||
|
method: POST
|
||||||
|
header:
|
||||||
|
Content-Type: application/json
|
||||||
|
body: |
|
||||||
|
{
|
||||||
|
"userName": "{{.param.username}}",
|
||||||
|
"Password": "{{.param.password}}",
|
||||||
|
"captchaCode": ""
|
||||||
|
}
|
||||||
|
- name: login
|
||||||
|
request:
|
||||||
|
api: /user/session
|
||||||
|
method: POST
|
||||||
|
header:
|
||||||
|
Content-Type: application/json
|
||||||
|
body: |
|
||||||
|
{
|
||||||
|
"userName": "{{.param.username}}",
|
||||||
|
"Password": "{{.param.password}}",
|
||||||
|
"captchaCode": ""
|
||||||
|
}
|
||||||
|
- name: login-failed
|
||||||
|
request:
|
||||||
|
api: /user/session
|
||||||
|
method: POST
|
||||||
|
header:
|
||||||
|
Content-Type: application/json
|
||||||
|
body: |
|
||||||
|
{
|
||||||
|
"userName": "{{.param.username}}",
|
||||||
|
"Password": "wrong-pass",
|
||||||
|
"captchaCode": ""
|
||||||
|
}
|
||||||
|
expect:
|
||||||
|
bodyFieldsExpect:
|
||||||
|
code: "40020"
|
||||||
|
- name: getStorageInfo
|
||||||
|
request:
|
||||||
|
api: /user/storage
|
||||||
|
expect:
|
||||||
|
bodyFieldsExpect:
|
||||||
|
code: "0"
|
||||||
|
- name: addTag
|
||||||
|
request:
|
||||||
|
api: /tag/filter
|
||||||
|
method: POST
|
||||||
|
header:
|
||||||
|
Content-Type: application/json
|
||||||
|
body: |
|
||||||
|
{
|
||||||
|
"expression": "{{randAlpha 4}}",
|
||||||
|
"name": "{{randAlpha 4}}",
|
||||||
|
"color": "rgba(0, 0, 0, 0.54)",
|
||||||
|
"icon": "Circle"
|
||||||
|
}
|
||||||
|
- name: getSetting
|
||||||
|
request:
|
||||||
|
api: /user/setting
|
||||||
|
- name: signOff
|
||||||
|
request:
|
||||||
|
api: /user/session
|
||||||
|
method: DELETE
|
Loading…
Reference in new issue