-
Notifications
You must be signed in to change notification settings - Fork 16
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
Drop legacy catalog for tests #291
Conversation
Requires rancher-sandbox/ele-testhelpers#25 |
19b3de4
to
c7d26c8
Compare
EventuallyWithOffset(1, func() error { | ||
return k.ApplyYAML(fleetNamespace, name, mr) | ||
return k.ApplyJSON("", name, mr) |
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.
You can also use controller runtime client to create/update/delete object as we did here https://github.com/rancher/elemental-operator/blob/main/tests/e2e/machineregistration_test.go#L95
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.
Indeed, let me give it a try. I guess not all kubectl calls of this test can be replaced though.
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.
@alexander-demicev see my last commit, I used the controller runtime to create the CRDs instead of the kubectl wrapper with JSON inputs, however I could not manage to use the controller runtime to fetch CRDs that are not defined by this controller API, which is problematic for this tests as it operates with CRDS from github.com/rancher/system-upgrade-controller/pkg/apis/upgrade.cattle.io/v1
. For instance if trying to adapt
elemental-operator/tests/e2e/upgrades_test.go
Lines 37 to 41 in 3d0af6e
func getPlan(s string) (up *upgradev1.Plan, err error) { | |
up = &upgradev1.Plan{} | |
err = kubectl.GetObject(s, cattleSystemNamespace, "plan", up) | |
return | |
} |
I get a
no kind is registered for the type v1.Plan in scheme
error, which I assume is caused because system-upgrade-controller
is not based on controller runtime. Do you know if this is something we can easily circumvent? Otherwise I am more leaning towards dropping my latest commit and do not use the controller runtime client for this test. I dislike using two different k8s clients on the same piece of code, specially for tests it turns to be confusing.
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.
I finally dropped the last commit and for now I did not use the client from controller runtime. As I could not figure out a proper way to use it for all cases required here in this test.
799a5ae
to
4e08044
Compare
Signed-off-by: David Cassany <dcassany@suse.com>
Signed-off-by: David Cassany <dcassany@suse.com>
Signed-off-by: David Cassany <dcassany@suse.com>
4e08044
to
054057d
Compare
Signed-off-by: David Cassany dcassany@suse.com