Commit a425f782 authored by Grant Young's avatar Grant Young

Add in get_tests glob for docker tests

When specifying a glob docker tests were being missed.
parent 5100bb01
......@@ -83,7 +83,7 @@ tests.each do |test_file|
aggregated_results << RunK6.get_test_results(test_file: test_file, status: status, output: output)
aggregated_success &&= status
sleep ENV['GPT_SLEEP_BETWEEN'].to_i if ENV['GPT_SLEEP_BETWEEN']
sleep ENV['GPT_SLEEP_BETWEEN'].to_i if ENV['GPT_SLEEP_BETWEEN'] && !test_file.equal?(tests.last)
rescue Interrupt
warn Rainbow("Caught the interrupt. Stopping.").yellow
exit
......
{
"environment": {
"name": "1k",
"url": "http://1k.testbed.gitlab.net",
"config": {
"latency": "0",
"repo_storage": "gitaly"
}
},
"projects": [
{
"name": "gitlabhq",
"group": "qa-perf-testing",
"branch": "10-0-stable",
"commit_sha": "0a99e022",
"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",
"branch_name": "12-1-auto-deploy-20190714"
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"search": {
"projects": "gitlab",
"issues": "broken",
"commits": "fix",
"merge_requests": "fix",
"milestones": "2.6",
"blobs": "test",
"users": "root"
},
"issue_iid": "4218",
"user": "root"
}
]
}
{
"environment": {
"name": "3k",
"url": "http://3k.testbed.gitlab.net",
"config": {
"latency": "0",
"repo_storage": "gitaly"
}
},
"projects": [
{
"name": "gitlabhq",
"group": "qa-perf-testing",
"branch": "10-0-stable",
"commit_sha": "0a99e022",
"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",
"branch_name": "12-1-auto-deploy-20190714"
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"search": {
"projects": "gitlab",
"issues": "broken",
"commits": "fix",
"merge_requests": "fix",
"milestones": "2.6",
"blobs": "test",
"users": "root"
},
"issue_iid": "4218",
"user": "root"
},
{
"name": "gitlabhq2",
"group": "qa-perf-testing",
"branch": "10-0-stable",
"commit_sha": "0a99e022",
"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",
"branch_name": "12-1-auto-deploy-20190714"
},
"mr_commits_iid": "10495",
"mr_discussions_iid": "6958",
"search": {
"projects": "gitlab",
"issues": "broken",
"commits": "fix",
"merge_requests": "fix",
"milestones": "2.6",
"blobs": "test",
"users": "root"
},
"issue_iid": "4218",
"user": "root"
}
]
}
......@@ -6,13 +6,22 @@ When this is the case some will redirect if that dash is missing, which inflates
as they count redirects twice.
This function can be used to check if an endpoint path does redirect and pass that back into
the test and maintain the numbers. */
export function checkProjEndpointPath(projectUrl, endpointPath) {
let res = http.get(`${projectUrl}/${endpointPath}`);
if (!/20(0|1)/.test(res.status)) fail(`Failed to check if Project Endpoint path '${projectUrl}/${endpointPath}' is correct - ${res.body}`);
console.log(`Endpoint full URL is ${res.url}`)
export function checkProjEndpointDash(projectUrl, endpointPath) {
console.log(`Check if Endpoint URL '${projectUrl}/${endpointPath}' uses dash on GitLab Environment...`)
let res = http.get(`${projectUrl}/-/${endpointPath}`);
if (/20(0|1)/.test(res.status)) return `-/${endpointPath}`
let pathRegex = new RegExp(`${projectUrl}/(.*)`);
let actualPath = res.url.match(pathRegex)[1];
res = http.get(`${projectUrl}/${endpointPath}`);
if (/20(0|1)/.test(res.status)) return endpointPath
if (/30[0-9]/.test(res.status)) {
try {
let pathRegex = new RegExp(`${projectUrl}/(.*)`);
let actualPath = res.url.match(pathRegex)[1];
return actualPath
} catch (e) {
fail(`Failed to extract path from redirected URL '${res.url}' - ${e}. Exiting...`);
}
}
return actualPath
fail(`Failed to determine if Endpoint URL '${projectUrl}/${endpointPath}' is correct or uses a dash on GitLab Environment. Exiting...`);
}
......@@ -13,7 +13,7 @@ import { logError, checkAccessToken, getRpsThresholds, getTtfbThreshold, getProj
checkAccessToken();
export let rpsThresholds = getRpsThresholds()
export let ttfbThreshold = getTtfbThreshold()
export let ttfbThreshold = getTtfbThreshold(3000)
export let successRate = new Rate("successful_requests")
export let options = {
thresholds: {
......
......@@ -4,6 +4,7 @@
@description: [Get GPG signature of a commit](https://docs.gitlab.com/ee/api/commits.html#get-gpg-signature-of-a-commit)
@gitlab_version: 11.9.0
@flags: repo_storage
@issue: https://gitlab.com/gitlab-org/quality/performance/-/issues/233
*/
import http from "k6/http";
......
......@@ -10,7 +10,7 @@ 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 { checkProjEndpointPath } from "../../lib/gpt_web_functions.js";
import { checkProjEndpointDash } from "../../lib/gpt_web_functions.js";
export let endpointCount = 2
export let webProtoRps = adjustRps(__ENV.WEB_ENDPOINT_THROUGHPUT)
......@@ -43,7 +43,7 @@ export function setup() {
// Check if endpoint path has a dash \ redirect
let checkProject = selectProject(projects)
let endpointPath = checkProjEndpointPath(`${__ENV.ENVIRONMENT_URL}/${checkProject['group']}/${checkProject['name']}`, 'branches')
let endpointPath = checkProjEndpointDash(`${__ENV.ENVIRONMENT_URL}/${checkProject['group']}/${checkProject['name']}`, 'branches')
console.log(`Endpoint path is '${endpointPath}'`)
return { endpointPath };
}
......
......@@ -10,7 +10,7 @@ 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 { checkProjEndpointPath } from "../../lib/gpt_web_functions.js";
import { checkProjEndpointDash } from "../../lib/gpt_web_functions.js";
export let endpointCount = 5
export let webProtoRps = adjustRps(__ENV.WEB_ENDPOINT_THROUGHPUT)
......@@ -49,7 +49,7 @@ export function setup() {
// Check if endpoint path has a dash \ redirect
let checkProject = selectProject(projects)
let endpointPath = checkProjEndpointPath(`${__ENV.ENVIRONMENT_URL}/${checkProject['group']}/${checkProject['name']}`, 'issues')
let endpointPath = checkProjEndpointDash(`${__ENV.ENVIRONMENT_URL}/${checkProject['group']}/${checkProject['name']}`, 'issues')
console.log(`Endpoint path is '${endpointPath}'`)
return { endpointPath };
}
......
......@@ -9,7 +9,7 @@ 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 { checkProjEndpointPath } from "../../lib/gpt_web_functions.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)
......@@ -36,7 +36,7 @@ export function setup() {
// Check if endpoint path has a dash \ redirect
let checkProject = selectProject(projects)
let endpointPath = checkProjEndpointPath(`${__ENV.ENVIRONMENT_URL}/${checkProject['group']}/${checkProject['name']}`, 'issues')
let endpointPath = checkProjEndpointDash(`${__ENV.ENVIRONMENT_URL}/${checkProject['group']}/${checkProject['name']}`, 'issues')
console.log(`Endpoint path is '${endpointPath}'`)
return { endpointPath };
}
......
......@@ -11,7 +11,7 @@ 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 { checkProjEndpointPath } from "../../lib/gpt_web_functions.js";
import { checkProjEndpointDash } from "../../lib/gpt_web_functions.js";
export let endpointCount = 7
export let webProtoRps = adjustRps(__ENV.WEB_ENDPOINT_THROUGHPUT)
......@@ -46,7 +46,7 @@ export function setup() {
// Check if endpoint path has a dash \ redirect
let checkProject = selectProject(projects)
let endpointPath = checkProjEndpointPath(`${__ENV.ENVIRONMENT_URL}/${checkProject['group']}/${checkProject['name']}`, 'merge_requests')
let endpointPath = checkProjEndpointDash(`${__ENV.ENVIRONMENT_URL}/${checkProject['group']}/${checkProject['name']}`, 'merge_requests')
console.log(`Endpoint path is '${endpointPath}'`)
return { endpointPath };
}
......
......@@ -10,7 +10,7 @@ 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 { checkProjEndpointPath } from "../../lib/gpt_web_functions.js";
import { checkProjEndpointDash } from "../../lib/gpt_web_functions.js";
export let endpointCount = 2
export let webProtoRps = adjustRps(__ENV.WEB_ENDPOINT_THROUGHPUT)
......@@ -43,7 +43,7 @@ export function setup() {
// Check if endpoint path has a dash \ redirect
let checkProject = selectProject(projects)
let endpointPath = checkProjEndpointPath(`${__ENV.ENVIRONMENT_URL}/${checkProject['group']}/${checkProject['name']}`, 'merge_requests')
let endpointPath = checkProjEndpointDash(`${__ENV.ENVIRONMENT_URL}/${checkProject['group']}/${checkProject['name']}`, 'merge_requests')
console.log(`Endpoint path is '${endpointPath}'`)
return { endpointPath };
}
......
......@@ -11,7 +11,7 @@ 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 { checkProjEndpointPath } from "../../lib/gpt_web_functions.js";
import { checkProjEndpointDash } from "../../lib/gpt_web_functions.js";
export let endpointCount = 3
export let webProtoRps = adjustRps(__ENV.WEB_ENDPOINT_THROUGHPUT)
......@@ -46,7 +46,7 @@ export function setup() {
// Check if endpoint path has a dash \ redirect
let checkProject = selectProject(projects)
let endpointPath = checkProjEndpointPath(`${__ENV.ENVIRONMENT_URL}/${checkProject['group']}/${checkProject['name']}`, 'merge_requests')
let endpointPath = checkProjEndpointDash(`${__ENV.ENVIRONMENT_URL}/${checkProject['group']}/${checkProject['name']}`, 'merge_requests')
console.log(`Endpoint path is '${endpointPath}'`)
return { endpointPath };
}
......
......@@ -9,7 +9,7 @@ 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 { checkProjEndpointPath } from "../../lib/gpt_web_functions.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)
......@@ -36,7 +36,7 @@ export function setup() {
// Check if endpoint path has a dash \ redirect
let checkProject = selectProject(projects)
let endpointPath = checkProjEndpointPath(`${__ENV.ENVIRONMENT_URL}/${checkProject['group']}/${checkProject['name']}`, 'merge_requests')
let endpointPath = checkProjEndpointDash(`${__ENV.ENVIRONMENT_URL}/${checkProject['group']}/${checkProject['name']}`, 'merge_requests')
console.log(`Endpoint path is '${endpointPath}'`)
return { endpointPath };
}
......
......@@ -123,6 +123,7 @@ module RunK6
tests += Dir.glob("#{File.dirname(test_path)}/#{File.basename(test_path, File.extname(test_path))}.js")
# Add any tests given by name directly in default folder with or with extension
tests += Dir.glob("#{k6_dir}/tests/*/#{File.basename(test_path, File.extname(test_path))}.js")
tests += Dir.glob("#{ENV['GPT_DOCKER_TESTS_DIR']}/*/#{File.basename(test_path, File.extname(test_path))}.js") if ENV['GPT_DOCKER_TESTS_DIR']
end
raise "\nNo tests found in specified path(s):\n#{test_paths.join("\n")}\nExiting..." if tests.empty?
......@@ -159,7 +160,6 @@ module RunK6
stdin.close
stdout_stderr.each do |line|
raise ArgumentError, line.match(/GoError: (.*)"/)[1] if line.match?(/Missing Project Config Data:|Missing Environment Variable:/)
raise "No requests completed in time by the end of the test. This is likely due to no responses being received from the server.\n" if line.match?(/No data generated/)
output << line
puts line
......
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