Files
velero/pkg/buildinfo/version_test.go
Justin Nauman 97f8f2426f Addressing PR feedback and adding tests
Signed-off-by: Justin Nauman <justin.r.nauman@gmail.com>
2017-09-18 17:42:16 -05:00

39 lines
582 B
Go

package buildinfo
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestFormattedGitSHA(t *testing.T) {
tests := []struct {
name string
sha string
state string
expected string
}{
{
"Clean git state has no suffix",
"abc123",
"clean",
"abc123",
},
{
"Dirty git status includes suffix",
"abc123",
"dirty",
"abc123-dirty",
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
GitSHA = test.sha
GitTreeState = test.state
assert.Equal(t, FormattedGitSHA(), test.expected)
})
}
}