diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-05-20 10:58:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-20 10:58:08 +0300 |
commit | 4d1989d59c5abc9712b66c628c6742e58f7daf99 (patch) | |
tree | 4ea4cd06a2b5c3a977fbc66b296f37904836e230 /releaser/git_test.go | |
parent | a59525b05b071de020ecc457c94ad0a987040d93 (diff) |
releaser: Fix tag detection for changelog when doing a main release
Also improve the changelog slightly.
Fixes #3482
Diffstat (limited to 'releaser/git_test.go')
-rw-r--r-- | releaser/git_test.go | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/releaser/git_test.go b/releaser/git_test.go index dc1db5dc7..1c102520e 100644 --- a/releaser/git_test.go +++ b/releaser/git_test.go @@ -14,19 +14,15 @@ package releaser import ( + "os" "testing" - "runtime" - "github.com/stretchr/testify/require" ) func TestGitInfos(t *testing.T) { - if runtime.GOOS == "linux" { - // Travis has an ancient git with no --invert-grep: https://github.com/travis-ci/travis-ci/issues/6328 - t.Skip("Skip git test on Linux to make Travis happy.") - } - infos, err := getGitInfos(false) + skipIfCI(t) + infos, err := getGitInfos("v0.20", false) require.NoError(t, err) require.True(t, len(infos) > 0) @@ -51,3 +47,30 @@ See #456 require.Equal(t, 543, issues[2]) } + +func TestGitVersionTagBefore(t *testing.T) { + skipIfCI(t) + v1, err := gitVersionTagBefore("v0.18") + require.NoError(t, err) + require.Equal(t, "v0.17", v1) +} + +func TestTagExists(t *testing.T) { + skipIfCI(t) + b1, err := tagExists("v0.18") + require.NoError(t, err) + require.True(t, b1) + + b2, err := tagExists("adfagdsfg") + require.NoError(t, err) + require.False(t, b2) + +} + +func skipIfCI(t *testing.T) { + if os.Getenv("CI") != "" { + // Travis has an ancient git with no --invert-grep: https://github.com/travis-ci/travis-ci/issues/6328 + // Also Travis clones very shallowly, making some of the tests above shaky. + t.Skip("Skip git test on Linux to make Travis happy.") + } +} |