mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-03 23:04:53 -04:00
Feat/more version info (#224)
This commit is contained in:
parent
3b92b52611
commit
0c9ca50be8
3 changed files with 96 additions and 4 deletions
|
@ -3,6 +3,7 @@ package cmd
|
|||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"runtime/debug"
|
||||
"testing"
|
||||
|
||||
"github.com/edgelesssys/constellation/internal/constants"
|
||||
|
@ -23,3 +24,45 @@ func TestVersionCmd(t *testing.T) {
|
|||
assert.NoError(err)
|
||||
assert.Contains(string(s), constants.VersionInfo)
|
||||
}
|
||||
|
||||
func TestParseBuildInfo(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
info := debug.BuildInfo{
|
||||
GoVersion: "go1.18.3",
|
||||
Settings: []debug.BuildSetting{
|
||||
{
|
||||
Key: "-compiler",
|
||||
Value: "gc",
|
||||
},
|
||||
{
|
||||
Key: "GOARCH",
|
||||
Value: "amd64",
|
||||
},
|
||||
{
|
||||
Key: "GOOS",
|
||||
Value: "linux",
|
||||
},
|
||||
{
|
||||
Key: "vcs.time",
|
||||
Value: "2022-06-20T11:57:25Z",
|
||||
},
|
||||
{
|
||||
Key: "vcs.modified",
|
||||
Value: "true",
|
||||
},
|
||||
{
|
||||
Key: "vcs.revision",
|
||||
Value: "abcdef",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
commit, state, date, goVersion, compiler, platform := parseBuildInfo(&info)
|
||||
|
||||
assert.Equal("abcdef", commit)
|
||||
assert.Equal("dirty", state)
|
||||
assert.Equal("2022-06-20T11:57:25Z", date)
|
||||
assert.Equal("go1.18.3", goVersion)
|
||||
assert.Equal("gc", compiler)
|
||||
assert.Equal("linux/amd64", platform)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue