fix: the e2e script exit code handling is incorrect (#6097)

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. 如果这是你的第一次,请阅读我们的贡献指南:<https://github.com/halo-dev/halo/blob/main/CONTRIBUTING.md>。
1. If this is your first time, please read our contributor guidelines: <https://github.com/halo-dev/halo/blob/main/CONTRIBUTING.md>.
2. 请根据你解决问题的类型为 Pull Request 添加合适的标签。
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request.
3. 请确保你已经添加并运行了适当的测试。
3. Ensure you have added or ran the appropriate tests for your PR.
-->

#### What type of PR is this?

<!--
添加其中一个类别:
Add one of the following kinds:

/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind improvement

适当添加其中一个或多个类别(可选):
Optionally add one or more of the following kinds if applicable:

/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->
/kind bug

#### What this PR does / why we need it:

#### Which issue(s) this PR fixes:

<!--
PR 合并时自动关闭 issue。
Automatically closes linked issue when PR is merged.

用法:`Fixes #<issue 号>`,或者 `Fixes (粘贴 issue 完整链接)`
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes https://github.com/halo-dev/halo/issues/6096

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?

<!--
如果当前 Pull Request 的修改不会造成用户侧的任何变更,在 `release-note` 代码块儿中填写 `NONE`。
否则请填写用户侧能够理解的 Release Note。如果当前 Pull Request 包含破坏性更新(Break Change),
Release Note 需要以 `action required` 开头。
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->

```release-note
None
```
pull/6253/head
Rick 2024-07-02 19:07:23 +08:00 committed by GitHub
parent 484b5c1b74
commit 1b5a23dfb4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 61 deletions

View File

@ -1,4 +1,4 @@
FROM ghcr.io/linuxsuren/api-testing:v0.0.16
FROM ghcr.io/linuxsuren/api-testing:master@sha256:589cf9742974c80755f73967c185144a7618decc25d3faa9423a0eda6e4a79c0
WORKDIR /workspace
COPY testsuite.yaml .
CMD [ "atest", "run", "-p", "testsuite.yaml", "--level=debug" ]
CMD [ "atest", "run", "-p", "testsuite.yaml", "--level=trace", "--request-ignore-error", "--report=md" ]

View File

@ -6,26 +6,5 @@ then
file=compose.yaml
fi
docker-compose version
docker-compose -f "$file" up --build -d
while true
do
docker-compose -f "$file" ps | grep testing
if [ $? -eq 1 ]
then
code=-1
docker-compose -f "$file" logs | grep e2e-testing
docker-compose -f "$file" logs | grep e2e-testing | grep Usage
if [ $? -eq 1 ]
then
code=0
echo "successed"
fi
docker-compose -f "$file" down
set -e
exit $code
fi
sleep 1
done
docker-compose -f "$file" down
docker-compose -f "$file" up --build testing --exit-code-from testing --remove-orphans

View File

@ -71,8 +71,6 @@ items:
- name: listPosts
request:
api: /api.console.halo.run/v1alpha1/posts?keyword={{.param.postName}}
header:
Authorization: "{{.param.auth}}"
expect:
verify:
- data.total == 1
@ -80,14 +78,10 @@ items:
request:
api: /api.console.halo.run/v1alpha1/posts/{{(index .listPosts.items 0).post.metadata.name}}/recycle
method: PUT
header:
Authorization: "{{.param.auth}}"
- name: recover
request:
api: /content.halo.run/v1alpha1/posts/{{(index .listPosts.items 0).post.metadata.name}}
method: DELETE
header:
Authorization: "{{.param.auth}}"
## Users
- name: createUser
@ -95,7 +89,6 @@ items:
api: /api.console.halo.run/v1alpha1/users
method: POST
header:
Authorization: "{{.param.auth}}"
Content-Type: application/json
body: |
{
@ -113,7 +106,6 @@ items:
api: /api.console.halo.run/v1alpha1/users/{{.param.userName}}/password
method: PUT
header:
Authorization: "{{.param.auth}}"
Content-Type: application/json
body: |
{
@ -124,7 +116,6 @@ items:
api: /api.console.halo.run/v1alpha1/users/{{.param.userName}}/permissions
method: POST
header:
Authorization: "{{.param.auth}}"
Content-Type: application/json
body: |
{
@ -132,13 +123,6 @@ items:
"guest"
]
}
- name: deleteUser
request:
api: |
{{default "http://halo:8090" (env "SERVER")}}/api/v1alpha1/users/{{.param.userName}}
method: DELETE
header:
Authorization: "{{.param.auth}}"
- name: sendPasswordResetEmail
request:
api: |
@ -174,7 +158,6 @@ items:
{{default "http://halo:8090" (env "SERVER")}}/api/v1alpha1/roles
method: POST
header:
Authorization: "{{.param.auth}}"
Content-Type: application/json
body: |
{
@ -197,8 +180,6 @@ items:
request:
api: |
{{default "http://halo:8090" (env "SERVER")}}/api/v1alpha1/roles
header:
Authorization: "{{.param.auth}}"
expect:
verify:
- data.total >= 3
@ -207,8 +188,6 @@ items:
api: |
{{default "http://halo:8090" (env "SERVER")}}/api/v1alpha1/roles/{{(index .listRoles.items 0).metadata.name}}
method: DELETE
header:
Authorization: "{{.param.auth}}"
## Plugins
- name: installPlugin
@ -216,7 +195,6 @@ items:
api: /api.console.halo.run/v1alpha1/plugins/-/install-from-uri
method: POST
header:
Authorization: "{{.param.auth}}"
Content-Type: application/json
body: |
{
@ -225,16 +203,12 @@ items:
- name: pluginList
request:
api: /api.console.halo.run/v1alpha1/plugins
header:
Authorization: "{{.param.auth}}"
expect:
verify:
- data.total >= 1
- name: inActivePlugins
request:
api: /api.console.halo.run/v1alpha1/plugins?enabled=false&keyword=&page=0&size=0
header:
Authorization: "{{.param.auth}}"
expect:
verify:
- data.total == 1
@ -243,7 +217,6 @@ items:
api: /api.console.halo.run/v1alpha1/plugins/PluginSitePush/plugin-state
method: PUT
header:
Authorization: "{{.param.auth}}"
Content-Type: application/json
body: |
{
@ -254,7 +227,6 @@ items:
api: /api.console.halo.run/v1alpha1/plugins/PluginSitePush/plugin-state
method: PUT
header:
Authorization: "{{.param.auth}}"
Content-Type: application/json
body: |
{
@ -265,14 +237,11 @@ items:
api: /api.console.halo.run/v1alpha1/plugins/PluginSitePush/reset-config
method: PUT
header:
Authorization: "{{.param.auth}}"
Content-Type: application/json
- name: uninstallPlugin
request:
api: /plugin.halo.run/v1alpha1/plugins/PluginSitePush
method: DELETE
header:
Authorization: "{{.param.auth}}"
# Notifications
- name: createNotification
@ -297,15 +266,12 @@ items:
}
header:
Content-Type: application/json
Authorization: "{{.param.auth}}"
expect:
statusCode: 201
- name: getNotificationByName
request:
api: /notification.halo.run/v1alpha1/notifications/{{.param.notificationName}}
method: GET
header:
Authorization: "{{.param.auth}}"
expect:
statusCode: 200
verify:
@ -316,5 +282,9 @@ items:
api: |
/api.notification.halo.run/v1alpha1/userspaces/admin/notifications/{{.param.notificationName}}
method: DELETE
header:
Authorization: "{{.param.auth}}"
- name: deleteUser
request:
api: |
{{default "http://halo:8090" (env "SERVER")}}/api/v1alpha1/users/{{.param.userName}}
method: DELETE