-
Notifications
You must be signed in to change notification settings - Fork 28
add env test cases for adopting consumers and credentials #2634
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
base: main
Are you sure you want to change the base?
Conversation
2147267 to
3f4ecfc
Compare
tao12345666333
left a comment
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.
There is some repetitive code. I think we can simplify it by creating a function.
ee31754 to
529b118
Compare
529b118 to
a3553b5
Compare
| Adopt: &commonv1alpha1.AdoptOptions{ | ||
| From: commonv1alpha1.AdoptSourceKonnect, | ||
| Mode: commonv1alpha1.AdoptModeOverride, | ||
| Konnect: &commonv1alpha1.AdoptKonnectOptions{ | ||
| ID: jwtID, | ||
| }, | ||
| }, |
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 OK to be used as is in this PR but I think we can extract this to a generate function in a separate PR and refactor all the usages of AdoptOptions to use that new function. WDYT?
| "HMAC credential should get the Programmed condition", | ||
| ) | ||
| }) | ||
|
|
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.
| t.Log("Creating a KongCredentialBasicAuth to adopt the BasicAuth") | ||
| createdBasicAuth := &configurationv1alpha1.KongCredentialBasicAuth{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| GenerateName: "basic-auth", |
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.
| GenerateName: "basic-auth", | |
| GenerateName: "basic-auth-", |
| t.Log("Creating a KongCredentialACL to adopt the ACL") | ||
| createdACL := &configurationv1alpha1.KongCredentialACL{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| GenerateName: "acl", |
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.
| GenerateName: "acl", | |
| GenerateName: "acl-", |
| t.Log("Creating a KongCredentialHMACAuth to adopt the existing HMAC auth") | ||
| createdHMACAuth := &configurationv1alpha1.KongCredentialHMAC{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| GenerateName: "hmac", |
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.
| GenerateName: "hmac", | |
| GenerateName: "hmac-", |
| t.Log("Creating a KongCredentialJWT for adopting the existing JWT auth") | ||
| createdJWT := &configurationv1alpha1.KongCredentialJWT{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| GenerateName: "jwt", |
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.
| GenerateName: "jwt", | |
| GenerateName: "jwt-", |
What this PR does / why we need it:
Test adopting
KongConsumerand allKongCredential*entities in envtest.Which issue this PR fixes
Part of #2545
Special notes for your reviewer:
PR Readiness Checklist:
Complete these before marking the PR as
ready to review:CHANGELOG.mdrelease notes have been updated to reflect significant changes