Skip to content

Relax benchmark test assertions to fix test failures on slower hardware#21

Open
ottok wants to merge 1 commit intopingcap:masterfrom
ottok:relax-test-benchmark
Open

Relax benchmark test assertions to fix test failures on slower hardware#21
ottok wants to merge 1 commit intopingcap:masterfrom
ottok:relax-test-benchmark

Conversation

@ottok
Copy link

@ottok ottok commented Feb 27, 2026

The benchmark tests were failing in Debian in 2017 (this package has been in Debian for a long time!) and were disabled in https://salsa.debian.org/go-team/packages/golang-github-pingcap-check/-/commit/d0e1f2a213ad6a4546c331490d96c288556080e8

Tests failed because they used hard-coded regex patterns that expected specific iteration counts and timing values. These expectations do not account for different hardware speeds or build environment load.

The file benchmark_test.go does not have any inline comments explaining why the tests are done line this, nor does the commit 3819dcd from 2012 explain why it was done like this. Incidentally I did talk to the author Gustavo Niemeyer a few weeks ago on another topic, but I am not going to bother him now on this tiny detail and I elected to just allow the benchmark to return any numbers.

With this change applied in Debian (https://salsa.debian.org/go-team/packages/golang-github-pingcap-check/-/commit/6456b7b5894de54f8337cb4560945bb0ad5124ea) I was able to enable the tests. This was the only test in the package, so I felt it makes sense to have it enabled even with the risk that some nuance with the result numbers is missed. At least it proves that the code runs and the rather old code built a functioning executable.

I leave it up to you as upstream to decide if you want to have this change, or if you want to submit it to your own upstream, or just ignore it, as it might be that this Go module isn't maintained anymore at all anyway (if that is the case, please put the GitHub repo in Archive mode to signify that it is no longer maintained).

Package status in Debian in case you are interested: https://tracker.debian.org/pkg/golang-github-pingcap-check

CC: @dveeden

The benchmark tests were failing because they used hard-coded regex patterns
that expected specific iteration counts and timing values. These expectations do
not account for different hardware speeds or build environment load.

Change the regex patterns to use generic digit placeholders (`\d+`) instead of
specific numeric values. This allows the tests to verify the benchmark output
formatting works correctly without being sensitive to actual performance
characteristics of the build machine.
@dveeden
Copy link

dveeden commented Feb 27, 2026

This isn't a tiup dependency, right?

@ottok
Copy link
Author

ottok commented Feb 27, 2026

Correct, it is not a TiUP dependency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants