provider-kairos/tests/provider_upgrade_test.go
Dimitris Karakasilis f01235ea6a
Remove the "stable" filtering in available_release response
because all our versions are considered pre-releases in standard
semantic versioning. E.g.

v1.0.0-k3sv1.23.9-k3s1

this also has a "pre-release" part (everything after the `-`).

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
2022-11-07 10:32:47 +02:00

48 lines
1.1 KiB
Go

// nolint
package mos_test
import (
"encoding/json"
"github.com/kairos-io/kairos/tests/machine"
"github.com/mudler/go-pluggable"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"golang.org/x/mod/semver"
)
var _ = Describe("provider upgrade test", Label("provider-upgrade"), func() {
BeforeEach(func() {
machine.EventuallyConnects()
})
AfterEach(func() {
if CurrentGinkgoTestDescription().Failed {
gatherLogs()
}
})
Context("agent.available_releases event", func() {
It("returns the available versions ordered", func() {
resultStr, _ := machine.SSHCommand(`echo '{}' | /system/providers/agent-provider-kairos agent.available_releases`)
var result pluggable.EventResponse
err := json.Unmarshal([]byte(resultStr), &result)
Expect(err).ToNot(HaveOccurred())
Expect(result.Data).ToNot(BeEmpty())
var versions []string
json.Unmarshal([]byte(result.Data), &versions)
Expect(versions).ToNot(BeEmpty())
sorted := make([]string, len(versions))
copy(sorted, versions)
semver.Sort(sorted)
Expect(sorted).To(Equal(versions))
})
})
})