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-12-14 11:02:40 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-12-15 09:58:55 +0300
commit5e6d95b0ec04c3e27ed8e00c2abe6a9601d66492 (patch)
treed2dd0ebc04a159807c1738663f4968c7f4657d2e
parente35b061ec3cd7dbf0d9d11529834aac5926d2f95 (diff)
repository: Stop executing touch(1) in tests
We use the touch(1) executable to update mtimes of on-disk files in one of our tests. Update the test to instead just use `os.Chtimes()`.
-rw-r--r--internal/gitaly/service/repository/gc_test.go3
-rw-r--r--internal/gitaly/service/repository/testhelper_test.go3
2 files changed, 1 insertions, 5 deletions
diff --git a/internal/gitaly/service/repository/gc_test.go b/internal/gitaly/service/repository/gc_test.go
index 00a0e19e3..b3f8f54f5 100644
--- a/internal/gitaly/service/repository/gc_test.go
+++ b/internal/gitaly/service/repository/gc_test.go
@@ -72,8 +72,7 @@ func TestGarbageCollectSuccess(t *testing.T) {
t.Run(test.desc, func(t *testing.T) {
// Reset mtime to a long while ago since some filesystems don't have sub-second
// precision on `mtime`.
- // Stamp taken from https://golang.org/pkg/time/#pkg-constants
- testhelper.MustRunCommand(t, nil, "touch", "-t", testTimeString, packPath)
+ require.NoError(t, os.Chtimes(packPath, testTime, testTime))
//nolint:staticcheck
c, err := client.GarbageCollect(ctx, test.req)
assert.NoError(t, err)
diff --git a/internal/gitaly/service/repository/testhelper_test.go b/internal/gitaly/service/repository/testhelper_test.go
index 0d306d327..e688ac69a 100644
--- a/internal/gitaly/service/repository/testhelper_test.go
+++ b/internal/gitaly/service/repository/testhelper_test.go
@@ -30,9 +30,6 @@ import (
"google.golang.org/grpc"
)
-// Stamp taken from https://golang.org/pkg/time/#pkg-constants
-const testTimeString = "200601021504.05"
-
var testTime = time.Date(2006, 1, 2, 15, 4, 5, 0, time.UTC)
func TestMain(m *testing.M) {