Commit b9521626 authored by Grant Young's avatar Grant Young

Update web_project_files to cover all controllers

Some weren't hit previously, especially logs_tree
parent bccb93fe
......@@ -55,6 +55,7 @@ As an example, the following is one of our Environment Config Files, [`10k.json`
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"tree_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......@@ -73,6 +74,7 @@ As an example, the following is one of our Environment Config Files, [`10k.json`
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"tree_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......@@ -102,6 +104,7 @@ Details for each of the settings are as follows. Some are also available to be c
* `commit_sha_signed` - The SHA reference of a [signed commit](https://docs.gitlab.com/ee/user/project/repository/gpg_signed_commits/) available in the project.
* `compare_commits_sha` - The SHA references of two commits on the same branch that will be [compared](https://docs.gitlab.com/ee/api/repositories.html#compare-branches-tags-or-commits). The difference between the commits should be tuned to your environment's requirements.
* `file_path` - The relative path to a normal sized file in your project.
* `dir_path`- The relative path of a directory in your project that contains many files. Note that the directory must contain at least 100 files.
* `git_push_data` - Git push data that will be used for git push test. No need to change anything if you're using `gitlabhq`. To test a custom project or learn more about git push test, please refer to [`Git Push test documentation`](test_docs/git_push.md). The size of the commits should be tuned to your environment's requirements.
* `branch_current_head_sha` - The head commit of the `branch_name` branch.
* `branch_new_head_sha` - Any commit SHA that older then `branch_current_head_sha` on the `branch_name` branch.
......
......@@ -16,6 +16,7 @@
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......@@ -34,6 +35,7 @@
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......
......@@ -16,6 +16,7 @@
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......@@ -34,6 +35,7 @@
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......@@ -52,6 +54,7 @@
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......
......@@ -16,6 +16,7 @@
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......@@ -34,6 +35,7 @@
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......
......@@ -16,6 +16,7 @@
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......@@ -34,6 +35,7 @@
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......@@ -52,6 +54,7 @@
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......
......@@ -16,6 +16,7 @@
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......@@ -34,6 +35,7 @@
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......
......@@ -16,6 +16,7 @@
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "efc9f72c9ffaa76f966b8c162a9d184d7aa1ff18",
"branch_new_head_sha": "b028afaede664580e04cddf0dd98faeff28ffbef",
......
......@@ -16,6 +16,7 @@
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......
......@@ -16,6 +16,7 @@
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......
......@@ -23,7 +23,7 @@ export let options = {
}
};
export let projects = getProjects(['name', 'group']);
export let projects = getProjects(['name', 'group', 'dir_path']);
export function setup() {
console.log('')
......@@ -37,7 +37,7 @@ export default 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']}/repository/tree`, params);
let res = http.get(`${__ENV.ENVIRONMENT_URL}/api/v4/projects/${project['group']}%2F${project['name']}/repository/tree?path=${project['dir_path']}`, params);
/20(0|1)/.test(res.status) ? successRate.add(true) : (successRate.add(false), logError(res));
});
}
/*global __ENV : true */
/*
@endpoint: `GET /:group/:project/tree/master`
@description: Web - Project Files Tree. <br>Controllers: `Projects::TreeController#show`, `Projects::BlobController#show.json`</br>
@description: Web - Project Files Tree. <br>Controllers: `Projects::TreeController#show`, `Projects::BlobController#show.json`, `Projects::RefsController#logs_tree.json`</br>
@issue: https://gitlab.com/gitlab-org/gitlab/-/issues/214681
*/
import http from "k6/http";
......@@ -9,26 +10,32 @@ 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 = 6
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 rpsThresholds = getRpsThresholds(__ENV.WEB_ENDPOINT_THROUGHPUT * 0.3, endpointCount)
export let ttfbThreshold = getTtfbThreshold(4000)
export let successRate = new Rate("successful_requests")
export let options = {
thresholds: {
"successful_requests": [`rate>${__ENV.SUCCESS_RATE_THRESHOLD}`],
"http_reqs": [`count>=${rpsThresholds['count']}`]
"http_req_waiting{endpoint:tree}": [`p(90)<${ttfbThreshold}`],
"http_req_waiting{endpoint:logs_tree}": [`p(90)<${ttfbThreshold}`],
"http_reqs": [`count>=${rpsThresholds['count']}`],
"http_reqs{endpoint:tree}": [`count>=${rpsThresholds['count_per_endpoint']}`],
"http_reqs{endpoint:logs_tree}": [`count>=${rpsThresholds['count_per_endpoint']}`],
},
rps: webProtoRps,
stages: webProtoStages
};
export let projects = getProjects(['name', 'group']);
export let projects = getProjects(['name', 'group', 'dir_path']);
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}%`)
}
......@@ -37,7 +44,13 @@ export default function() {
group("Web - Project Files Tree", function() {
let project = selectProject(projects);
let res = http.get(`${__ENV.ENVIRONMENT_URL}/${project['group']}/${project['name']}/tree/master`);
let res = http.get(`${__ENV.ENVIRONMENT_URL}/${project['group']}/${project['name']}/tree/master/${project['dir_path']}`, {tags: {endpoint: 'tree', controller: 'Projects::TreeController', action: 'show'}});
/20(0|1)/.test(res.status) ? successRate.add(true) : (successRate.add(false), logError(res));
let logsTreeRes = null
for (let i = 0; i <= 100; i+=25) {
logsTreeRes = http.get(`${__ENV.ENVIRONMENT_URL}/${project['group']}/${project['name']}/refs/master/logs_tree/${project['dir_path']}?format=json&offset=${i}`, {tags: {endpoint: 'logs_tree', controller: 'Projects::RefsController', action: 'logs_tree.json'}});
/20(0|1)/.test(logsTreeRes.status) ? successRate.add(true) : (successRate.add(false), logError(logsTreeRes));
}
});
}
\ No newline at end of file
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