Skip to content

Commit

Permalink
test: add include/exclude cases
Browse files Browse the repository at this point in the history
  • Loading branch information
sunng87 committed Oct 26, 2024
1 parent 072a65e commit a9f4ff7
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions tests/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,4 +454,62 @@ fn test_serialize() {
"type": "aggregation",
"without": false
});

assert_json_ser_eq!("sum by(host) (rate(http_requests_total[5m]))",
{
"expr": {
"args": [
{
"matchers": [],
"name": "http_requests_total",
"offset": 0,
"range": 300000,
"type": "matrixSelector"
}
],
"func": {
"argTypes": [
"matrix"
],
"name": "rate",
"returnType": "vector",
"variadic": 0
},
"type": "call"
},
"grouping": ["host"],
"op": "sum",
"param": null,
"type": "aggregation",
"without": false
});

assert_json_ser_eq!("sum without(host) (rate(http_requests_total[5m]))",
{
"expr": {
"args": [
{
"matchers": [],
"name": "http_requests_total",
"offset": 0,
"range": 300000,
"type": "matrixSelector"
}
],
"func": {
"argTypes": [
"matrix"
],
"name": "rate",
"returnType": "vector",
"variadic": 0
},
"type": "call"
},
"grouping": ["host"],
"op": "sum",
"param": null,
"type": "aggregation",
"without": true
});
}

0 comments on commit a9f4ff7

Please sign in to comment.