github.com/kubeshop/testkube@v1.17.23/contrib/executor/k6/examples/k6-test-thresholds.js (about)

     1  import http from 'k6/http';
     2  import { sleep, check } from 'k6';
     3  
     4  export let options = {
     5    insecureSkipTLSVerify: true,
     6    thresholds: {
     7        'http_req_duration{kind:html}': ['avg<=250', 'p(95)<500'],
     8        'checks{kind:http}': ['rate>0.95'],     // example for tag specific checks
     9        checks: ['rate>0.95'],                  // example for overall checks
    10    },
    11  };
    12  
    13  export default function () {
    14    check(http.get('https://docs.testkube.io', {
    15        tags: {kind: 'html'},
    16    }), {
    17        "status is 404": (res) => res.status === 404,
    18    }, {kind: 'http'},
    19    );
    20    sleep(1);
    21  }