-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lca: add negative test for patching the stage from idle to rollback.
Adding a test per the title. Signed-off-by: Alexander Chuzhoy <[email protected]>
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
tests/lca/imagebasedupgrade/mgmt/negative/tests/ibu-invalid-next-stage.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package negative_test | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
"github.com/openshift-kni/eco-goinfra/pkg/lca" | ||
"github.com/openshift-kni/eco-goinfra/pkg/reportxml" | ||
. "github.com/openshift-kni/eco-gotests/tests/lca/imagebasedupgrade/mgmt/internal/mgmtinittools" | ||
"github.com/openshift-kni/eco-gotests/tests/lca/imagebasedupgrade/mgmt/negative/internal/tsparams" | ||
) | ||
|
||
var _ = Describe( | ||
"Patching ibu with a not supported next stage", | ||
Ordered, | ||
Label(tsparams.LabelStageTransition), func() { | ||
var ( | ||
ibu *lca.ImageBasedUpgradeBuilder | ||
err error | ||
) | ||
|
||
BeforeAll(func() { | ||
By("Pull the imagebasedupgrade from the cluster") | ||
ibu, err = lca.PullImageBasedUpgrade(APIClient) | ||
Expect(err).NotTo(HaveOccurred(), "error pulling ibu resource from cluster") | ||
|
||
By("Ensure that imagebasedupgrade stage is set to Idle") | ||
Expect(string(ibu.Object.Spec.Stage)).To(Equal("Idle"), "error: ibu resource contains unexpected state") | ||
}) | ||
|
||
AfterEach(func() { | ||
By("Pull the imagebasedupgrade from the cluster") | ||
ibu, err = lca.PullImageBasedUpgrade(APIClient) | ||
Expect(err).NotTo(HaveOccurred(), "error pulling imagebasedupgrade resource") | ||
|
||
if ibu.Object.Spec.Stage != "Idle" { | ||
By("Set IBU stage to Idle") | ||
_, err = ibu.WithStage("Idle").Update() | ||
Expect(err).NotTo(HaveOccurred(), "error setting ibu to idle stage") | ||
|
||
By("Wait until IBU has become Idle") | ||
_, err = ibu.WaitUntilStageComplete("Idle") | ||
Expect(err).NotTo(HaveOccurred(), "error waiting for idle stage to complete") | ||
} | ||
|
||
Expect(string(ibu.Object.Spec.Stage)).To(Equal("Idle"), "error: ibu resource contains unexpected state") | ||
}) | ||
|
||
It("fails because from Idle it's not possible to move to Rollback stage", reportxml.ID("71738"), func() { | ||
|
||
By("Setting the IBU stage to Rollback") | ||
|
||
_, err := ibu.WithStage("Rollback").Update() | ||
Expect(err.Error()).To(ContainSubstring("the stage transition is not permitted"), | ||
"error: ibu seedimage updated with wrong next stage") | ||
|
||
}) | ||
}) |