Skip to content

Commit

Permalink
✅ add piplines API test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdd committed Sep 13, 2024
1 parent 4fac00c commit 2f0fb46
Showing 1 changed file with 132 additions and 0 deletions.
132 changes: 132 additions & 0 deletions tests/e2e/integration/pipelines.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
GET http://localhost:5080/api/v1/pipelines
Authorization: Bearer {{admin_token}}
HTTP 200
[Asserts]
jsonpath "$.success" == true
jsonpath "$.pipelines" count == 1
jsonpath "$.pipelines[0]" == "default"

GET http://localhost:5080/api/v1/pipelines/default
Authorization: Bearer {{admin_token}}
HTTP 200
[Asserts]
jsonpath "$.success" == true
jsonpath "$.flow" exists

GET http://localhost:5080/api/v1/pipelines/test
Authorization: Bearer {{admin_token}}
HTTP 404

PUT http://localhost:5080/api/v1/pipelines/test
Authorization: Bearer {{admin_token}}
Content-Type: application/json
{
"flow": {
"nodes": [
{
"id": "__builtin__source_direct",
"type": "source",
"position": {"x": 210, "y": 195},
"deletable": false,
"data": {"type": "direct"},
"measured": {"width": 136, "height": 38},
"selected": true,
"dragging": false
},
{
"id": "__builtin__source_syslog",
"type": "source",
"position": {"x": 210, "y": 250},
"deletable": false,
"data": {"type": "syslog"},
"measured": {"width": 136, "height": 38},
"selected": true,
"dragging": false
},
{
"id": "node-1",
"type": "router",
"position": {"x": 405, "y": 195},
"data": {"stream": "test"},
"measured": {"width": 241,"height": 91},
"selected": false,
"dragging": false
}
],
"edges": [
{
"id": "xy-edge____builtin__source_direct-node-1",
"type": "smoothstep",
"source": "__builtin__source_direct",
"target": "node-1",
"animated": true
},
{
"id": "xy-edge____builtin__source_syslog-node-1",
"type": "smoothstep",
"source": "__builtin__source_syslog",
"target": "node-1",
"animated": true
}
]
}
}
HTTP 200
[Asserts]
jsonpath "$.success" == true

GET http://localhost:5080/api/v1/pipelines
Authorization: Bearer {{admin_token}}
HTTP 200
[Asserts]
jsonpath "$.success" == true
jsonpath "$.pipelines" count == 2
jsonpath "$.pipelines" includes "default"
jsonpath "$.pipelines" includes "test"

POST http://localhost:5080/api/v1/pipelines/test/logs
Authorization: Bearer {{admin_token}}
Content-Type: application/json
{
"record": {
"level": "info",
"message": "test"
}
}
HTTP 200

GET http://localhost:5080/api/v1/streams/test/logs
Authorization: Bearer {{admin_token}}
[QueryStringParams]
from: {{timewindow_begin}}
to: {{timewindow_end}}

HTTP 200
[Asserts]
jsonpath "$.success" == true
jsonpath "$.records" count == 1
jsonpath "$.records[0].fields.level" == "info"
jsonpath "$.records[0].fields.message" == "test"

DELETE http://localhost:5080/api/v1/streams/test
Authorization: Bearer {{admin_token}}
HTTP 200
[Asserts]
jsonpath "$.success" == true

DELETE http://localhost:5080/api/v1/pipelines/test
Authorization: Bearer {{admin_token}}
HTTP 200
[Asserts]
jsonpath "$.success" == true

GET http://localhost:5080/api/v1/pipelines/test
Authorization: Bearer {{admin_token}}
HTTP 404

GET http://localhost:5080/api/v1/pipelines
Authorization: Bearer {{admin_token}}
HTTP 200
[Asserts]
jsonpath "$.success" == true
jsonpath "$.pipelines" not includes "test"

0 comments on commit 2f0fb46

Please sign in to comment.