Commit 95c5a3b0 authored by Nailia Iskhakova's avatar Nailia Iskhakova

Merge branch 'add-issues-tests' into 'master'

Expand performance test coverage for issues

Closes #190

See merge request !126
parents 3c47eb25 4b44b673
......@@ -62,6 +62,7 @@ As an example, the following is one of our Environment Config Files, [`10k.json`
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
},
{
......@@ -79,6 +80,7 @@ As an example, the following is one of our Environment Config Files, [`10k.json`
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
}
]
......@@ -106,6 +108,7 @@ Details for each of the settings are as follows. Some are also available to be c
* `branch_name` - Existing branch name.
* `mr_commits_iid` - The [iid](https://docs.gitlab.com/ee/api/#id-vs-iid) of a merge request available in the project that has a large number of commits. The size of the MR should be tuned to your environment's requirements.
* `mr_discussions_iid` - The [iid](https://docs.gitlab.com/ee/api/#id-vs-iid) of a merge request available in the project that has a large number of discussions / comments. The size of the MR discussions should be tuned to your environment's requirements.
* `issue_iid` - The [iid](https://docs.gitlab.com/ee/api/#id-vs-iid) of an issue available in the project that has a large number of discussions / comments. The size of the issue discussions should be tuned to your environment's requirements.
* `user` - The name of a valid user for testing related endpoints.
### Options
......
......@@ -23,6 +23,7 @@
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
},
{
......@@ -40,6 +41,7 @@
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
}
]
......
......@@ -23,6 +23,7 @@
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
},
{
......@@ -40,6 +41,7 @@
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
}
]
......
......@@ -23,6 +23,7 @@
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
},
{
......@@ -40,6 +41,7 @@
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
}
]
......
......@@ -23,6 +23,7 @@
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
},
{
......@@ -40,6 +41,7 @@
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
},
{
......@@ -57,6 +59,7 @@
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
},
{
......@@ -74,6 +77,7 @@
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
}
]
......
......@@ -23,6 +23,7 @@
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
},
{
......@@ -40,6 +41,7 @@
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
}
]
......
......@@ -23,6 +23,7 @@
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
}
]
......
......@@ -23,6 +23,7 @@
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
}
]
......
......@@ -23,6 +23,7 @@
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"issue_iid": "4218",
"user": "root"
}
]
......
/*global __ENV : true */
/*
@endpoint: `GET /projects/:id/issues`
@description: [List project issues](https://docs.gitlab.com/ee/api/issues.html#list-project-issues)
@issue: TBC
*/
import http from "k6/http";
import { group } from "k6";
import { Rate } from "k6/metrics";
import { logError, checkAccessToken, getRpsThresholds, getTtfbThreshold, getProjects, selectProject } from "../../lib/gpt_k6_modules.js";
checkAccessToken();
export let rpsThresholds = getRpsThresholds(0.9)
export let ttfbThreshold = getTtfbThreshold()
export let successRate = new Rate("successful_requests")
export let options = {
thresholds: {
"successful_requests": [`rate>${__ENV.SUCCESS_RATE_THRESHOLD}`],
"http_req_waiting": [`p(90)<${ttfbThreshold}`],
"http_reqs": [`count>=${rpsThresholds['count']}`]
}
};
export let projects = getProjects(['name', 'group']);
export function setup() {
console.log('')
console.log(`RPS Threshold: ${rpsThresholds['mean']}/s (${rpsThresholds['count']})`)
console.log(`TTFB P90 Threshold: ${ttfbThreshold}ms`)
console.log(`Success Rate Threshold: ${parseFloat(__ENV.SUCCESS_RATE_THRESHOLD)*100}%`)
}
export default function() {
group("API - Issues List", function() {
let project = selectProject(projects);
let params = { headers: { "Accept": "application/json", "PRIVATE-TOKEN": `${__ENV.ACCESS_TOKEN}` } };
let res = http.get(`${__ENV.ENVIRONMENT_URL}/api/v4/projects/${project['group']}%2F${project['name']}/issues`, params);
/20(0|1)/.test(res.status) ? successRate.add(true) : (successRate.add(false), logError(res));
});
}
/*global __ENV : true */
/*
@endpoint: `GET /projects/:id/issues/:issue_iid`
@description: [Get a single project issue](https://docs.gitlab.com/ee/api/issues.html#single-issue)
*/
import http from "k6/http";
import { group } from "k6";
import { Rate } from "k6/metrics";
import { logError, checkAccessToken, getRpsThresholds, getTtfbThreshold, getProjects, selectProject } from "../../lib/gpt_k6_modules.js";
checkAccessToken();
export let rpsThresholds = getRpsThresholds()
export let ttfbThreshold = getTtfbThreshold()
export let successRate = new Rate("successful_requests")
export let options = {
thresholds: {
"successful_requests": [`rate>${__ENV.SUCCESS_RATE_THRESHOLD}`],
"http_req_waiting": [`p(90)<${ttfbThreshold}`],
"http_reqs": [`count>=${rpsThresholds['count']}`]
}
};
export let projects = getProjects(['name', 'group', 'issue_iid']);
export function setup() {
console.log('')
console.log(`RPS Threshold: ${rpsThresholds['mean']}/s (${rpsThresholds['count']})`)
console.log(`TTFB P90 Threshold: ${ttfbThreshold}ms`)
console.log(`Success Rate Threshold: ${parseFloat(__ENV.SUCCESS_RATE_THRESHOLD)*100}%`)
}
export default function() {
group("API - Issue Overview", function() {
let project = selectProject(projects);
let params = { headers: { "Accept": "application/json", "PRIVATE-TOKEN": `${__ENV.ACCESS_TOKEN}` } };
let res = http.get(`${__ENV.ENVIRONMENT_URL}/api/v4/projects/${project['group']}%2F${project['name']}/issues/${project['issue_iid']}`, params);
/20(0|1)/.test(res.status) ? successRate.add(true) : (successRate.add(false), logError(res));
});
}
/*global __ENV : true */
/*
@endpoint: `GET /:group/:project/-/issues/:issue_iid`
@description: Web - Project Issue Page. <br>Controllers: `Projects::IssuesController#show`, `Projects::IssuesController#discussions`, `Projects::IssuesController#related_branches`, `Projects::IssuesController#can_create_branch` </br>
@issue: TBC
*/
import http from "k6/http";
import { group } from "k6";
import { Rate } from "k6/metrics";
import { logError, getRpsThresholds, getTtfbThreshold, adjustRps, adjustStageVUs, getProjects, selectProject } from "../../lib/gpt_k6_modules.js";
export let endpointCount = 5
export let webProtoRps = adjustRps(__ENV.WEB_ENDPOINT_THROUGHPUT)
export let webProtoStages = adjustStageVUs(__ENV.WEB_ENDPOINT_THROUGHPUT)
export let rpsThresholds = getRpsThresholds(__ENV.WEB_ENDPOINT_THROUGHPUT, endpointCount)
export let ttfbThreshold = getTtfbThreshold(1500)
export let successRate = new Rate("successful_requests")
export let options = {
thresholds: {
"successful_requests": [`rate>${__ENV.SUCCESS_RATE_THRESHOLD}`],
"http_req_waiting{endpoint:issue}": [`p(90)<${ttfbThreshold}`],
"http_req_waiting{endpoint:realtime_changes}": [`p(90)<${ttfbThreshold}`],
"http_req_waiting{endpoint:discussions.json}": [`p(90)<${ttfbThreshold}`],
"http_req_waiting{endpoint:related_branches}": [`p(90)<${ttfbThreshold}`],
"http_req_waiting{endpoint:can_create_branch}": [`p(90)<${ttfbThreshold}`],
"http_reqs": [`count>=${rpsThresholds['count']}`],
"http_reqs{endpoint:issue}": [`count>=${rpsThresholds['count_per_endpoint']}`],
"http_reqs{endpoint:realtime_changes}": [`count>=${rpsThresholds['count_per_endpoint']}`],
"http_reqs{endpoint:discussions.json}": [`count>=${rpsThresholds['count_per_endpoint']}`],
"http_reqs{endpoint:related_branches}": [`count>=${rpsThresholds['count_per_endpoint']}`],
"http_reqs{endpoint:can_create_branch}": [`count>=${rpsThresholds['count_per_endpoint']}`]
},
rps: webProtoRps,
stages: webProtoStages
};
export let projects = getProjects(['name', 'group', 'issue_iid']);
export function setup() {
console.log('')
console.log(`Web Protocol RPS: ${webProtoRps}`)
console.log(`RPS Threshold: ${rpsThresholds['mean']}/s (${rpsThresholds['count']})`)
console.log(`RPS Threshold per Endpoint: ${rpsThresholds['mean_per_endpoint']}/s (${rpsThresholds['count_per_endpoint']})`)
console.log(`TTFB P90 Threshold: ${ttfbThreshold}ms`)
console.log(`Success Rate Threshold: ${parseFloat(__ENV.SUCCESS_RATE_THRESHOLD)*100}%`)
}
export default function() {
group("Web - Project Issue Page", function() {
let project = selectProject(projects);
let responses = http.batch([
["GET", `${__ENV.ENVIRONMENT_URL}/${project['group']}/${project['name']}/-/issues/${project['issue_iid']}`, null, {tags: {endpoint: 'issue', controller: 'Projects::IssuesController', action: 'show'}}],
["GET", `${__ENV.ENVIRONMENT_URL}/${project['group']}/${project['name']}/-/issues/${project['issue_iid']}/realtime_changes`, null, {tags: {endpoint: 'realtime_changes', controller: 'Projects::IssuesController', action: 'realtime_changes'}}],
["GET", `${__ENV.ENVIRONMENT_URL}/${project['group']}/${project['name']}/issues/${project['issue_iid']}/discussions.json`, null, {tags: {endpoint: 'discussions.json', controller: 'Projects::IssuesController', action: 'discussions.json'}}],
["GET", `${__ENV.ENVIRONMENT_URL}/${project['group']}/${project['name']}/issues/${project['issue_iid']}/related_branches`, null, {tags: {endpoint: 'related_branches', controller: 'Projects::IssuesController', action: 'related_branches'}, headers: { 'Accept': 'application/json' }}],
["GET", `${__ENV.ENVIRONMENT_URL}/${project['group']}/${project['name']}/issues/${project['issue_iid']}/can_create_branch`, null, {tags: {endpoint: 'can_create_branch', controller: 'Projects::IssuesController', action: 'can_create_branch'}, headers: { 'Accept': 'application/json' }}]
]);
responses.forEach(function(res) {
/20(0|1)/.test(res.status) ? successRate.add(true) : (successRate.add(false), logError(res));
});
});
}
/*global __ENV : true */
/*
@endpoint: `GET /:group/:project/issues`
@description: Web - Project Issues Page. <br>Controllers: `Projects::IssuesController#index`</br>
*/
import http from "k6/http";
import { group } from "k6";
import { Rate } from "k6/metrics";
import { logError, getRpsThresholds, getTtfbThreshold, adjustRps, adjustStageVUs, getProjects, selectProject } from "../../lib/gpt_k6_modules.js";
export let webProtoRps = adjustRps(__ENV.WEB_ENDPOINT_THROUGHPUT)
export let webProtoStages = adjustStageVUs(__ENV.WEB_ENDPOINT_THROUGHPUT)
export let rpsThresholds = getRpsThresholds(__ENV.WEB_ENDPOINT_THROUGHPUT)
export let ttfbThreshold = getTtfbThreshold()
export let successRate = new Rate("successful_requests")
export let options = {
thresholds: {
"successful_requests": [`rate>${__ENV.SUCCESS_RATE_THRESHOLD}`],
"http_reqs": [`count>=${rpsThresholds['count']}`],
},
rps: webProtoRps,
stages: webProtoStages
};
export let projects = getProjects(['name', 'group']);
export function setup() {
console.log('')
console.log(`Web Protocol RPS: ${webProtoRps}`)
console.log(`RPS Threshold: ${rpsThresholds['mean']}/s (${rpsThresholds['count']})`)
console.log(`TTFB P90 Threshold: ${ttfbThreshold}ms`)
console.log(`Success Rate Threshold: ${parseFloat(__ENV.SUCCESS_RATE_THRESHOLD)*100}%`)
}
export default function() {
group("Web - Project Issues Page", function() {
let project = selectProject(projects);
let res = http.get(`${__ENV.ENVIRONMENT_URL}/${project['group']}/${project['name']}/-/issues`);
/20(0|1)/.test(res.status) ? successRate.add(true) : (successRate.add(false), logError(res));
});
}
......@@ -9,20 +9,15 @@ import { group } from "k6";
import { Rate } from "k6/metrics";
import { logError, getRpsThresholds, getTtfbThreshold, adjustRps, adjustStageVUs, getProjects, selectProject } from "../../lib/gpt_k6_modules.js";
export let endpointCount = 2
export let webProtoRps = adjustRps(__ENV.WEB_ENDPOINT_THROUGHPUT)
export let webProtoStages = adjustStageVUs(__ENV.WEB_ENDPOINT_THROUGHPUT)
export let rpsThresholds = getRpsThresholds(__ENV.WEB_ENDPOINT_THROUGHPUT, endpointCount)
export let rpsThresholds = getRpsThresholds(__ENV.WEB_ENDPOINT_THROUGHPUT)
export let ttfbThreshold = getTtfbThreshold()
export let successRate = new Rate("successful_requests")
export let options = {
thresholds: {
"successful_requests": [`rate>${__ENV.SUCCESS_RATE_THRESHOLD}`],
"http_req_waiting{endpoint:merge_requests}": [`p(90)<${ttfbThreshold}`],
"http_req_waiting{endpoint:merge_requests?state=all}": [`p(90)<${ttfbThreshold}`],
"http_reqs": [`count>=${rpsThresholds['count']}`],
"http_reqs{endpoint:merge_requests}": [`count>=${rpsThresholds['count_per_endpoint']}`],
"http_reqs{endpoint:merge_requests?state=all}": [`count>=${rpsThresholds['count_per_endpoint']}`]
},
rps: webProtoRps,
stages: webProtoStages
......@@ -34,7 +29,6 @@ export function setup() {
console.log('')
console.log(`Web Protocol RPS: ${webProtoRps}`)
console.log(`RPS Threshold: ${rpsThresholds['mean']}/s (${rpsThresholds['count']})`)
console.log(`RPS Threshold per Endpoint: ${rpsThresholds['mean_per_endpoint']}/s (${rpsThresholds['count_per_endpoint']})`)
console.log(`TTFB P90 Threshold: ${ttfbThreshold}ms`)
console.log(`Success Rate Threshold: ${parseFloat(__ENV.SUCCESS_RATE_THRESHOLD)*100}%`)
}
......@@ -43,12 +37,7 @@ export default function() {
group("Web - Project Merge Requests Page", function() {
let project = selectProject(projects);
let responses = http.batch([
["GET", `${__ENV.ENVIRONMENT_URL}/${project['group']}/${project['name']}/-/merge_requests`, null, {tags: {endpoint: 'merge_requests', controller: 'Projects::MergeRequestsController', action: 'index'}}],
["GET", `${__ENV.ENVIRONMENT_URL}/${project['group']}/${project['name']}/-/merge_requests?state=all`, null, {tags: {endpoint: 'merge_requests?state=all', controller: 'Projects::MergeRequestsController', action: 'index'}}]
]);
responses.forEach(function(res) {
/20(0|1)/.test(res.status) ? successRate.add(true) : (successRate.add(false), logError(res));
});
let res = http.get(`${__ENV.ENVIRONMENT_URL}/${project['group']}/${project['name']}/-/merge_requests`);
/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