From 94dec475ff29da2bf8034205a576e3e56d8b3fcf Mon Sep 17 00:00:00 2001 From: Shota FUJI Date: Tue, 4 Aug 2026 09:56:06 +0900 Subject: [PATCH] Add load test for commit page with large diff The commit page is so slow on large-ish diffs. --- tests/k6/create_repos.bash | 18 ++++++++++++++++++ tests/k6/spam_repo_commit_large_diff.js | 12 ++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 tests/k6/spam_repo_commit_large_diff.js diff --git a/tests/k6/create_repos.bash b/tests/k6/create_repos.bash index d2e955a..83ce9fb 100755 --- a/tests/k6/create_repos.bash +++ b/tests/k6/create_repos.bash @@ -64,5 +64,23 @@ git ${GIT_FLAGS[@]} -C foo commit \ -m "Create Go application entrypoint" \ --date "2026-06-06T12:01:00+09:00" +echo "first write, start" > foo/diff-whole.txt +for i in $(seq 1 9999); do + echo "first write, #$i" >> foo/diff-whole.txt +done +git ${GIT_FLAGS[@]} -C foo add diff-whole.txt +git ${GIT_FLAGS[@]} -C foo commit \ + -m "diff-whole.txt, first write" \ + --date "2026-06-06T12:01:00+09:00" + +echo "second write, start" > foo/diff-whole.txt +for i in $(seq 1 9999); do + echo "second write, #$i" >> foo/diff-whole.txt +done +git ${GIT_FLAGS[@]} -C foo add diff-whole.txt +git ${GIT_FLAGS[@]} -C foo commit \ + -m "diff-whole.txt, second write" \ + --date "2026-06-06T12:02:00+09:00" + git clone --bare foo foo.git rm -rf foo diff --git a/tests/k6/spam_repo_commit_large_diff.js b/tests/k6/spam_repo_commit_large_diff.js new file mode 100644 index 0000000..19091c6 --- /dev/null +++ b/tests/k6/spam_repo_commit_large_diff.js @@ -0,0 +1,12 @@ +// Copyright 2026 Shota FUJI +// SPDX-License-Identifier: MIT + +import http from "k6/http"; + +export const options = { + iterations: 10, +}; + +export default function() { + http.get("http://localhost:8080/foo.git/commit/0aacdb88132758978fada845ee2438aa1db094fd"); +} -- 2.51.2