-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ibu cnf: add prep abort test case (#13)
- Loading branch information
Showing
2 changed files
with
101 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
99 changes: 99 additions & 0 deletions
99
tests/lca/imagebasedupgrade/cnf/upgrade-talm/tests/prep-abort-test.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,99 @@ | ||
package upgrade_test | ||
|
||
import ( | ||
"time" | ||
|
||
"k8s.io/utils/ptr" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
"github.com/openshift-kni/eco-goinfra/pkg/cgu" | ||
"github.com/openshift-kni/eco-goinfra/pkg/reportxml" | ||
"github.com/openshift-kni/eco-gotests/tests/lca/imagebasedupgrade/cnf/internal/cnfclusterinfo" | ||
"github.com/openshift-kni/eco-gotests/tests/lca/imagebasedupgrade/cnf/internal/cnfhelper" | ||
"github.com/openshift-kni/eco-gotests/tests/lca/imagebasedupgrade/cnf/internal/cnfinittools" | ||
"github.com/openshift-kni/eco-gotests/tests/lca/imagebasedupgrade/cnf/upgrade-talm/internal/tsparams" | ||
) | ||
|
||
var _ = Describe( | ||
"Performing upgrade prep abort flow", | ||
Label(tsparams.LabelPrepAbortFlow), func() { | ||
|
||
BeforeEach(func() { | ||
By("Fetching target sno cluster name", func() { | ||
err := cnfclusterinfo.PreUpgradeClusterInfo.SaveClusterInfo() | ||
Expect(err).ToNot(HaveOccurred(), "Failed to extract target sno cluster name") | ||
|
||
tsparams.TargetSnoClusterName = cnfclusterinfo.PreUpgradeClusterInfo.Name | ||
|
||
}) | ||
}) | ||
|
||
AfterEach(func() { | ||
// Deleting CGUs created for validating the test. | ||
By("Deleting pre-prep cgu created on target hub cluster", func() { | ||
err := cnfhelper.DeleteIbuTestCguOnTargetHub(cnfinittools.TargetHubAPIClient, tsparams.PrePrepCguName, | ||
tsparams.IbuCguNamespace) | ||
Expect(err).ToNot(HaveOccurred(), "Failed to delete pre-prep cgu on target hub cluster") | ||
}) | ||
|
||
By("Deleting prep cgu created on target hub cluster", func() { | ||
err := cnfhelper.DeleteIbuTestCguOnTargetHub(cnfinittools.TargetHubAPIClient, tsparams.PrepCguName, | ||
tsparams.IbuCguNamespace) | ||
Expect(err).ToNot(HaveOccurred(), "Failed to delete prep cgu on target hub cluster") | ||
}) | ||
|
||
By("Deleting finalize cgu created on target hub cluster", func() { | ||
err := cnfhelper.DeleteIbuTestCguOnTargetHub(cnfinittools.TargetHubAPIClient, tsparams.FinalizeCguName, | ||
tsparams.IbuCguNamespace) | ||
Expect(err).ToNot(HaveOccurred(), "Failed to delete finalize cgu on target hub cluster") | ||
}) | ||
}) | ||
|
||
It("Upgrade prep abort flow", reportxml.ID("68956"), func() { | ||
By("Creating, enabling ibu pre-prep CGU and waiting for CGU status to report completed", func() { | ||
prePrepCguBuilder := cgu.NewCguBuilder(cnfinittools.TargetHubAPIClient, | ||
tsparams.PrePrepCguName, tsparams.IbuCguNamespace, 1). | ||
WithCluster(tsparams.TargetSnoClusterName). | ||
WithManagedPolicy(tsparams.PrePrepPolicyName). | ||
WithCanary(tsparams.TargetSnoClusterName) | ||
prePrepCguBuilder.Definition.Spec.Enable = ptr.To(true) | ||
|
||
prePrepCguBuilder, err := prePrepCguBuilder.Create() | ||
Expect(err).ToNot(HaveOccurred(), "Failed to create pre-prep CGU.") | ||
|
||
_, err = prePrepCguBuilder.WaitUntilComplete(10 * time.Minute) | ||
Expect(err).ToNot(HaveOccurred(), "Pre-prep CGU did not complete in time.") | ||
}) | ||
|
||
By("Creating, enabling ibu prep CGU and waiting for CGU status to report completed", func() { | ||
prepCguBuilder := cgu.NewCguBuilder(cnfinittools.TargetHubAPIClient, | ||
tsparams.PrepCguName, tsparams.IbuCguNamespace, 1). | ||
WithCluster(tsparams.TargetSnoClusterName). | ||
WithManagedPolicy(tsparams.PrepPolicyName). | ||
WithCanary(tsparams.TargetSnoClusterName) | ||
prepCguBuilder.Definition.Spec.Enable = ptr.To(true) | ||
|
||
prepCguBuilder, err := prepCguBuilder.Create() | ||
Expect(err).ToNot(HaveOccurred(), "Failed to create prep CGU.") | ||
|
||
_, err = prepCguBuilder.WaitUntilComplete(25 * time.Minute) | ||
Expect(err).ToNot(HaveOccurred(), "Prep CGU did not complete in time.") | ||
}) | ||
|
||
By("Creating, enabling ibu finalize CGU and waiting for CGU status to report completed", func() { | ||
finalizeCguBuilder := cgu.NewCguBuilder(cnfinittools.TargetHubAPIClient, | ||
tsparams.FinalizeCguName, tsparams.IbuCguNamespace, 1). | ||
WithCluster(tsparams.TargetSnoClusterName). | ||
WithManagedPolicy(tsparams.FinalizePolicyName). | ||
WithCanary(tsparams.TargetSnoClusterName) | ||
finalizeCguBuilder.Definition.Spec.Enable = ptr.To(true) | ||
|
||
finalizeCguBuilder, err := finalizeCguBuilder.Create() | ||
Expect(err).ToNot(HaveOccurred(), "Failed to create finalize CGU.") | ||
|
||
_, err = finalizeCguBuilder.WaitUntilComplete(5 * time.Minute) | ||
Expect(err).ToNot(HaveOccurred(), "Finalize CGU did not complete in time.") | ||
}) | ||
}) | ||
}) |