Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions fdbkubernetesmonitor/api/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,27 @@ import (
)

var _ = Describe("[api] FDBVersion", func() {
When("marshaling and unmarshaling a Version as JSON", func() {
It("should round-trip a stable version", func() {
original := Version{Major: 7, Minor: 3, Patch: 27}
Comment thread
Ronitsabhaya75 marked this conversation as resolved.
data, err := json.Marshal(&original)
Expect(err).NotTo(HaveOccurred())
Expect(string(data)).To(Equal(`"7.3.27"`))

var decoded Version
Expect(json.Unmarshal(data, &decoded)).To(Succeed())
Expect(decoded).To(Equal(original))
})

It("should return an error when unmarshaling invalid version strings", func() {
for _, invalidVersion := range []string{`"not-a-version"`, `"7.3"`} {
var decoded Version
err := json.Unmarshal([]byte(invalidVersion), &decoded)
Expect(err).To(HaveOccurred())
}
})
})

When("checking if the protocol and the version are compatible", func() {
It("should return the correct compatibility", func() {
version := Version{Major: 6, Minor: 2, Patch: 20}
Expand Down