Last active
July 30, 2018 15:47
-
-
Save paulgrav/a8b6d77639b0d54774b499c5dfd660c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http from "k6/http"; | |
import { check, group } from "k6"; | |
import { Rate } from "k6/metrics"; | |
import { sleep } from "k6"; | |
export let errorRate = new Rate("errors"); | |
export let options = { | |
stages: [ | |
{ duration: "5m", target: 1 }, | |
], | |
noConnectionReuse: true, | |
noVUConnectionReuse: true, | |
userAgent: "MyK6UserAgentString/1.0" | |
}; | |
const baseUrl = "http://host.name/"; | |
export default function() { | |
visitHomepage(); | |
sleep(1); | |
}; | |
function visitHomepage() { | |
let res = http.get(baseUrl + "/"); | |
check(res, { | |
"status is 200": checkStatus(200) | |
}) || errorRate.add(1); | |
}; | |
function checkStatus(statusCode) { | |
return (res) => res.status == statusCode; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment