-
Notifications
You must be signed in to change notification settings - Fork 158
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
tests: e2e test for trusted-ca-bundle #1346
tests: e2e test for trusted-ca-bundle #1346
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/cc @VaishnaviHire |
52a655a
to
7897693
Compare
tests/e2e/helper_test.go
Outdated
@@ -129,45 +129,45 @@ func setupDSCInstance(name string) *dscv1.DataScienceCluster { | |||
}, | |||
ModelMeshServing: modelmeshserving.ModelMeshServing{ | |||
Component: components.Component{ | |||
ManagementState: operatorv1.Managed, | |||
ManagementState: operatorv1.Removed, |
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.
The ManagementState changes need to be reverted
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.
oops.. yea my bad. just reverted them
a439e36
to
37d0b92
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## incubation #1346 +/- ##
=============================================
Coverage ? 18.91%
=============================================
Files ? 30
Lines ? 3399
Branches ? 0
=============================================
Hits ? 643
Misses ? 2687
Partials ? 69 ☔ View full report in Codecov by Sentry. |
i dont think it need to be too complicated in test case to cover all 3 senaiors from that "fix" PR. |
@@ -444,6 +451,48 @@ func (tc *testContext) testDefaultCertsAvailable() error { | |||
return nil | |||
} | |||
|
|||
func (tc *testContext) testTrustedCABundle() error { |
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.
not sure i understand the logic here:
if we are making e2e test (not unit-test) , what we should test is:
- set managementStateChangeTrustedCA := true
- check if Configmap is created in tc.testDSCI.Spec.ApplicationsNamespace
- check content of CADataFieldName == tc.testDSCI.Spec.TrustedCABundle.CustomCABundle
- check content of CADataFieldName has newline as ending (this is new from current code base)
- set managementStateChangeTrustedCA := false
- check no Configmap in tc.testDSCI.Spec.ApplicationsNamespace
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.
ok, seems confusion for the above comments:
set managementStateChangeTrustedCA := true
is not meant to be set in the testcase, this is only to illustrate the case when set to Managed
VS Removed
what need to be done is tc.testDSCI.Spec.TrustedCABundle.ManagementState: Managed
37d0b92
to
96ec2c2
Compare
/test opendatahub-operator-e2e |
@Sara4994 what's the status of this PR? It looks like it hasn't seen any update in a couple of weeks, and the last time the e2e test job ran it failed on the newly added test. |
cf7fea7
to
5449a4c
Compare
tests/e2e/creation_test.go
Outdated
return fmt.Errorf("odh-trusted-ca-bundle in config map does not match with DSCI's TrustedCABundle.CustomCABundle, needs update: %w", err) | ||
} | ||
|
||
err = trustedcabundle.AddCABundleCMInAllNamespaces(tc.ctx, tc.customClient, logr.Logger{}, tc.testDSCI) |
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.
Why are we explicitly adding and removing the configmap from all namespaces? Shouldn't this be created by the controller?
6d5d524
to
0516e50
Compare
b639713
to
f72a8a2
Compare
|
||
if k8serr.IsNotFound(err) { | ||
fmt.Printf("Config map not found in the namespace") | ||
} |
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.
We should return other errors here
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.
@VaishnaviHire this is done
tests/e2e/helper_test.go
Outdated
MIIFVjCCAz6gAwIBAgIUQ+NxE9izWRRdt86M/TX9b7wFjUUwDQYJKoZIhvcNAQEL | ||
... | ||
IrrVQJLuM7IjWcmOvFjai57QGfIvWcaMY1q6n6MLsLOaXLoRuBLpDLvPbmyAhykU | ||
------END ------` + "\n", |
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 am not sure we need to add \n
here, since that was the change - to introduce newline if its not in input
cc: @zdtsw correct me if I missed something here
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.
@VaishnaviHire I thought the same but if i dont add newline it there, the check here
if foundConfigMap.Data[CADataFieldName] != tc.testDSCI.Spec.TrustedCABundle.CustomCABundle { |
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 am not sure we need to add \n here, since that was the change - to introduce newline if its not in input
correct, user input data in DSCI should not need to explicility add newline ending
2ddc6ad
to
bede6ac
Compare
/test opendatahub-operator-e2e |
LGTM, @grdryn you wanna give another review? |
if checkNewline == false { | ||
fmt.Print("Newline not found at the end of configmap") | ||
} |
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.
Are both cases acceptable here (newline or not), or should this assert one of the cases?
Also, the check looks like it will pass if a newline character is found anywhere in the string, not just at the end.
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.
@grdryn yea true, i have modified the check here
bede6ac
to
fcc2720
Compare
target branch should be "main" |
@Sara4994 sounds good. I think it's fine to close this one already now. Feel free to re-open if you disagree. |
…flux/component-updates/odh-model-controller-v2-17 chore(deps): update odh-model-controller-v2-17 to 3d61985
Description
This PR is intended to include e2e tests for the trusted CA bundle feature.
JIRA issue: https://issues.redhat.com/browse/RHOAIENG-3924
How Has This Been Tested?
Screenshot or short clip
Merge criteria