Skip to content

Commit

Permalink
chore: Add immediate requeues to MRM sync test
Browse files Browse the repository at this point in the history
  • Loading branch information
c-pius committed Dec 27, 2024
1 parent d377182 commit 1134b13
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/testutils/kyma.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/kyma-project/lifecycle-manager/api/v1beta2"
"github.com/kyma-project/lifecycle-manager/pkg/status"
"github.com/kyma-project/lifecycle-manager/pkg/testutils/builder"
"github.com/kyma-project/lifecycle-manager/pkg/testutils/random"
"github.com/kyma-project/lifecycle-manager/pkg/util"
"github.com/kyma-project/lifecycle-manager/pkg/watcher"
)
Expand Down Expand Up @@ -233,6 +234,15 @@ func UpdateKymaLabel(
return nil
}

// ImmediatelyRequeueKyma adds a dummy label to the Kyma CR to trigger a requeue.
func ImmediatelyRequeueKyma(
ctx context.Context,
clnt client.Client,
kymaName, kymaNamespace string,
) error {
return UpdateKymaLabel(ctx, clnt, kymaName, kymaNamespace, "operator.kyma-project.io/dummy-label", random.Name())
}

func GetKyma(ctx context.Context, clnt client.Client, name, namespace string) (*v1beta2.Kyma, error) {
kymaInCluster := &v1beta2.Kyma{}

Expand Down
21 changes: 21 additions & 0 deletions tests/e2e/modulereleasemeta_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ var _ = Describe("ModuleReleaseMeta Sync", Ordered, func() {
WithArguments(kcpClient, module, v1beta2.DefaultChannel, ControlPlaneNamespace).
Should(Succeed())

Eventually(ImmediatelyRequeueKyma).
WithContext(ctx).
WithArguments(kcpClient, kyma.Name, kyma.Namespace).
Should(Succeed())

By("And the Template Operator v1 ModuleTemplate exists in the SKR Cluster")
Eventually(ModuleTemplateExists).
WithContext(ctx).
Expand Down Expand Up @@ -61,6 +66,10 @@ var _ = Describe("ModuleReleaseMeta Sync", Ordered, func() {
WithContext(ctx).
WithArguments(true, module.Name, ControlPlaneNamespace, kcpClient).
Should(Succeed())
Eventually(ImmediatelyRequeueKyma).
WithContext(ctx).
WithArguments(kcpClient, kyma.Name, kyma.Namespace).
Should(Succeed())

By("Then the ModuleReleaseMeta no longer exists on the SKR Cluster")
Eventually(ModuleReleaseMetaExists).
Expand Down Expand Up @@ -99,6 +108,10 @@ var _ = Describe("ModuleReleaseMeta Sync", Ordered, func() {
WithContext(ctx).
WithArguments(true, module.Name, ControlPlaneNamespace, kcpClient).
Should(Succeed())
Eventually(ImmediatelyRequeueKyma).
WithContext(ctx).
WithArguments(kcpClient, kyma.Name, kyma.Namespace).
Should(Succeed())

By("Then the ModuleReleaseMeta no longer exists on the SKR Cluster")
Eventually(ModuleReleaseMetaExists).
Expand Down Expand Up @@ -157,6 +170,10 @@ var _ = Describe("ModuleReleaseMeta Sync", Ordered, func() {
WithContext(ctx).
WithArguments(kcpClient, module.Name, ControlPlaneNamespace, v1beta2.DefaultChannel, NewerVersion).
Should(Succeed())
Eventually(ImmediatelyRequeueKyma).
WithContext(ctx).
WithArguments(kcpClient, kyma.Name, kyma.Namespace).
Should(Succeed())

By("Then the Template Operator v2 ModuleTemplate exists in the KCP Cluster")
Eventually(ModuleTemplateExists).
Expand Down Expand Up @@ -198,6 +215,10 @@ var _ = Describe("ModuleReleaseMeta Sync", Ordered, func() {
WithContext(ctx).
WithArguments(module.Name, ControlPlaneNamespace, kcpClient).
Should(Succeed())
Eventually(ImmediatelyRequeueKyma).
WithContext(ctx).
WithArguments(kcpClient, kyma.Name, kyma.Namespace).
Should(Succeed())

By("Then the ModuleReleaseMeta no longer exists on the KCP Cluster")
Eventually(ModuleReleaseMetaExists).
Expand Down

0 comments on commit 1134b13

Please sign in to comment.