-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathversion_test.go
More file actions
39 lines (35 loc) · 874 Bytes
/
version_test.go
File metadata and controls
39 lines (35 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package aggkit
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
func TestGetVersion(t *testing.T) {
data := GetVersion()
require.NotEmpty(t, data.Version)
require.NotEmpty(t, data.GitRev)
require.NotEmpty(t, data.GitBranch)
require.NotEmpty(t, data.BuildDate)
require.NotEmpty(t, data.GoVersion)
require.NotEmpty(t, data.OS)
require.NotEmpty(t, data.Arch)
}
func TestString(t *testing.T) {
data := FullVersion{
Version: "v0.1.0",
GitRev: "undefined",
GitBranch: "undefined",
BuildDate: "Fri, 17 Jun 1988 01:58:00 +0200",
GoVersion: "go1.16.3",
OS: "linux",
Arch: "amd64",
}
fmt.Printf("%s", data.String())
require.Equal(t, `Version: v0.1.0
Git revision: undefined
Git branch: undefined
Go version: go1.16.3
Built: Fri, 17 Jun 1988 01:58:00 +0200
OS/Arch: linux/amd64
`, data.String())
}