@@ -282,6 +282,42 @@ func TestSSLKEYLOGFILE(t *testing.T) {
282282 require .Regexp (t , "^CLIENT_[A-Z_]+ [0-9a-f]+ [0-9a-f]+\n " , string (sslloglines ))
283283}
284284
285+ func TestThresholdDeprecationWarnings (t * testing.T ) {
286+ t .Parallel ()
287+
288+ // TODO: adjust this test after we actually make url, error, iter and vu non-indexable
289+
290+ ts := newGlobalTestState (t )
291+ ts .args = []string {"k6" , "run" , "--system-tags" , "url,error,vu,iter" , "-" }
292+ ts .stdIn = bytes .NewReader ([]byte (`
293+ export const options = {
294+ thresholds: {
295+ 'http_req_duration{url:https://test.k6.io}': ['p(95)<500', 'p(99)<1000'],
296+ 'http_req_duration{error:foo}': ['p(99)<1000'],
297+ 'iterations{vu:1,iter:0}': ['count == 1'],
298+ },
299+ };
300+
301+ export default function () { }` ,
302+ ))
303+
304+ newRootCommand (ts .globalState ).execute ()
305+
306+ logs := ts .loggerHook .Drain ()
307+ assert .True (t , testutils .LogContains (logs , logrus .WarnLevel ,
308+ "Thresholds like 'http_req_duration{url:https://test.k6.io}', based on the high-cardinality 'url' metric tag, are deprecated" ,
309+ ))
310+ assert .True (t , testutils .LogContains (logs , logrus .WarnLevel ,
311+ "Thresholds like 'http_req_duration{error:foo}', based on the high-cardinality 'error' metric tag, are deprecated" ,
312+ ))
313+ assert .True (t , testutils .LogContains (logs , logrus .WarnLevel ,
314+ "Thresholds like 'iterations{vu:1,iter:0}', based on the high-cardinality 'vu' metric tag, are deprecated" ,
315+ ))
316+ assert .True (t , testutils .LogContains (logs , logrus .WarnLevel ,
317+ "Thresholds like 'iterations{vu:1,iter:0}', based on the high-cardinality 'iter' metric tag, are deprecated" ,
318+ ))
319+ }
320+
285321// TODO: add a hell of a lot more integration tests, including some that spin up
286322// a test HTTP server and actually check if k6 hits it
287323
0 commit comments