Skip to content

Commit 4ea0b46

Browse files
authored
Tests should use test files (#15801)
1 parent a229e34 commit 4ea0b46

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

modules/git/repo_test.go

+5-10
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,18 @@ package git
77
import (
88
"path/filepath"
99
"testing"
10-
"time"
1110

1211
"github.com/stretchr/testify/assert"
1312
)
1413

1514
func TestGetLatestCommitTime(t *testing.T) {
16-
lct, err := GetLatestCommitTime(".")
15+
bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
16+
lct, err := GetLatestCommitTime(bareRepo1Path)
1717
assert.NoError(t, err)
18-
// Time is in the past
19-
now := time.Now()
20-
assert.True(t, lct.Unix() < now.Unix(), "%d not smaller than %d", lct, now)
21-
// Time is after Mon Oct 23 03:52:09 2017 +0300
18+
// Time is Sun Jul 21 22:43:13 2019 +0200
2219
// which is the time of commit
23-
// d47b98c44c9a6472e44ab80efe65235e11c6da2a
24-
refTime, err := time.Parse("Mon Jan 02 15:04:05 2006 -0700", "Mon Oct 23 03:52:09 2017 +0300")
25-
assert.NoError(t, err)
26-
assert.True(t, lct.Unix() > refTime.Unix(), "%d not greater than %d", lct, refTime)
20+
// feaf4ba6bc635fec442f46ddd4512416ec43c2c2 (refs/heads/master)
21+
assert.EqualValues(t, 1563741793, lct.Unix())
2722
}
2823

2924
func TestRepoIsEmpty(t *testing.T) {

0 commit comments

Comments
 (0)