forked from kyma-project/lifecycle-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add Concept for Maintenance Window with Module Downtime E2E Test (
kyma-project#2187) * test: Add Concept for Maintenance Window with Module Downtime E2E Test * fix: Add Test to E2E Matrix * chore: Log Maintenance Window Policy * fix: Replace Eventually with Consistently * chore: Use Latest Modulectl Release * refactor: Add Trailing Empty Line Co-authored-by: Christoph Schwägerl <[email protected]> * refactor: Remove Extra Build Step * refactor: Remove Unnecessary Quotes --------- Co-authored-by: Christoph Schwägerl <[email protected]>
- Loading branch information
1 parent
c087c13
commit 0301f08
Showing
7 changed files
with
205 additions
and
4 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
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
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
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
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
139 changes: 139 additions & 0 deletions
139
tests/e2e/modulereleasemeta_maintenance_window_module_downtime_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,139 @@ | ||
package e2e_test | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
|
||
"github.com/kyma-project/lifecycle-manager/api/shared" | ||
"github.com/kyma-project/lifecycle-manager/api/v1beta2" | ||
. "github.com/kyma-project/lifecycle-manager/pkg/testutils" | ||
. "github.com/kyma-project/lifecycle-manager/tests/e2e/commontestutils" | ||
) | ||
|
||
var _ = Describe("Maintenance Window With ModuleReleaseMeta and Module Downtime", Ordered, func() { | ||
kyma := NewKymaWithSyncLabel("kyma-sample", ControlPlaneNamespace, v1beta2.DefaultChannel) | ||
kyma.Labels["operator.kyma-project.io/region"] = "europe" | ||
kyma.Spec.SkipMaintenanceWindows = false | ||
/* | ||
Maintenance Windows are defined as such: | ||
region asia: current time - current time + 2 hours | ||
region europe: tomorrow | ||
*/ | ||
|
||
module := NewTemplateOperator(v1beta2.DefaultChannel) | ||
moduleCR := NewTestModuleCR(RemoteNamespace) | ||
|
||
InitEmptyKymaBeforeAll(kyma) | ||
CleanupKymaAfterAll(kyma) | ||
|
||
Context("Given SKR Cluster", func() { | ||
It("When Kyma Module is enabled on SKR Kyma CR and Maintenance Window is opt in", func() { | ||
Eventually(EnableModule). | ||
WithContext(ctx). | ||
WithArguments(skrClient, defaultRemoteKymaName, RemoteNamespace, module). | ||
Should(Succeed()) | ||
}) | ||
|
||
It("Then Module CR is deployed", func() { | ||
Eventually(ModuleCRExists). | ||
WithContext(ctx). | ||
WithArguments(skrClient, moduleCR). | ||
Should(Succeed()) | ||
|
||
By("And Module Operator Deployment is deployed") | ||
Eventually(DeploymentIsReady). | ||
WithContext(ctx). | ||
WithArguments(skrClient, ModuleDeploymentNameInOlderVersion, TestModuleResourceNamespace). | ||
Should(Succeed()) | ||
|
||
By("And KCP Kyma CR is in \"Ready\" State") | ||
Eventually(KymaIsInState). | ||
WithContext(ctx). | ||
WithArguments(kyma.GetName(), kyma.GetNamespace(), kcpClient, shared.StateReady). | ||
Should(Succeed()) | ||
}) | ||
|
||
It("When new version requiring downtime is selected in ModuleReleaseMeta,"+ | ||
" but no Maintenance Window is active", func() { | ||
Eventually(UpdateChannelVersionInModuleReleaseMeta). | ||
WithContext(ctx). | ||
WithArguments(kcpClient, module.Name, ControlPlaneNamespace, v1beta2.DefaultChannel, NewerVersion). | ||
Should(Succeed()) | ||
}) | ||
|
||
It("Then Module CR exists", func() { | ||
Eventually(ModuleCRExists). | ||
WithContext(ctx). | ||
WithArguments(skrClient, moduleCR). | ||
Should(Succeed()) | ||
|
||
By("And old Module Operator Deployment still exists") | ||
Consistently(DeploymentIsReady). | ||
WithContext(ctx). | ||
WithArguments(skrClient, ModuleDeploymentNameInOlderVersion, TestModuleResourceNamespace). | ||
Should(Succeed()) | ||
|
||
By("And new Module Operator Deployment is not deployed") | ||
Consistently(DeploymentIsReady). | ||
WithContext(ctx). | ||
WithArguments(skrClient, ModuleDeploymentNameInNewerVersion, TestModuleResourceNamespace). | ||
Should(Equal(ErrNotFound)) | ||
|
||
By("And KCP Kyma CR is in \"Ready\" State") | ||
Eventually(KymaIsInState). | ||
WithContext(ctx). | ||
WithArguments(kyma.GetName(), kyma.GetNamespace(), kcpClient, shared.StateReady). | ||
Should(Succeed()) | ||
}) | ||
|
||
It("When a Maintenance Window is active", func() { | ||
Eventually(UpdateKymaLabel). | ||
WithContext(ctx). | ||
WithArguments(kcpClient, kyma.Name, kyma.Namespace, "operator.kyma-project.io/region", "asia"). | ||
Should(Succeed()) | ||
}) | ||
|
||
It("Then Module CR exists", func() { | ||
Eventually(ModuleCRExists). | ||
WithContext(ctx). | ||
WithArguments(skrClient, moduleCR). | ||
Should(Succeed()) | ||
|
||
By("And old Module Operator Deployment no longer exists") | ||
Eventually(DeploymentIsReady). | ||
WithContext(ctx). | ||
WithArguments(skrClient, ModuleDeploymentNameInOlderVersion, TestModuleResourceNamespace). | ||
Should(Equal(ErrNotFound)) | ||
|
||
By("And new Module Operator Deployment is deployed") | ||
Eventually(DeploymentIsReady). | ||
WithContext(ctx). | ||
WithArguments(skrClient, ModuleDeploymentNameInNewerVersion, TestModuleResourceNamespace). | ||
Should(Succeed()) | ||
|
||
By("And KCP Kyma CR is in \"Ready\" State") | ||
Eventually(KymaIsInState). | ||
WithContext(ctx). | ||
WithArguments(kyma.GetName(), kyma.GetNamespace(), kcpClient, shared.StateReady). | ||
Should(Succeed()) | ||
|
||
By("And Kyma Module Version in Kyma Status is updated") | ||
newModuleTemplateVersion, err := ReadModuleVersionFromModuleTemplate(ctx, kcpClient, module, | ||
kyma.Spec.Channel, ControlPlaneNamespace) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
Eventually(ModuleVersionInKymaStatusIsCorrect). | ||
WithContext(ctx). | ||
WithArguments(kcpClient, kyma.GetName(), kyma.GetNamespace(), module.Name, | ||
newModuleTemplateVersion). | ||
Should(Succeed()) | ||
|
||
By("And Manifest Version is updated") | ||
Eventually(ManifestVersionIsCorrect). | ||
WithContext(ctx). | ||
WithArguments(kcpClient, kyma.GetName(), kyma.GetNamespace(), module.Name, | ||
newModuleTemplateVersion). | ||
Should(Succeed()) | ||
}) | ||
}) | ||
}) |
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