Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-03-14 13:05:53 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-03-21 12:15:59 +0300
commit91f715960d12402539df049da134b4222e968fa4 (patch)
treed5b3f67ddbd98cfd20b269ab003e83827aa6486e
parent3ae739a43d7530fd33c1253b37a5716612d9fb70 (diff)
housekeeping: Mark functions as test helpers
A bunch of helper functions used in our housekeeping tests are not marked as such. Fix this.
-rw-r--r--internal/git/housekeeping/clean_stale_data_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/git/housekeeping/clean_stale_data_test.go b/internal/git/housekeeping/clean_stale_data_test.go
index ad05a1abe..3586f35ba 100644
--- a/internal/git/housekeeping/clean_stale_data_test.go
+++ b/internal/git/housekeeping/clean_stale_data_test.go
@@ -44,6 +44,8 @@ type fileEntry struct {
}
func (f *fileEntry) create(t *testing.T, parent string) {
+ t.Helper()
+
filename := filepath.Join(parent, f.name)
ff, err := os.OpenFile(filename, os.O_RDONLY|os.O_CREATE, 0o700)
assert.NoError(t, err, "file creation failed: %v", filename)
@@ -55,22 +57,29 @@ func (f *fileEntry) create(t *testing.T, parent string) {
}
func (f *fileEntry) validate(t *testing.T, parent string) {
+ t.Helper()
+
filename := filepath.Join(parent, f.name)
f.checkExistence(t, filename)
}
func (f *fileEntry) chmod(t *testing.T, filename string) {
+ t.Helper()
+
err := os.Chmod(filename, f.mode)
assert.NoError(t, err, "chmod failed")
}
func (f *fileEntry) chtimes(t *testing.T, filename string) {
+ t.Helper()
+
filetime := time.Now().Add(-f.age)
err := os.Chtimes(filename, filetime, filetime)
assert.NoError(t, err, "chtimes failed")
}
func (f *fileEntry) checkExistence(t *testing.T, filename string) {
+ t.Helper()
_, err := os.Stat(filename)
if err == nil && f.finalState == Delete {
t.Errorf("Expected %v to have been deleted.", filename)
@@ -86,6 +95,8 @@ type dirEntry struct {
}
func (d *dirEntry) create(t *testing.T, parent string) {
+ t.Helper()
+
dirname := filepath.Join(parent, d.name)
if err := os.Mkdir(dirname, 0o700); err != nil {
@@ -102,6 +113,8 @@ func (d *dirEntry) create(t *testing.T, parent string) {
}
func (d *dirEntry) validate(t *testing.T, parent string) {
+ t.Helper()
+
dirname := filepath.Join(parent, d.name)
d.checkExistence(t, dirname)