Commit f4f13f39 authored by Grant Young's avatar Grant Young

Merge branch 'gy-file-blame' into 'master'

Change target test file and add File Blame tests

Closes #80 and #243

See merge request !157
parents 66795f58 675c009a
......@@ -54,7 +54,7 @@ As an example, the following is one of our Environment Config Files, [`10k.json`
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......@@ -81,7 +81,7 @@ As an example, the following is one of our Environment Config Files, [`10k.json`
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......
......@@ -15,7 +15,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......@@ -43,7 +43,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......
......@@ -15,7 +15,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......
......@@ -15,7 +15,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......@@ -43,7 +43,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......@@ -71,7 +71,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......
......@@ -15,7 +15,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......
......@@ -15,7 +15,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......@@ -43,7 +43,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......
......@@ -15,7 +15,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......@@ -43,7 +43,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......@@ -71,7 +71,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......@@ -99,7 +99,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
"branch_new_head_sha": "8bcb4fd6f5780ebe9dc1ec80904b060b89a937d2",
......
......@@ -15,7 +15,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......@@ -43,7 +43,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......
......@@ -15,7 +15,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "efc9f72c9ffaa76f966b8c162a9d184d7aa1ff18",
......
......@@ -15,7 +15,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......
......@@ -15,7 +15,7 @@
"commit_sha": "0a99e022",
"commit_sha_signed": "6526e91f",
"compare_commits_sha": ["aec887ab", "5bfb7558"],
"file_path": "qa%2fqa%2erb",
"file_path": "fixtures%2femojis%2findex%2ejson",
"dir_path": "app%2Fassets%2Fimages%2Femoji",
"git_push_data": {
"branch_current_head_sha": "8606c89683c913641243fc667edeb90600fe1a0e",
......
/*global __ENV : true */
/*
@endpoint: `GET /projects/:id/repository/files/:file_path/blame`
@description: [Get blame information about file in repository](https://docs.gitlab.com/ee/api/repository_files.html#get-file-blame-from-repository)
@flags: repo_storage
@issue: https://gitlab.com/gitlab-org/gitlab/-/issues/217570
*/
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 = __ENV.ENVIRONMENT_REPO_STORAGE == "nfs" ? getRpsThresholds(0.01) : getRpsThresholds(0.01)
export let ttfbThreshold = __ENV.ENVIRONMENT_REPO_STORAGE == "nfs" ? getTtfbThreshold(30000) : getTtfbThreshold(30000)
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', 'file_path']);
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 - Project Repository File Blame", 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/files/${project['file_path']}/blame?ref=master`, params);
/20(0|1)/.test(res.status) ? successRate.add(true) : (successRate.add(false), logError(res));
});
}
......@@ -4,7 +4,7 @@
@description: [Global Search API](https://docs.gitlab.com/ee/api/search.html#global-search-api)
@gitlab_settings: { "elasticsearch_indexing": true, "elasticsearch_search": true }
@flags: search
@issue: https://gitlab.com/gitlab-org/gitlab/-/issues/214482, https://gitlab.com/gitlab-org/gitlab/-/issues/214830
@issue: https://gitlab.com/groups/gitlab-org/-/epics/3166
*/
import http from "k6/http";
......
......@@ -4,7 +4,7 @@
@description: [Group Search API](https://docs.gitlab.com/ee/api/search.html#group-search-api)
@gitlab_settings: { "elasticsearch_indexing": true, "elasticsearch_search": true }
@flags: search
@issue: https://gitlab.com/gitlab-org/gitlab/-/issues/214482, https://gitlab.com/gitlab-org/gitlab/-/issues/214830
@issue: https://gitlab.com/groups/gitlab-org/-/epics/3166
*/
import http from "k6/http";
......
......@@ -4,7 +4,7 @@
@description: [Project Search API](https://docs.gitlab.com/ee/api/search.html#project-search-api)
@gitlab_settings: { "elasticsearch_indexing": true, "elasticsearch_search": true }
@flags: search
@issue: https://gitlab.com/gitlab-org/gitlab/-/issues/214482, https://gitlab.com/gitlab-org/gitlab/-/issues/214830
@issue: https://gitlab.com/groups/gitlab-org/-/epics/3166
*/
import http from "k6/http";
......
......@@ -3,6 +3,7 @@
@endpoint: `GET /:group/:project/blob/master/:file_path`
@description: Web - Project Blob File. <br>Controllers: `Projects::BlobController#show`, `Projects::BlobController#show.json`</br>
@flags: repo_storage
@issue: https://gitlab.com/gitlab-org/gitlab/-/issues/217580
*/
import http from "k6/http";
......@@ -13,8 +14,8 @@ import { logError, getRpsThresholds, getTtfbThreshold, adjustRps, adjustStageVUs
export let endpointCount = 2
export let webProtoRps = adjustRps(__ENV.WEB_ENDPOINT_THROUGHPUT)
export let webProtoStages = adjustStageVUs(__ENV.WEB_ENDPOINT_THROUGHPUT)
export let rpsThresholds = __ENV.ENVIRONMENT_REPO_STORAGE == "nfs" ? getRpsThresholds(__ENV.WEB_ENDPOINT_THROUGHPUT * 0.5, endpointCount) : getRpsThresholds(__ENV.WEB_ENDPOINT_THROUGHPUT, endpointCount)
export let ttfbThreshold = __ENV.ENVIRONMENT_REPO_STORAGE == "nfs" ? getTtfbThreshold(1000) : getTtfbThreshold()
export let rpsThresholds = __ENV.ENVIRONMENT_REPO_STORAGE == "nfs" ? getRpsThresholds(__ENV.WEB_ENDPOINT_THROUGHPUT * 0.1, endpointCount) : getRpsThresholds(__ENV.WEB_ENDPOINT_THROUGHPUT * 0.1, endpointCount)
export let ttfbThreshold = __ENV.ENVIRONMENT_REPO_STORAGE == "nfs" ? getTtfbThreshold(5000) : getTtfbThreshold(5000)
export let successRate = new Rate("successful_requests")
export let options = {
thresholds: {
......
/*global __ENV : true */
/*
@endpoint: `GET /:group/:project/blame/master/:file_path`
@description: Web - Project File Blame Page. <br>Controllers: `Projects::BlameController#show`</br>
@issue: https://gitlab.com/gitlab-org/gitlab/-/issues/217572
*/
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";
import { checkProjEndpointDash } from "../../lib/gpt_web_functions.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 * 0.01)
export let ttfbThreshold = getTtfbThreshold(20000)
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}%`)
// Check if endpoint path has a dash \ redirect
let checkProject = selectProject(projects)
let endpointPath = checkProjEndpointDash(`${__ENV.ENVIRONMENT_URL}/${checkProject['group']}/${checkProject['name']}`, `blame/master/${checkProject['file_path']}`)
console.log(`Endpoint path is '${endpointPath}'`)
return { endpointPath };
}
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'}});
/20(0|1)/.test(res.status) ? successRate.add(true) : (successRate.add(false), logError(res));
});
}
......@@ -4,7 +4,7 @@
@description: Web - Global Search <br>Controllers: `SearchController#show`,`SearchController#count`</br>
@gitlab_settings: { "elasticsearch_indexing": true, "elasticsearch_search": true }
@flags: search
@issue: https://gitlab.com/gitlab-org/gitlab/-/issues/214830
@issue: https://gitlab.com/groups/gitlab-org/-/epics/3166
*/
import http from "k6/http";
......
......@@ -4,7 +4,7 @@
@description: Web - Group Search <br>Controllers: `SearchController#show`,`SearchController#count`</br>
@gitlab_settings: { "elasticsearch_indexing": true, "elasticsearch_search": true }
@flags: search
@issue: https://gitlab.com/gitlab-org/gitlab/-/issues/214830
@issue: https://gitlab.com/groups/gitlab-org/-/epics/3166
*/
import http from "k6/http";
......
......@@ -4,7 +4,7 @@
@description: Web - Projects Search <br>Controllers: `SearchController#show`,`SearchController#count`</br>
@gitlab_settings: { "elasticsearch_indexing": true, "elasticsearch_search": true }
@flags: search
@issue: https://gitlab.com/gitlab-org/gitlab/-/issues/214830
@issue: https://gitlab.com/groups/gitlab-org/-/epics/3166
*/
import http from "k6/http";
......
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