-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Fix a bug in apply resources #389
Merged
openshift-merge-bot
merged 2 commits into
open-cluster-management-io:main
from
qiujian16:fix-apply
Nov 8, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @qiujian16 could you add some comments/tests for this, I do not understand why moving this func upper can fix the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is to get the modified object, it has to be called before info.Get() otherwise the info.Object will be from the server. A test is added.