Add t.Helper annotations to Go test helpers (#253)

* Initial plan

* test: mark helper functions with t.Helper

Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>
This commit is contained in:
Copilot
2026-01-14 19:20:53 +02:00
committed by GitHub
parent 0ceb759fee
commit 7d1ef63389
6 changed files with 14 additions and 0 deletions
+2
View File
@@ -13,6 +13,8 @@ import (
)
func gcDataTestSuite(ctx context.Context, property *dbgen.Property, deleter func(p *dbgen.Property) error, t *testing.T) {
t.Helper()
const requests = 1000
tnow := time.Now()
+2
View File
@@ -65,6 +65,8 @@ func randomUUID() *pgtype.UUID {
}
func puzzleSuiteWithBackfillWait(t *testing.T, ctx context.Context, sitekey, domain string, waiter func()) {
t.Helper()
resp, err := puzzleSuite(ctx, sitekey, domain)
if err != nil {
t.Fatal(err)
+2
View File
@@ -703,6 +703,8 @@ func TestVerifyMaintenanceMode(t *testing.T) {
}
func verifyTestPropertySuite(t *testing.T, verifySitekey string, expectedCode puzzle.VerifyError) {
t.Helper()
ctx := t.Context()
puzzleStr, solutionsStr, err := solutionsSuite(ctx, db.TestPropertySitekey, "localhost")
+4
View File
@@ -29,6 +29,8 @@ func licenseTestConfig(licenseKey string) common.ConfigStore {
}
func createValidLicense(t *testing.T, keyID int, pubKey ed25519.PublicKey, privKey ed25519.PrivateKey) []byte {
t.Helper()
lm := &license.LicenseMessage{
KeyID: uint32(keyID),
UserID: "test-user-id",
@@ -57,6 +59,8 @@ func createValidLicense(t *testing.T, keyID int, pubKey ed25519.PublicKey, privK
}
func createExpiredLicense(t *testing.T, keyID int, pubKey ed25519.PublicKey, privKey ed25519.PrivateKey) []byte {
t.Helper()
lm := &license.LicenseMessage{
KeyID: uint32(keyID),
UserID: "test-user-id",
+2
View File
@@ -14,6 +14,8 @@ import (
)
func setupSessionSuite(ctx context.Context, manager *session.Manager, t *testing.T) (*session.Session, *http.Cookie) {
t.Helper()
req := httptest.NewRequest("GET", "/settings", nil)
w := httptest.NewRecorder()
+2
View File
@@ -41,6 +41,8 @@ func TestPuzzleUnmarshalFail(t *testing.T) {
}
func checkPuzzles(oldPuzzle, newPuzzle *ComputePuzzle, t *testing.T) {
t.Helper()
if !bytes.Equal(oldPuzzle.propertyID[:], newPuzzle.propertyID[:]) {
t.Errorf("PropertyID does not match")
}