Skip to content

Ensure tests do not run against hardcoded branch names

John McDonnell requested to merge jmd/allow-generic-default-branch into main

GPT makes assumptions relating to what branch name may exist in a repository. Instead we should allow this to be configured on a per project basis, so that we can make use of projects that may have difference branch naming conventions.

To do this, let's add a new default_branch configuration value which can reflect the name of a branch which we expect to be present in the project. This can be configured on a per project basis, and may reflect the value set by init.defaultBranch but can be customized to point to any given branch as required.

Closes Add ability to configure target branch (#589 - closed)

To verify

  • Edit k6/config/projects/gitlabhq.json and set the branch value to foobar
  • Run Scripts: (they should fail as the branch doesn't exit)
  • Navigate to your test project e.g. http://gdk.test:3000/gpt/large_projects/gitlabhq1 and add a branch foobar with base master
  • Run Scripts: they should pass
./bin/run-k6 --environment gdk.json --options 5s_2rps.json --tests \
k6/tests/api/api_v4_projects_repository_files_file.js \
k6/tests/api/api_v4_projects_repository_files_file_blame.js \
k6/tests/api/api_v4_projects_repository_files_file_raw.js \
k6/tests/web/web_project_commits.js \
k6/tests/web/web_project_file_blame.js \
k6/tests/web/web_project_file_rendered.js \
k6/tests/web/web_project_file_source.js \
k6/tests/web/web_project_files.js
Edited by John McDonnell

Merge request reports