Skip to content

Commit afa3600

Browse files
add tests where param is another operation
Signed-off-by: Saumya Shah <[email protected]>
1 parent ad70117 commit afa3600

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

engine/engine_test.go

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,9 +1964,22 @@ sum by (grpc_method, grpc_code) (
19641964
end: time.Unix(3000, 0),
19651965
step: 2 * time.Second,
19661966
},
1967+
{
1968+
name: "limitK by (series)",
1969+
load: `load 30s
1970+
http_requests_total{pod="nginx-1", series="1"} 1+1.1x50
1971+
http_requests_total{pod="nginx-2", series="1"} 2+2.3x50
1972+
http_requests_total{pod="nginx-4", series="2"} 5+2.4x50
1973+
http_requests_total{pod="nginx-5", series="2"} 8.4+2.3x50
1974+
http_requests_total{pod="nginx-6", series="2"} 2.3+2.3x50`,
1975+
query: `limitk(2, http_requests_total) by (pod)`,
1976+
start: time.Unix(0, 0),
1977+
end: time.Unix(3000, 0),
1978+
step: 2 * time.Second,
1979+
},
19671980
// TODO(Saumya40-Codes): uncomment once https://github.com/prometheus/prometheus/pull/16404 gets merged
19681981
// {
1969-
// name: "limitK but a sample not present at last few timestamps",
1982+
// name: "limitK but a sample might not present at last few timestamps",
19701983
// load: `load 30s
19711984
// http_requests_total{pod="nginx-1", series="1"} 1+1.1x50
19721985
// http_requests_total{pod="nginx-2", series="1"} 2+2.3x40
@@ -1978,19 +1991,6 @@ sum by (grpc_method, grpc_code) (
19781991
// end: time.Unix(3000, 0),
19791992
// step: 2 * time.Second,
19801993
// },
1981-
// {
1982-
// name: "limitK by (pod)",
1983-
// load: `load 30s
1984-
// http_requests_total{pod="nginx-1", series="1"} 1+1.1x50
1985-
// http_requests_total{pod="nginx-2", series="1"} 2+2.3x40
1986-
// http_requests_total{pod="nginx-4", series="2"} 5+2.4x50
1987-
// http_requests_total{pod="nginx-5", series="2"} 8.4+2.3x50
1988-
// http_requests_total{pod="nginx-6", series="2"} 2.3+2.3x50`,
1989-
// query: `limitk(2, http_requests_total) by (pod)`,
1990-
// start: time.Unix(0, 0),
1991-
// end: time.Unix(3000, 0),
1992-
// step: 2 * time.Second,
1993-
// },
19941994
{
19951995
name: "sgn",
19961996
load: `load 30s
@@ -3616,6 +3616,19 @@ min without () (
36163616
http_requests_total{pod="nginx-3", series="2"} 1`,
36173617
query: "limitk(2, http_requests_total) by (pod)",
36183618
},
3619+
{
3620+
name: "limitk(x, many-to-many join)",
3621+
load: `load 30s
3622+
http_requests_total{pod="nginx-1", series="2"} 89
3623+
http_requests_total{pod="nginx-1", series="1"} 49
3624+
http_requests_total{pod="nginx-1", series="3"} 19
3625+
http_requests_total{pod="nginx-2", series="2"} 12
3626+
http_requests_total{pod="nginx-2", series="1"} 24
3627+
http_requests_total{pod="nginx-3", series="3"} 8
3628+
http_requests_total{pod="nginx-3", series="1"} 22
3629+
http_requests_total{pod="nginx-3", series="2"} 1`,
3630+
query: "limitk(2, http_requests_total or limitk(2, sum without (series) (http_requests_total))) by (pod)",
3631+
},
36193632
{
36203633
name: "max",
36213634
load: `load 30s

0 commit comments

Comments
 (0)