Skip to content

Commit

Permalink
Installer: e2e tests against unsupported minor & major versions of K8s (
Browse files Browse the repository at this point in the history
#451)

* Implemented K8s patch version masking via registry filter similar to the OS one

* Revert "Implemented K8s patch version masking via registry filter similar to the OS one"

This reverts commit fdbfbb2.

* Implemented K8s patch version masking via registry filter similar to the OS one

* Updated the registry e2e test

* Resolved hardcoded k8s version requirement from the Installer

* Resolved issue causing the installer to panic when no k8s version is specified when calling the addBundleInstaller - it now defaults to v1.22.3 if no k8s ver is specified

* Default K8s version set to v1.22 if no such is provided; Any patch subversion is accepted if supported Major and Minor versions are present.

* Added filters for K8s versions v1.21.*, v1.22.*, v1.23.*

* Revert "Added filters for K8s versions v1.21.*, v1.22.*, v1.23.*"

This reverts commit eb3a033.

* Revert "Added filters for K8s versions v1.21.*, v1.22.*, v1.23.*"

This reverts commit eb3a033.

There is a separate issue for this task.

* Updated K8s against algo mapping to require specific hardcoded mask versions

* Added empty lines between couple of comments

* Refactored the filter container from plain array to struct for consistency reasons; Updated the registry e2e tests

* Removed unused registry test variable

* Renamed the supported OS container structure to better represent it purpose.

* Added support and filters for K8s minor versions v1.21.* & v1.23.* to the installer.

* Implemented tests for unsupported K8s versions

* Resolved go lint missing space issue

* Consolidated Installer Ginkgo test Contexts to a single one as they are seving the same purpose

* Resolved golangc-lint err in an Installer Test

* Updated Installer Test to conform the updated signature of the newUnchecked() method that requires the Bundle Type
  • Loading branch information
jeuxdemains authored Apr 7, 2022
1 parent b4b9f89 commit 783badf
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions agent/installer/installer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,23 @@ var _ = Describe("Byohost Installer Tests", func() {

Context("When installer is created for unsupported OS", func() {
It("Should return error", func() {
_, err := newUnchecked("Ubuntu_99.04.3_x86-64", BundleTypeK8s, "", logr.Discard(), nil)
_, err := newUnchecked("Ubuntu_99.04.3_x86-64", "k8s", "", logr.Discard(), nil)
Expect(err).Should(HaveOccurred())
})
})
Context("When installer is created with empty download path", func() {
It("Should return error", func() {
_, err := New("", BundleTypeK8s, logr.Discard())
_, err := New("", "k8s", logr.Discard())
Expect(err).Should(HaveOccurred())
})
})
Context("When installer is created", func() {
It("Install/uninstall should return error for unsupported k8s", func() {

// Currently supported versions: v1.21.*, v1.22.*, v1.23.*
unsupportedMinorVer := "v1.20.1"
unsupportedMajorVer := "v0.21.1"

_, osList := ListSupportedOS()
for _, os := range osList {
i := NewPreviewInstaller(os, nil)
Expand All @@ -37,6 +42,18 @@ var _ = Describe("Byohost Installer Tests", func() {

err = i.Uninstall("", "unsupported-k8s", testTag)
Expect(err).Should(HaveOccurred())

err = i.Install("", unsupportedMinorVer, testTag)
Expect(err).Should(HaveOccurred())

err = i.Uninstall("", unsupportedMinorVer, testTag)
Expect(err).Should(HaveOccurred())

err = i.Install("", unsupportedMajorVer, testTag)
Expect(err).Should(HaveOccurred())

err = i.Uninstall("", unsupportedMajorVer, testTag)
Expect(err).Should(HaveOccurred())
}
})
})
Expand Down Expand Up @@ -125,7 +142,7 @@ var _ = Describe("Byohost Installer Tests", func() {
})

func NewPreviewInstaller(os string, ob algo.OutputBuilder) *installer {
i, err := newUnchecked(os, BundleTypeK8s, "", logr.Discard(), ob)
i, err := newUnchecked(os, "k8s", "", logr.Discard(), ob)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 783badf

Please sign in to comment.