-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chart: Fix
PgBouncer
exporter sidecar (#16099)
An extra colon crept in and was breaking the pgbouncer exporter sidecar
- Loading branch information
1 parent
2c17257
commit 71ef2f2
Showing
2 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -314,3 +314,44 @@ def test_ssl_config(self): | |
encoded = jmespath.search(f'data."{key}"', docs[0]) | ||
value = base64.b64decode(encoded).decode() | ||
assert expected == value | ||
|
||
|
||
class PgbouncerExporterTest(unittest.TestCase): | ||
def test_secret_not_created_by_default(self): | ||
docs = render_chart( | ||
show_only=["templates/secrets/pgbouncer-stats-secret.yaml"], | ||
) | ||
assert 0 == len(docs) | ||
|
||
def _get_connection(self, values: dict) -> str: | ||
docs = render_chart( | ||
values=values, | ||
show_only=["templates/secrets/pgbouncer-stats-secret.yaml"], | ||
) | ||
encoded_connection = jmespath.search("data.connection", docs[0]) | ||
return base64.b64decode(encoded_connection).decode() | ||
|
||
def test_default_exporter_secret(self): | ||
connection = self._get_connection({"pgbouncer": {"enabled": True}}) | ||
assert "postgresql://postgres:[email protected]:6543/pgbouncer?sslmode=disable" == connection | ||
|
||
def test_exporter_secret_with_overrides(self): | ||
connection = self._get_connection( | ||
{ | ||
"pgbouncer": {"enabled": True}, | ||
"data": { | ||
"metadataConnection": { | ||
"user": "username@123123", | ||
"pass": "password@!@#$^&*()", | ||
"host": "somehost", | ||
"port": 7777, | ||
"db": "somedb", | ||
}, | ||
}, | ||
"ports": {"pgbouncer": 1111}, | ||
} | ||
) | ||
assert ( | ||
"postgresql://username%40123123:password%40%21%40%23$%5E&%2A%28%[email protected]:1111" | ||
"/pgbouncer?sslmode=disable" == connection | ||
) |