Skip to content

Commit

Permalink
[fix] the e2e failure without broken the ci (#2093)
Browse files Browse the repository at this point in the history
Co-authored-by: rick <LinuxSuRen@users.noreply.github.com>
  • Loading branch information
LinuxSuRen and LinuxSuRen committed Jun 18, 2024
1 parent 56db540 commit a71c61a
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 111 deletions.
167 changes: 90 additions & 77 deletions e2e/data/monitor-http.json
Original file line number Diff line number Diff line change
@@ -1,80 +1,93 @@

{
"detected": false,
"collector": "",
"monitor": {
"intervals": 60,
"tags": [],
"app": "api",
"host": "127.0.0.1",
"detected": false,
"collector": "",
"monitor": {
"intervals": 60,
"tags": [],
"app": "api",
"host": "127.0.0.1",
"name": "{{.param.monitorHTTP}}"
},
"params": [
{
"display": true,
"field": "host",
"type": 1,
"paramValue": "127.0.0.1"
},
"params": [
{
"field": "host",
"type": 1,
"value": "127.0.0.1"
},
{
"field": "port",
"type": 0,
"value": 80
},
{
"field": "method",
"type": 1,
"value": "GET"
},
{
"field": "uri",
"type": 1,
"value": ""
},
{
"field": "ssl",
"type": 1,
"value": false
},
{
"field": "headers",
"type": 3
},
{
"field": "params",
"type": 3
},
{
"field": "timeout",
"type": 0
},
{
"field": "contentType",
"type": 1
},
{
"field": "payload",
"type": 1
},
{
"field": "authType",
"type": 1
},
{
"field": "username",
"type": 1
},
{
"field": "password",
"type": 1
},
{
"field": "keyword",
"type": 1
},
{
"field": "successCode",
"type": 4,
"value": "200, 201"
}
]
}
{
"display": true,
"field": "port",
"type": 0,
"paramValue": 80
},
{
"display": true,
"field": "httpMethod",
"type": 1,
"paramValue": "GET"
},
{
"display": true,
"field": "uri",
"type": 1
},
{
"display": true,
"field": "ssl",
"type": 1,
"paramValue": false
},
{
"display": true,
"field": "headers",
"type": 3
},
{
"display": true,
"field": "params",
"type": 3
},
{
"display": true,
"field": "timeout",
"type": 0
},
{
"display": true,
"field": "contentType",
"type": 1
},
{
"display": false,
"field": "payload",
"type": 1
},
{
"display": true,
"field": "authType",
"type": 1
},
{
"display": true,
"field": "username",
"type": 1
},
{
"display": true,
"field": "password",
"type": 1
},
{
"display": true,
"field": "keyword",
"type": 1
},
{
"display": true,
"field": "successCode",
"type": 4,
"paramValue": "200, 201"
}
]
}
24 changes: 2 additions & 22 deletions e2e/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,5 @@ then
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
17 changes: 5 additions & 12 deletions e2e/testsuite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,15 @@ items:
Authorization: Bearer {{.login.data.token}}
- name: cancelHTTPMonitor
request:
api: /api/monitors/manage
api: /api/monitors/manage?ids={{(index .listHTTPMonitor.data.content 0).id | int64}}
query:
ids: "{{(index .listHTTPMonitor.data.content 0).id}}"
type: JSON
method: DELETE
header:
Authorization: Bearer {{.login.data.token}}
- name: deleteHTTPMonitor
request:
api: /api/monitors
query:
ids: "{{(index .listHTTPMonitor.data.content 0).id}}"
api: /api/monitors?ids={{(index .listHTTPMonitor.data.content 0).id | int64}}
method: DELETE
header:
Authorization: Bearer {{.login.data.token}}
Expand All @@ -168,9 +165,7 @@ items:
Authorization: Bearer {{.login.data.token}}
- name: deleteAlertDefine
request:
api: /api/alert/defines
query:
ids: "{{(index .listAlertDefine.data.content 0).id}}"
api: /api/alert/defines?ids={{(index .listAlertDefines.data.content 0).id | int64}}
method: DELETE
header:
Authorization: Bearer {{.login.data.token}}
Expand Down Expand Up @@ -239,7 +234,7 @@ items:
Content-type: application/json
body: |
{
"id": {{(index .listTags.data.content 0).id}},
"id": {{(index .listTags.data.content 0).id | int64}},
"name": "{{randAlpha 3}}",
"value": "{{randAlpha 3}}",
"color": "#ff4081",
Expand All @@ -252,9 +247,7 @@ items:
code: "0"
- name: deleteTag
request:
api: /api/tag
query:
ids: "{{(index .listTags.data.content 0).id}}"
api: /api/tag?ids={{(index .listTags.data.content 0).id | int64}}
method: DELETE
header:
Authorization: Bearer {{.login.data.token}}
Expand Down

0 comments on commit a71c61a

Please sign in to comment.