2026-03-02 18:41:14 +00:00
|
|
|
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) {
|
chore(lint): enhance golangci configuration and add security annotations
- Expand .golangci.yml with more linters (bodyclose, errcheck, etc.), settings for govet, revive, gocritic, gosec
- Add // nolint:gosec comments for intentional file operations and subprocesses
- Change file write permissions from 0644 to 0600 for better security
- Refactor loops, error handling, and test parallelism with t.Parallel()
- Minor fixes: ignore unused args, use errors.Is, adjust mkdir permissions to 0750
2026-03-04 20:00:32 +00:00
|
|
|
t.Parallel()
|
2026-03-02 18:41:14 +00:00
|
|
|
tt.check(t)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|