forked from Azure/acs-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
version_test.go
45 lines (34 loc) · 1.19 KB
/
version_test.go
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
40
41
42
43
44
45
package cmd
import (
"fmt"
"github.com/Azure/acs-engine/pkg/helpers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("the version command", func() {
It("should create a version command", func() {
output := newVersionCmd()
Expect(output.Use).Should(Equal(versionName))
Expect(output.Short).Should(Equal(versionShortDescription))
Expect(output.Long).Should(Equal(versionLongDescription))
Expect(output.Flags().Lookup("output")).NotTo(BeNil())
})
It("should print a json version of ACS-Engine", func() {
output := getVersion("json")
expectedOutput, _ := helpers.JSONMarshalIndent(version, "", " ", false)
Expect(output).Should(Equal(string(expectedOutput)))
})
It("should print a humanized version of ACS-Engine", func() {
output := getVersion("human")
expectedOutput := fmt.Sprintf("Version: %s\nGitCommit: %s\nGitTreeState: %s",
BuildTag,
BuildSHA,
GitTreeState)
Expect(output).Should(Equal(expectedOutput))
})
It("should print a json version of ACS-Engine", func() {
output := getVersion("json")
expectedOutput, _ := helpers.JSONMarshalIndent(version, "", " ", false)
Expect(output).Should(Equal(string(expectedOutput)))
})
})