Enhance regex for test name to output results
Staging was failing with 500 error today and so pipeline failed, but there was an issue with that some test names were empty in output:
* Environment: Staging
* Version: - `-`
* Option: 20s_2rps
* Date: 2019-12-02
* Run Time: 687.72s (Start: 01:07:14 UTC, End: 01:18:42 UTC)
NAME | RPS | RPS RESULT | RESPONSE P95 | REQUEST RESULTS | RESULT
---------------------------------------------------------|-----|------------------|--------------|-----------------|-------
api_v4_groups_group | 2/s | 1.9/s (>1.60/s) | 880.93ms | 76.31% (>95%) | Failed
api_v4_groups_projects | 2/s | 1.95/s (>1.60/s) | 228.93ms | 100.00% (>95%) | Passed
api_v4_projects_deploy_keys | 2/s | 2.0/s (>1.60/s) | 274.48ms | 100.00% (>95%) | Passed
api_v4_projects_languages | 2/s | 2.0/s (>1.60/s) | 272.86ms | 100.00% (>95%) | Passed
api_v4_projects_merge_requests | 2/s | 1.5/s (>0.80/s) | 2132.32ms | 100.00% (>95%) | Passed
api_v4_projects_merge_requests_merge_request | 2/s | 2.0/s (>1.60/s) | 227.86ms | 100.00% (>95%) | Passed
api_v4_projects_merge_requests_merge_request_changes | 2/s | 2.0/s (>1.60/s) | 160.77ms | 100.00% (>95%) | Passed
api_v4_projects_merge_requests_merge_request_commits | 2/s | 2.0/s (>1.60/s) | 201.61ms | 100.00% (>95%) | Passed
api_v4_projects_merge_requests_merge_request_discussions | 2/s | 1.85/s (>0.80/s) | 687.42ms | 100.00% (>95%) | Passed
api_v4_projects_project | 2/s | 2.0/s (>1.60/s) | 360.92ms | 100.00% (>95%) | Passed
api_v4_projects_project_pipelines | 2/s | 2.0/s (>1.60/s) | 288.13ms | 100.00% (>95%) | Passed
api_v4_projects_project_search_blobs | 2/s | 1.9/s (>0.80/s) | 325.90ms | 100.00% (>95%) | Passed
api_v4_projects_repository_branches_branch | 2/s | 2.0/s (>0.80/s) | 251.95ms | 100.00% (>95%) | Passed
api_v4_projects_repository_commits | 2/s | 2.0/s (>1.60/s) | 287.50ms | 100.00% (>95%) | Passed
api_v4_projects_repository_commits_sha | 2/s | 2.0/s (>1.60/s) | 200.44ms | 100.00% (>95%) | Passed
api_v4_projects_repository_commits_sha_diff | 2/s | 2.0/s (>1.60/s) | 179.65ms | 100.00% (>95%) | Passed
api_v4_projects_repository_commits_sha_signature | 2/s | 2.0/s (>1.60/s) | 231.48ms | 100.00% (>95%) | Passed
api_v4_projects_repository_files_file | 2/s | 2.0/s (>1.60/s) | 210.56ms | 100.00% (>95%) | Passed
api_v4_projects_repository_files_file_raw | 2/s | 2.0/s (>1.60/s) | 487.10ms | 100.00% (>95%) | Passed
api_v4_projects_repository_tree | 2/s | 2.0/s (>1.60/s) | 205.94ms | 100.00% (>95%) | Passed
api_v4_user | 2/s | 2.0/s (>1.60/s) | 198.80ms | 100.00% (>95%) | Passed
| 2/s | 0.9/s (>0.80/s) | 894.65ms | 50.00% (>95%) | Failed
git_pull | 1/s | 1.0/s (>0.80/s) | 603.06ms | 100.00% (>95%) | Passed
scenario_api_new_issues | 1/s | 1.2/s (>0.80/s) | 1085.58ms | 100.00% (>95%) | Passed
| 1/s | 0.55/s (>0.80/s) | 5228.85ms | 81.81% (>95%) | Failed
| 1/s | 0.45/s (>0.80/s) | 6394.62ms | 88.88% (>95%) | Failed
| 1/s | 0.05/s (>0.80/s) | 10211.93ms | 0.00% (>95%) | Failed
| 1/s | 0.05/s (>0.80/s) | 10210.89ms | 0.00% (>95%) | Failed
| 1/s | 0.1/s (>0.80/s) | 9725.80ms | 50.00% (>95%) | Failed
| 1/s | 0.15/s (>0.80/s) | 9188.13ms | 33.33% (>95%) | Failed
| 1/s | 0.15/s (>0.80/s) | 9235.54ms | 66.66% (>95%) | Failed
| 1/s | 0.4/s (>0.80/s) | 6862.66ms | 87.50% (>95%) | Failed
Problem
The problem here was that failing message had href=\"javascript:history.back()
in error output and so the regex /script:/
used this line to look for test name and couldn't find one, so it was empty:
time="2019-12-02T01:14:43Z" level=warning msg="Error detected: '<!DOCTYPE html>\n<html>\n<head>\n <meta content=\"width=device-width, initial-scale=1, maximum-scale=1\" name=\"viewport\">\n <title>Something went wrong (500)</title>\n <style>\n body {\n color: #666;\n text-align: center;\n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n margin: auto;\n font-size: 14px;\n }\n\n h1 {\n font-size: 56px;\n line-height: 100px;\n font-weight: 400;\n color: #456;\n }\n\n h2 {\n font-size: 24px;\n color: #666;\n line-height: 1.5em;\n }\n\n h3 {\n color: #456;\n font-size: 20px;\n font-weight: 400;\n line-height: 28px;\n }\n\n hr {\n max-width: 800px;\n margin: 18px auto;\n border: 0;\n border-top: 1px solid #EEE;\n border-bottom: 1px solid white;\n }\n\n img {\n max-width: 40vw;\n display: block;\n margin: 40px auto;\n }\n\n a {\n line-height: 100px;\n font-weight: 400;\n color: #4A8BEE;\n font-size: 18px;\n text-decoration: none;\n }\n\n .container {\n margin: auto 20px;\n }\n\n .go-back {\n display: none;\n }\n\n </style>\n</head>\n\n<body>\n <a href=\"/\">\n <img src=\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEwIiBoZWlnaHQ9IjIxMCIgdmlld0JveD0iMCAwIDIxMCAyMTAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHBhdGggZD0iTTEwNS4wNjE0IDIwMy42NTVsMzguNjQtMTE4LjkyMWgtNzcuMjhsMzguNjQgMTE4LjkyMXoiIGZpbGw9IiNlMjQzMjkiLz4KICA8cGF0aCBkPSJNMTA1LjA2MTQgMjAzLjY1NDhsLTM4LjY0LTExOC45MjFoLTU0LjE1M2w5Mi43OTMgMTE4LjkyMXoiIGZpbGw9IiNmYzZkMjYiLz4KICA8cGF0aCBkPSJNMTIuMjY4NSA4NC43MzQxbC0xMS43NDIgMzYuMTM5Yy0xLjA3MSAzLjI5Ni4xMDIgNi45MDcgMi45MDYgOC45NDRsMTAxLjYyOSA3My44MzgtOTIuNzkzLTExOC45MjF6IiBmaWxsPSIjZmNhMzI2Ii8+CiAgPHBhdGggZD0iTTEyLjI2ODUgODQuNzM0Mmg1NC4xNTNsLTIzLjI3My03MS42MjVjLTEuMTk3LTMuNjg2LTYuNDExLTMuNjg1LTcuNjA4IDBsLTIzLjI3MiA3MS42MjV6IiBmaWxsPSIjZTI0MzI5Ii8+CiAgPHBhdGggZD0iTTEwNS4wNjE0IDIwMy42NTQ4bDM4LjY0LTExOC45MjFoNTQuMTUzbC05Mi43OTMgMTE4LjkyMXoiIGZpbGw9IiNmYzZkMjYiLz4KICA8cGF0aCBkPSJNMTk3Ljg1NDQgODQuNzM0MWwxMS43NDIgMzYuMTM5YzEuMDcxIDMuMjk2LS4xMDIgNi45MDctMi45MDYgOC45NDRsLTEwMS42MjkgNzMuODM4IDkyLjc5My0xMTguOTIxeiIgZmlsbD0iI2ZjYTMyNiIvPgogIDxwYXRoIGQ9Ik0xOTcuODU0NCA4NC43MzQyaC01NC4xNTNsMjMuMjczLTcxLjYyNWMxLjE5Ny0zLjY4NiA2LjQxMS0zLjY4NSA3LjYwOCAwbDIzLjI3MiA3MS42MjV6IiBmaWxsPSIjZTI0MzI5Ii8+Cjwvc3ZnPgo=\"\n alt=\"GitLab Logo\" />\n </a>\n <h1>\n 500\n </h1>\n <div class=\"container\">\n <h3>Whoops, something went wrong on our end.</h3>\n <hr />\n <p>Try refreshing the page, or going back and attempting the action again.</p>\n <p>Please contact your GitLab administrator if this problem persists.</p>\n <a href=\"javascript:history.back()\" class=\"js-go-back go-back\">Go back</a>\n </div>\n <script>\n (function () {\n var goBack = document.querySelector('.js-go-back');\n\n if (history.length > 1) {\n goBack.style.display = 'inline';\n }\n })();\n </script>\n</body>\n</html>\n'"
Solution
Enhance regex to search for a string starting with script:
ignoring whitespaces in the beginning of the string: /^\s*script: /