Commit 6910d8e9 authored by Grant Young's avatar Grant Young

Switch k6 to discard responses

This improves memory usage massively when responses are large.
We'll never need these in memory so we'll always discard unless debug flag.
Also recommended by k6.
parent 8a3799f6
......@@ -25,7 +25,6 @@ opts = Optimist.options do
banner "\nDocumentation: https://gitlab.com/gitlab-org/quality/performance/blob/master/docs/README.md"
banner "\nUsage: run-k6 [options]"
banner "Options:"
opt :help, 'Show this help message'
opt :environment, "Name of Environment Config file in environments directory that the test(s) will be run with. Alternative filepath can also be given.", type: :string, required: true
opt :options, "Name of Options Config file in options directory that the test(s) will be run with. Alternative filepath can also be given.", type: :string, default: "20s_2rps.json"
opt :tests, "Names of Test files or directories to run with. When directory given tests will be recursively added from api, web and git subdirs.", type: :strings, default: ["tests"]
......@@ -34,8 +33,11 @@ opts = Optimist.options do
opt :excludes, "List of words used to exclude tests by matching against their names.", type: :strings
opt :unsafe, "Include any tests that perform unsafe requests (POST, PUT, DELETE, PATCH)", type: :flag, default: false
opt :influxdb_url, "URL of an Influx DB server where GPT can optionally upload test run statistics.", type: :string, default: ENV['GPT_INFLUXDB_URL'] || nil
opt :help, 'Show this help message'
opt :version, 'Print version and exit'
banner "\nEnvironment Variable(s):"
banner " ACCESS_TOKEN A valid GitLab Personal Access Token for the specified environment that's required by various tests. The token should come from a User that has admin access for the project(s) to be tested and have API, read_repository, and write_repository permissions. (Default: nil)"
banner " GPT_DEBUG Shows debug output when set to true. (Default: nil)"
banner "\nExamples:"
banner " Run all Tests with the 60s_200rps Options file against the 10k Environment:"
banner " #{ENV['GPT_DOCKER'] ? 'docker run -it gitlab/gitlab-performance-tool' : $PROGRAM_NAME} --environment 10k.json --options 60s_200rps.json"
......
......@@ -274,7 +274,6 @@ Documentation: https://gitlab.com/gitlab-org/quality/performance/blob/master/doc
Usage: run-k6 [options]
Options:
-h, --help Show this help message
-e, --environment=<s> Name of Environment Config file in environments directory that the test(s) will be run with. Alternative filepath can also be given.
-o, --options=<s> Name of Options Config file in options directory that the test(s) will be run with. Alternative filepath can also be given. (Default: 20s_2rps.json)
-t, --tests=<s+> Names of Test files or directories to run with. When directory given tests will be recursively added from api, web and git subdirs. (Default: tests)
......@@ -283,10 +282,13 @@ Options:
-x, --excludes=<s+> List of words used to exclude tests by matching against their names.
-u, --unsafe Include any tests that perform unsafe requests (POST, PUT, DELETE, PATCH)
-i, --influxdb-url=<s> URL of an Influx DB server where GPT can optionally upload test run statistics.
-h, --help Show this help message
-v, --version Print version and exit
Environment Variable(s):
ACCESS_TOKEN A valid GitLab Personal Access Token for the specified environment that's required by various tests. The token should come from a User that has admin access for
the project(s) to be tested and have API, read_repository, and write_repository permissions. (Default: nil)
GPT_DEBUG Shows debug output when set to true. (Default: nil)
Examples:
Run all Tests with the 60s_200rps Options file against the 10k Environment:
......@@ -295,7 +297,6 @@ Examples:
./bin/run-k6 --environment 10k.json --options 60s_200rps.json --tests api
Run a specific Test with the 60s_200rps Options file against the 10k Environment:
./bin/run-k6 --environment 10k.json --options 60s_200rps.json --tests api_v4_groups_projects.js
-v, --version Print version and exit
```
The only further setup required to run the tests is to provide any of your custom Environment, Options and Test files to the container via volume mounts as well as provide a mount for results to be saved to on the host.
......
......@@ -37,7 +37,7 @@ export default function() {
group("API - Project Repository File Blame", function() {
let project = selectProject(projects);
let params = { headers: { "Accept": "application/json", "PRIVATE-TOKEN": `${__ENV.ACCESS_TOKEN}` } };
let params = { headers: { "Accept": "application/json", "PRIVATE-TOKEN": `${__ENV.ACCESS_TOKEN}` }, responseType: 'none' };
let res = http.get(`${__ENV.ENVIRONMENT_URL}/api/v4/projects/${project['group']}%2F${project['name']}/repository/files/${project['file_path']}/blame?ref=master`, params);
/20(0|1)/.test(res.status) ? successRate.add(true) : (successRate.add(false), logError(res));
});
......
......@@ -45,7 +45,7 @@ export default function(data) {
group("Web - Project File Blame Page", function() {
let project = selectProject(projects);
let res = http.get(`${__ENV.ENVIRONMENT_URL}/${project['group']}/${project['name']}/${data.endpointPath}`, {tags: {endpoint: 'blame', controller: 'Projects::BlameController', action: 'show'}});
let res = http.get(`${__ENV.ENVIRONMENT_URL}/${project['group']}/${project['name']}/${data.endpointPath}`, {tags: {endpoint: 'blame', controller: 'Projects::BlameController', action: 'show'}, responseType: 'none'});
/20(0|1)/.test(res.status) ? successRate.add(true) : (successRate.add(false), logError(res));
});
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment