-
Notifications
You must be signed in to change notification settings - Fork 21
CLOUDP-349087: Fix TLS disable + scale up test #490
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: master
Are you sure you want to change the base?
Changes from all commits
1d8847e
2d3e540
dce4046
cd569e1
29faeff
e12bd07
52bfba1
20f6845
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import pytest | ||
from kubetester import try_load | ||
from kubetester.certs import ISSUER_CA_NAME, create_mongodb_tls_certs | ||
from kubetester.kubetester import fixture as load_fixture | ||
from kubetester.mongodb import MongoDB | ||
|
@@ -20,7 +21,8 @@ def replica_set(namespace: str, server_certs: str, issuer_ca_configmap: str) -> | |
# Set this ReplicaSet to allowSSL mode | ||
# this is the only mode that can go to "disabled" state. | ||
res["spec"]["additionalMongodConfig"] = {"net": {"ssl": {"mode": "allowSSL"}}} | ||
|
||
if try_load(res): | ||
return res | ||
return res.create() | ||
|
||
|
||
|
@@ -38,18 +40,11 @@ def test_rs_is_running(replica_set: MongoDB): | |
def test_tls_is_disabled_and_scaled_up(replica_set: MongoDB): | ||
replica_set.load() | ||
replica_set["spec"]["members"] = 5 | ||
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. The issue in the test is that it was doing the update in two steps (scale, and then disable tls), while the whole point is to change them at the same time. (on top of having a duplicate function name) |
||
|
||
replica_set.update() | ||
|
||
|
||
@pytest.mark.e2e_disable_tls_scale_up | ||
def test_tls_is_disabled_and_scaled_up(replica_set: MongoDB): | ||
replica_set.load() | ||
replica_set["spec"]["security"]["tls"]["enabled"] = False | ||
del replica_set["spec"]["additionalMongodConfig"] | ||
|
||
replica_set.update() | ||
|
||
# timeout is longer because the operator first needs to | ||
# disable TLS and then, scale down one by one. | ||
# disable TLS and then, scale up one by one. | ||
replica_set.assert_reaches_phase(Phase.Running, timeout=800) |
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.
what if we just block this with validation and say that it's not possible to change both member count and disabling TLS at the same time?
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, after discussing it in DM, let's do that instead of adding complexity to the reconcile loop. This is not a common use case anyway.