-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Fix a bug in apply resources (#389)
* Fix a bug in apply resources This may impact multiple functions Signed-off-by: Jian Qiu <jqiu@redhat.com> * Add an e2e test on init update Signed-off-by: Jian Qiu <jqiu@redhat.com> --------- Signed-off-by: Jian Qiu <jqiu@redhat.com>
- Loading branch information
Showing
3 changed files
with
56 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright Contributors to the Open Cluster Management project | ||
|
||
package clusteradme2e | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/onsi/ginkgo/v2" | ||
"github.com/onsi/gomega" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
var _ = ginkgo.Describe("test clusteradm with bootstrap token in singleton mode", func() { | ||
ginkgo.BeforeEach(func() { | ||
ginkgo.By("clear e2e environment...") | ||
err := e2e.ClearEnv() | ||
gomega.Expect(err).NotTo(gomega.HaveOccurred()) | ||
}) | ||
|
||
ginkgo.Context("init cluster manager", func() { | ||
ginkgo.It("should init multiple times with different flags", func() { | ||
ginkgo.By("init hub with bootstrap token") | ||
err := e2e.Clusteradm().Init( | ||
"--use-bootstrap-token", | ||
"--context", e2e.Cluster().Hub().Context(), | ||
"--bundle-version=latest", | ||
) | ||
gomega.Expect(err).NotTo(gomega.HaveOccurred(), "clusteradm init error") | ||
|
||
cm, err := operatorClient.OperatorV1().ClusterManagers().Get(context.TODO(), "cluster-manager", metav1.GetOptions{}) | ||
gomega.Expect(err).NotTo(gomega.HaveOccurred()) | ||
gomega.Expect(len(cm.Spec.RegistrationConfiguration.FeatureGates)).Should(gomega.Equal(1)) | ||
|
||
err = e2e.Clusteradm().Init( | ||
"--use-bootstrap-token", | ||
"--context", e2e.Cluster().Hub().Context(), | ||
"--feature-gates=ManagedClusterAutoApproval=true", | ||
"--bundle-version=latest", | ||
) | ||
gomega.Expect(err).NotTo(gomega.HaveOccurred(), "clusteradm init error") | ||
cm, err = operatorClient.OperatorV1().ClusterManagers().Get(context.TODO(), "cluster-manager", metav1.GetOptions{}) | ||
gomega.Expect(err).NotTo(gomega.HaveOccurred()) | ||
gomega.Expect(len(cm.Spec.RegistrationConfiguration.FeatureGates)).Should(gomega.Equal(2)) | ||
}) | ||
}) | ||
}) |