Merge ~mthaddon/charm-k8s-mattermost/+git/charm-k8s-mattermost:test-make-pod-config into charm-k8s-mattermost:master

Proposed by Tom Haddon
Status: Merged
Approved by: Tom Haddon
Approved revision: e877f842fc26fe223404a78277650d171262936f
Merged at revision: 9eebaf68b99783debe3b0c28fe6f38abf5ba135d
Proposed branch: ~mthaddon/charm-k8s-mattermost/+git/charm-k8s-mattermost:test-make-pod-config
Merge into: charm-k8s-mattermost:master
Diff against target: 43 lines (+32/-0)
1 file modified
tests/unit/test_charm.py (+32/-0)
Reviewer Review Type Date Requested Status
Barry Price Approve
🤖 prod-jenkaas-is (community) continuous-integration Approve
Canonical IS Reviewers Pending
Review via email: mp+399429@code.launchpad.net

Commit message

Add tests for the make_pod_config function

Description of the change

Add tests for the make_pod_config function

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
🤖 prod-jenkaas-is (prod-jenkaas-is) wrote :

A CI job is currently in progress. A follow up comment will be added when it completes.

Revision history for this message
🤖 prod-jenkaas-is (prod-jenkaas-is) wrote :
review: Approve (continuous-integration)
Revision history for this message
Barry Price (barryprice) wrote :

LGTM +1

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 9eebaf68b99783debe3b0c28fe6f38abf5ba135d

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py
2index 1d3019b..44bee1f 100644
3--- a/tests/unit/test_charm.py
4+++ b/tests/unit/test_charm.py
5@@ -121,6 +121,38 @@ class TestMattermostK8sCharmHooksDisabled(unittest.TestCase):
6 )
7 self.assertEqual(self.harness.charm._check_for_config_problems(), expected)
8
9+ def test_make_pod_config(self):
10+ """Make pod config."""
11+ self.harness.charm.state.db_uri = 'postgresql://10.0.1.101:5432/'
12+ expected = {
13+ 'MATTERMOST_HTTPD_LISTEN_PORT': 8065,
14+ 'MM_CONFIG': 'postgres://10.0.1.101:5432/',
15+ 'MM_IMAGEPROXYSETTINGS_ENABLE': 'false',
16+ 'MM_IMAGEPROXYSETTINGS_IMAGEPROXYTYPE': 'local',
17+ 'MM_LOGSETTINGS_CONSOLELEVEL': 'INFO',
18+ 'MM_LOGSETTINGS_ENABLECONSOLE': 'true',
19+ 'MM_LOGSETTINGS_ENABLEFILE': 'false',
20+ 'MM_SQLSETTINGS_DATASOURCE': 'postgres://10.0.1.101:5432/',
21+ }
22+ self.assertEqual(self.harness.charm._make_pod_config(), expected)
23+ # Now test with `primary_team` set.
24+ self.harness.update_config({"primary_team": "myteam"})
25+ expected['MM_TEAMSETTINGS_EXPERIMENTALPRIMARYTEAM'] = "myteam"
26+ self.assertEqual(self.harness.charm._make_pod_config(), expected)
27+ # Now test with `site_url` set.
28+ self.harness.update_config({"site_url": "myteam.mattermost.io"})
29+ expected['MM_SERVICESETTINGS_SITEURL'] = "myteam.mattermost.io"
30+ self.assertEqual(self.harness.charm._make_pod_config(), expected)
31+ # Now test with `outbound_proxy` set.
32+ self.harness.update_config({"outbound_proxy": "http://squid.internal:3128"})
33+ expected['HTTP_PROXY'] = "http://squid.internal:3128"
34+ expected['HTTPS_PROXY'] = "http://squid.internal:3128"
35+ self.assertEqual(self.harness.charm._make_pod_config(), expected)
36+ # Now test with `outbound_proxy_exceptions` set.
37+ self.harness.update_config({"outbound_proxy_exceptions": "charmhub.io"})
38+ expected['NO_PROXY'] = "charmhub.io"
39+ self.assertEqual(self.harness.charm._make_pod_config(), expected)
40+
41 def test_make_s3_pod_config(self):
42 """Make s3 pod config."""
43 self.harness.update_config(CONFIG_NO_S3_SETTINGS_S3_ENABLED)

Subscribers

People subscribed via source and target branches