You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/04/09 23:41:29 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #15296: Chart: Allow setting an existing secret for PgBouncer config

kaxil commented on a change in pull request #15296:
URL: https://github.com/apache/airflow/pull/15296#discussion_r610952261



##########
File path: chart/tests/test_pgbouncer.py
##########
@@ -77,3 +77,40 @@ def test_should_create_valid_affinity_tolerations_and_node_selector(self):
             "spec.template.spec.tolerations[0].key",
             docs[0],
         )
+
+    def test_no_existing_secret(self):
+        docs = render_chart(
+            "TEST-PGBOUNCER-CONFIG",
+            values={
+                "pgbouncer": {
+                    "enabled": True
+                },

Review comment:
       ```suggestion
                   "pgbouncer": {"enabled": True},
   ```

##########
File path: chart/tests/test_pgbouncer.py
##########
@@ -77,3 +77,40 @@ def test_should_create_valid_affinity_tolerations_and_node_selector(self):
             "spec.template.spec.tolerations[0].key",
             docs[0],
         )
+
+    def test_no_existing_secret(self):
+        docs = render_chart(
+            "TEST-PGBOUNCER-CONFIG",
+            values={
+                "pgbouncer": {
+                    "enabled": True
+                },
+            },
+            show_only=["templates/pgbouncer/pgbouncer-deployment.yaml"],
+        )
+
+        assert {
+            "name": "pgbouncer-config",
+            "secret": {
+                "secretName": "TEST-PGBOUNCER-CONFIG-pgbouncer-config"
+            }

Review comment:
       ```suggestion
               "secret": {"secretName": "TEST-PGBOUNCER-CONFIG-pgbouncer-config"},
   ```

##########
File path: chart/tests/test_pgbouncer.py
##########
@@ -77,3 +77,40 @@ def test_should_create_valid_affinity_tolerations_and_node_selector(self):
             "spec.template.spec.tolerations[0].key",
             docs[0],
         )
+
+    def test_no_existing_secret(self):
+        docs = render_chart(
+            "TEST-PGBOUNCER-CONFIG",
+            values={
+                "pgbouncer": {
+                    "enabled": True
+                },
+            },
+            show_only=["templates/pgbouncer/pgbouncer-deployment.yaml"],
+        )
+
+        assert {
+            "name": "pgbouncer-config",
+            "secret": {
+                "secretName": "TEST-PGBOUNCER-CONFIG-pgbouncer-config"
+            }
+        } == jmespath.search("spec.template.spec.volumes[0]", docs[0])
+
+    def test_existing_secret(self):
+        docs = render_chart(
+            "TEST-PGBOUNCER-CONFIG",
+            values={
+                "pgbouncer": {
+                    "enabled": True,
+                    "configSecretName": "pgbouncer-config-secret"
+                },

Review comment:
       ```suggestion
                   "pgbouncer": {"enabled": True, "configSecretName": "pgbouncer-config-secret"},
   ```

##########
File path: chart/tests/test_pgbouncer.py
##########
@@ -77,3 +77,40 @@ def test_should_create_valid_affinity_tolerations_and_node_selector(self):
             "spec.template.spec.tolerations[0].key",
             docs[0],
         )
+
+    def test_no_existing_secret(self):
+        docs = render_chart(
+            "TEST-PGBOUNCER-CONFIG",
+            values={
+                "pgbouncer": {
+                    "enabled": True
+                },
+            },
+            show_only=["templates/pgbouncer/pgbouncer-deployment.yaml"],
+        )
+
+        assert {
+            "name": "pgbouncer-config",
+            "secret": {
+                "secretName": "TEST-PGBOUNCER-CONFIG-pgbouncer-config"
+            }
+        } == jmespath.search("spec.template.spec.volumes[0]", docs[0])
+
+    def test_existing_secret(self):
+        docs = render_chart(
+            "TEST-PGBOUNCER-CONFIG",
+            values={
+                "pgbouncer": {
+                    "enabled": True,
+                    "configSecretName": "pgbouncer-config-secret"
+                },
+            },
+            show_only=["templates/pgbouncer/pgbouncer-deployment.yaml"],
+        )
+
+        assert {
+            "name": "pgbouncer-config",
+            "secret": {
+                "secretName": "pgbouncer-config-secret"
+            }

Review comment:
       ```suggestion
               "secret": {"secretName": "pgbouncer-config-secret"},
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org