Skip to content

Commit 26b0dcc

Browse files
committed
fix tests
1 parent 5b5db53 commit 26b0dcc

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

modules/git/commit_test.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,26 @@
55
package git
66

77
import (
8-
"path/filepath"
98
"testing"
109

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

1413
func TestCommitsCount(t *testing.T) {
15-
p, err := filepath.Abs("../../")
14+
// TODO: since drone will only git clone -depth=50, this should be moved to recent commit id
15+
commitsCount, err := CommitsCount("", "22d3d029e6f7e6359f3a6fbe8b7827b579ac7445")
1616
assert.NoError(t, err)
17-
commitsCount, err := CommitsCount(p, "a30e5bcaf83a82f5f7d1c89a6f9f7e52036d74af")
18-
assert.NoError(t, err)
19-
assert.Equal(t, int64(6), commitsCount)
17+
assert.Equal(t, int64(7287), commitsCount)
2018
}
2119

2220
func TestGetFullCommitID(t *testing.T) {
23-
p, err := filepath.Abs("../../")
24-
assert.NoError(t, err)
25-
id, err := GetFullCommitID(p, "a30e5bca")
21+
id, err := GetFullCommitID("", "22d3d029")
2622
assert.NoError(t, err)
27-
assert.Equal(t, "a30e5bcaf83a82f5f7d1c89a6f9f7e52036d74af", id)
23+
assert.Equal(t, "22d3d029e6f7e6359f3a6fbe8b7827b579ac7445", id)
2824
}
2925

3026
func TestGetFullCommitIDError(t *testing.T) {
31-
p, err := filepath.Abs("../../")
32-
assert.NoError(t, err)
33-
id, err := GetFullCommitID(p, "unknown")
27+
id, err := GetFullCommitID("", "unknown")
3428
assert.Empty(t, id)
3529
if assert.Error(t, err) {
3630
assert.EqualError(t, err, "object does not exist [id: unknown, rel_path: ]")

0 commit comments

Comments
 (0)