Skip to content

Commit

Permalink
test: add more monitor related e2e testing case (#1391)
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 authored Dec 6, 2023
1 parent 6283e4d commit 2e96b62
Show file tree
Hide file tree
Showing 8 changed files with 299 additions and 0 deletions.
41 changes: 41 additions & 0 deletions e2e/data/monitor-ftp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"detected": false,
"collector": "",
"monitor": {
"intervals": 60,
"tags": [],
"app": "ftp",
"host": "127.0.0.1",
"name": "{{.param.monitorFTP}}"
},
"params": [
{
"field": "host",
"type": 1,
"value": "127.0.0.1"
},
{
"field": "port",
"type": 0,
"value": 21
},
{
"field": "direction",
"type": 1,
"value": "127.0.0.1"
},
{
"field": "timeout",
"type": 0,
"value": 1000
},
{
"field": "username",
"type": 1
},
{
"field": "password",
"type": 1
}
]
}
23 changes: 23 additions & 0 deletions e2e/data/monitor-ping.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"detected": false,
"collector": "",
"monitor": {
"intervals": 60,
"tags": [],
"app": "ping",
"host": "127.0.0.1",
"name": "{{.param.monitorPing}}"
},
"params": [
{
"field": "host",
"type": 1,
"value": "127.0.0.1"
},
{
"field": "timeout",
"type": 0,
"value": 6000
}
]
}
28 changes: 28 additions & 0 deletions e2e/data/monitor-port.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"detected": false,
"collector": "",
"monitor": {
"intervals": 60,
"tags": [],
"app": "port",
"host": "127.0.0.1",
"name": "{{.param.monitorPort}}"
},
"params": [
{
"field": "host",
"type": 1,
"value": "127.0.0.1"
},
{
"field": "port",
"type": 0,
"value": 80
},
{
"field": "timeout",
"type": 0,
"value": 6000
}
]
}
33 changes: 33 additions & 0 deletions e2e/data/monitor-sitemap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"detected": false,
"collector": "",
"monitor": {
"intervals": 60,
"tags": [],
"app": "fullsite",
"host": "127.0.0.1",
"name": "{{.param.monitorSiteMap}}"
},
"params": [
{
"field": "host",
"type": 1,
"value": "127.0.0.1"
},
{
"field": "port",
"type": 0,
"value": 80
},
{
"field": "sitemap",
"type": 1,
"value": "sitemap.xml"
},
{
"field": "ssl",
"type": 1,
"value": false
}
]
}
27 changes: 27 additions & 0 deletions e2e/data/monitor-ssl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"detected": false,
"collector": "",
"monitor": {
"intervals": 60,
"tags": [],
"app": "ssl_cert",
"host": "127.0.0.1",
"name": "{{.param.monitorSSL}}"
},
"params": [
{
"field": "host",
"type": 1,
"value": "127.0.0.1"
},
{
"field": "port",
"type": 0,
"value": 443
},
{
"field": "uri",
"type": 1
}
]
}
32 changes: 32 additions & 0 deletions e2e/data/monitor-udp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"detected": false,
"collector": "",
"monitor": {
"intervals": 60,
"tags": [],
"app": "udp_port",
"host": "127.0.0.1",
"name": "{{.param.monitorUDP}}"
},
"params": [
{
"field": "host",
"type": 1,
"value": "127.0.0.1"
},
{
"field": "port",
"type": 0,
"value": 81
},
{
"field": "timeout",
"type": 0,
"value": 6000
},
{
"field": "content",
"type": 1
}
]
}
52 changes: 52 additions & 0 deletions e2e/data/monitor-website.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"detected": false,
"collector": "",
"monitor": {
"intervals": 60,
"tags": [],
"app": "website",
"host": "127.0.0.1",
"name": "{{.param.monitorWebsite}}"
},
"params": [
{
"field": "host",
"type": 1,
"value": "127.0.0.1"
},
{
"field": "port",
"type": 0,
"value": 80
},
{
"field": "uri",
"type": 1
},
{
"field": "ssl",
"type": 1,
"value": false
},
{
"field": "timeout",
"type": 0
},
{
"field": "authType",
"type": 1
},
{
"field": "username",
"type": 1
},
{
"field": "password",
"type": 1
},
{
"field": "keyword",
"type": 1
}
]
}
63 changes: 63 additions & 0 deletions e2e/testsuite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ api: |
{{default "http://localhost:1157" (env "SERVER")}}
param:
monitorHTTP: "{{randAlpha 6}}"
monitorSiteMap: "{{randAlpha 6}}"
monitorPort: "{{randAlpha 6}}"
monitorSSL: "{{randAlpha 6}}"
monitorPing: "{{randAlpha 6}}"
monitorUDP: "{{randAlpha 6}}"
monitorWebsite: "{{randAlpha 6}}"
monitorFTP: "{{randAlpha 6}}"
tagName: "{{randAlpha 3}}"
items:
- name: login
Expand Down Expand Up @@ -55,6 +62,62 @@ items:
Authorization: Bearer {{.login.data.token}}
Content-type: application/json
bodyFromFile: data/monitor-http.json
- name: createSitemapMonitor
request:
api: /api/monitor
method: POST
header:
Authorization: Bearer {{.login.data.token}}
Content-type: application/json
bodyFromFile: data/monitor-sitemap.json
- name: createPortMonitor
request:
api: /api/monitor
method: POST
header:
Authorization: Bearer {{.login.data.token}}
Content-type: application/json
bodyFromFile: data/monitor-port.json
- name: createSSLMonitor
request:
api: /api/monitor
method: POST
header:
Authorization: Bearer {{.login.data.token}}
Content-type: application/json
bodyFromFile: data/monitor-ssl.json
- name: createPingMonitor
request:
api: /api/monitor
method: POST
header:
Authorization: Bearer {{.login.data.token}}
Content-type: application/json
bodyFromFile: data/monitor-ping.json
- name: createUDPMonitor
request:
api: /api/monitor
method: POST
header:
Authorization: Bearer {{.login.data.token}}
Content-type: application/json
bodyFromFile: data/monitor-udp.json
- name: createWebsiteMonitor
request:
api: /api/monitor
method: POST
header:
Authorization: Bearer {{.login.data.token}}
Content-type: application/json
bodyFromFile: data/monitor-website.json
- name: createFTPMonitor
request:
api: /api/monitor
method: POST
header:
Authorization: Bearer {{.login.data.token}}
Content-type: application/json
bodyFromFile: data/monitor-ftp.json
- name: listHTTPMonitor
request:
api: /api/monitors
Expand Down

0 comments on commit 2e96b62

Please sign in to comment.