test(version): add tests for version information
Add unit tests to verify that Version is set and note that Commit and BuildDate may be empty in development builds. Update .gitignore to ignore the .junie/ directory.
This commit is contained in:
parent
24be047322
commit
68df041a09
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
.idea/
|
||||
.junie/
|
||||
build/
|
||||
grokkit
|
||||
*.bak
|
||||
|
||||
39
internal/version/version_test.go
Normal file
39
internal/version/version_test.go
Normal file
@ -0,0 +1,39 @@
|
||||
package version
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestVersionInfo(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
check func(*testing.T)
|
||||
}{
|
||||
{
|
||||
name: "Version",
|
||||
check: func(t *testing.T) {
|
||||
if Version == "" {
|
||||
t.Error("Version should be set")
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Commit",
|
||||
check: func(t *testing.T) {
|
||||
// Commit can be empty in dev builds
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "BuildDate",
|
||||
check: func(t *testing.T) {
|
||||
// BuildDate can be empty in dev builds
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
tt.check(t)
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user