mirror of
https://github.com/kairos-io/kairos-sdk.git
synced 2025-08-26 02:29:28 +00:00
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
|
package versioneer_test
|
||
|
|
||
|
import (
|
||
|
"github.com/kairos-io/kairos-sdk/versioneer"
|
||
|
. "github.com/onsi/ginkgo/v2"
|
||
|
. "github.com/onsi/gomega"
|
||
|
)
|
||
|
|
||
|
var _ = Describe("Validate", func() {
|
||
|
var artifact versioneer.Artifact
|
||
|
BeforeEach(func() {
|
||
|
artifact = versioneer.Artifact{
|
||
|
Flavor: "opensuse",
|
||
|
FlavorRelease: "leap-15.5",
|
||
|
Variant: "standard",
|
||
|
Model: "generic",
|
||
|
Arch: "amd64",
|
||
|
Version: "v2.4.2",
|
||
|
}
|
||
|
})
|
||
|
|
||
|
When("artifact is valid", func() {
|
||
|
It("returns nil", func() {
|
||
|
Expect(artifact.Validate()).To(BeNil())
|
||
|
})
|
||
|
})
|
||
|
|
||
|
It("returns an error when FlavorRelease is empty", func() {
|
||
|
artifact.FlavorRelease = ""
|
||
|
Expect(artifact.Validate()).To(MatchError("FlavorRelease is empty"))
|
||
|
})
|
||
|
|
||
|
It("returns an error when Variant is empty", func() {
|
||
|
artifact.Variant = ""
|
||
|
Expect(artifact.Validate()).To(MatchError("Variant is empty"))
|
||
|
})
|
||
|
|
||
|
It("returns an error when Model is empty", func() {
|
||
|
artifact.Model = ""
|
||
|
Expect(artifact.Validate()).To(MatchError("Model is empty"))
|
||
|
})
|
||
|
|
||
|
It("returns an error when Arch is empty", func() {
|
||
|
artifact.Arch = ""
|
||
|
Expect(artifact.Validate()).To(MatchError("Arch is empty"))
|
||
|
})
|
||
|
})
|