使用 git 进行压力测试

Stress Testing with git

我有一个监控 git 各种流量的应用程序。问题是我只准备处理某些事件,如提交、分支 creation/deletion、标记 creation/deletion 和注释,但还有很多其他时髦的情况 git 可以自行解决进入。

有没有人知道任何类似对大量 git 提交交互进行全面测试的东西,可以用来对旨在监控 git 流量的应用程序进行压力测试?

a thorough test of a large variety of git commit interactions

git/git/t 包括 测试,其中一些可以用作集成到压力测试中的起点。

那个“t”文件夹很有趣,因为它涵盖了 所有 git 情况。


有趣的是,Git 2.21(2019 年第一季度)使用“--stress”选项在负载下重复 运行 添加了该功能。

参见 commit fb7d1e3, commit fa84058, commit 61f292d, commit 62c379b, commit 8cf5800, commit a9b2db3, commit 0a97e86 (05 Jan 2019), and commit d45cec4 (30 Dec 2018) by SZEDER Gábor (szeder)
(由 Junio C Hamano -- gitster -- in commit 3fe47ff 合并,2019 年 1 月 18 日)

test-lib: add the '--stress' option to run a test repeatedly under load

Unfortunately, we have a few flaky tests, whose failures tend to be hard to reproduce.

We've found that the best we can do to reproduce such a failure is to run the test script repeatedly while the machine is under load, and wait in the hope that the load creates enough variance in the timing of the test's commands that a failure is eventually triggered.
I have a command to do that, and I noticed that two other contributors have rolled their own scripts to do the same, all choosing slightly different approaches.

To help reproduce failures in flaky tests, introduce the '--stress' option to run a test script repeatedly in multiple parallel jobs until one of them fails, thereby using the test script itself to increase the load on the machine.

The number of parallel jobs is determined by, in order of precedence:

  • the number specified as '--stress=<N>', or
  • the value of the GIT_TEST_STRESS_LOAD environment variable, or
  • twice the number of available processors (as reported by the 'getconf' utility), or 8.

Make '--stress' imply '--verbose -x --immediate' to get the most information about rare failures; there is really no point in spending all the extra effort to reproduce such a failure, and then not know which command failed and why.