-
Notifications
You must be signed in to change notification settings - Fork 517
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 validation of references to CA certificate in TLS config #1119
Changes from 1 commit
a6a973b
eb8711f
883995a
ad7e21e
a4d6508
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,15 @@ func newScramReplicaSet(users ...mdbv1.MongoDBUser) mdbv1.MongoDBCommunity { | |
} | ||
|
||
func newTestReplicaSetWithTLS() mdbv1.MongoDBCommunity { | ||
return newTestReplicaSetWithTLSCaCertificateReferences(&mdbv1.LocalObjectReference{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please help me understand what this change bring to the table? I'm not sure if it changes anything? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It allows us to create test fixtures, where the caller passes custom arguments. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, understood. Thanks |
||
Name: "caConfigMap", | ||
}, | ||
&mdbv1.LocalObjectReference{ | ||
Name: "certificateKeySecret", | ||
}) | ||
} | ||
|
||
func newTestReplicaSetWithTLSCaCertificateReferences(caConfigMap, caCertificateSecret *mdbv1.LocalObjectReference) mdbv1.MongoDBCommunity { | ||
return mdbv1.MongoDBCommunity{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "my-rs", | ||
|
@@ -101,10 +110,9 @@ func newTestReplicaSetWithTLS() mdbv1.MongoDBCommunity { | |
Modes: []mdbv1.AuthMode{"SCRAM"}, | ||
}, | ||
TLS: mdbv1.TLS{ | ||
Enabled: true, | ||
CaConfigMap: &mdbv1.LocalObjectReference{ | ||
Name: "caConfigMap", | ||
}, | ||
Enabled: true, | ||
CaConfigMap: caConfigMap, | ||
CaCertificateSecret: caCertificateSecret, | ||
CertificateKeySecret: mdbv1.LocalObjectReference{ | ||
Name: "certificateKeySecret", | ||
}, | ||
|
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's quite a lot of code duplication within this test. Can I ask you to re-implement it to the parameters-driven test, like https://github.com/mongodb/mongodb-kubernetes-operator/blob/master/test/e2e/replica_set_arbiter/replica_set_arbiter_test.go#L28 ?
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.
Yes sure. I initially started it as a table-driven test, but skimming through the codebase it didn't seem to me like a prevalent pattern.